sdc-build-wp 4.1.0 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/composer.json +2 -3
  2. package/composer.lock +3 -313
  3. package/index.js +38 -21
  4. package/lib/blocks.js +8 -6
  5. package/lib/style.js +17 -0
  6. package/package.json +1 -1
  7. package/vendor/composer/autoload_classmap.php +0 -37
  8. package/vendor/composer/autoload_psr4.php +0 -1
  9. package/vendor/composer/autoload_real.php +2 -0
  10. package/vendor/composer/autoload_static.php +0 -53
  11. package/vendor/composer/installed.json +1 -329
  12. package/vendor/composer/installed.php +3 -39
  13. package/vendor/composer/platform_check.php +26 -0
  14. package/lib/bustCache.js +0 -14
  15. package/vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md +0 -22
  16. package/vendor/dealerdirect/phpcodesniffer-composer-installer/README.md +0 -285
  17. package/vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json +0 -71
  18. package/vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php +0 -637
  19. package/vendor/phpcsstandards/phpcsextra/CHANGELOG.md +0 -590
  20. package/vendor/phpcsstandards/phpcsextra/LICENSE +0 -165
  21. package/vendor/phpcsstandards/phpcsextra/Modernize/Docs/FunctionCalls/DirnameStandard.xml +0 -40
  22. package/vendor/phpcsstandards/phpcsextra/Modernize/Sniffs/FunctionCalls/DirnameSniff.php +0 -382
  23. package/vendor/phpcsstandards/phpcsextra/Modernize/ruleset.xml +0 -5
  24. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/ArrayBraceSpacingStandard.xml +0 -94
  25. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/CommaAfterLastStandard.xml +0 -43
  26. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/ArrayBraceSpacingSniff.php +0 -305
  27. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/CommaAfterLastSniff.php +0 -226
  28. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/ruleset.xml +0 -5
  29. package/vendor/phpcsstandards/phpcsextra/README.md +0 -573
  30. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DisallowShortArraySyntaxStandard.xml +0 -27
  31. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DuplicateArrayKeyStandard.xml +0 -44
  32. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedArrayKeyTypesStandard.xml +0 -40
  33. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedKeyedUnkeyedArrayStandard.xml +0 -31
  34. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowAnonClassParenthesesStandard.xml +0 -24
  35. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowFinalClassStandard.xml +0 -25
  36. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/ModifierKeywordOrderStandard.xml +0 -27
  37. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireAnonClassParenthesesStandard.xml +0 -23
  38. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireFinalClassStandard.xml +0 -25
  39. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ConstructorDestructorReturnStandard.xml +0 -64
  40. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ForeachUniqueAssignmentStandard.xml +0 -26
  41. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoDoubleNegativeStandard.xml +0 -27
  42. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoEchoSprintfStandard.xml +0 -25
  43. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/StaticInFinalClassStandard.xml +0 -43
  44. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/LowercaseClassResolutionKeywordStandard.xml +0 -23
  45. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/ModifierKeywordOrderStandard.xml +0 -30
  46. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/UppercaseMagicConstantsStandard.xml +0 -25
  47. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowAlternativeSyntaxStandard.xml +0 -35
  48. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowLonelyIfStandard.xml +0 -49
  49. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/IfElseDeclarationStandard.xml +0 -37
  50. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Files/SeparateFunctionsFromOOStandard.xml +0 -45
  51. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/NoLongClosuresStandard.xml +0 -42
  52. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/RequireFinalMethodsInTraitsStandard.xml +0 -33
  53. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowLongListSyntaxStandard.xml +0 -23
  54. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowShortListSyntaxStandard.xml +0 -23
  55. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowCurlyBraceSyntaxStandard.xml +0 -27
  56. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowDeclarationWithoutNameStandard.xml +0 -25
  57. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/EnforceCurlyBraceSyntaxStandard.xml +0 -27
  58. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/OneDeclarationPerFileStandard.xml +0 -27
  59. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/NamingConventions/NoReservedKeywordParameterNamesStandard.xml +0 -23
  60. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/OOStructures/AlphabeticExtendsImplementsStandard.xml +0 -27
  61. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/ConcatPositionStandard.xml +0 -31
  62. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.xml +0 -30
  63. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowShortTernaryStandard.xml +0 -26
  64. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowStandalonePostIncrementDecrementStandard.xml +0 -44
  65. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/StrictComparisonsStandard.xml +0 -29
  66. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/TypeSeparatorSpacingStandard.xml +0 -33
  67. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/LowercasePHPTagStandard.xml +0 -25
  68. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/OneStatementInShortEchoTagStandard.xml +0 -41
  69. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowMixedGroupUseStandard.xml +0 -39
  70. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseClassStandard.xml +0 -25
  71. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseConstStandard.xml +0 -25
  72. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseFunctionStandard.xml +0 -25
  73. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/KeywordSpacingStandard.xml +0 -29
  74. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/LowercaseFunctionConstStandard.xml +0 -25
  75. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoLeadingBackslashStandard.xml +0 -23
  76. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoUselessAliasesStandard.xml +0 -30
  77. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/AnonClassKeywordSpacingStandard.xml +0 -31
  78. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/CommaSpacingStandard.xml +0 -94
  79. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/DisallowInlineTabsStandard.xml +0 -25
  80. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/PrecisionAlignmentStandard.xml +0 -29
  81. package/vendor/phpcsstandards/phpcsextra/Universal/Helpers/DummyTokenizer.php +0 -60
  82. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php +0 -89
  83. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DuplicateArrayKeySniff.php +0 -297
  84. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedArrayKeyTypesSniff.php +0 -174
  85. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedKeyedUnkeyedArraySniff.php +0 -134
  86. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowAnonClassParenthesesSniff.php +0 -112
  87. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowFinalClassSniff.php +0 -116
  88. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/ModifierKeywordOrderSniff.php +0 -188
  89. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireAnonClassParenthesesSniff.php +0 -81
  90. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireFinalClassSniff.php +0 -102
  91. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ConstructorDestructorReturnSniff.php +0 -211
  92. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ForeachUniqueAssignmentSniff.php +0 -153
  93. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoDoubleNegativeSniff.php +0 -269
  94. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoEchoSprintfSniff.php +0 -131
  95. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/StaticInFinalClassSniff.php +0 -216
  96. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/LowercaseClassResolutionKeywordSniff.php +0 -106
  97. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/ModifierKeywordOrderSniff.php +0 -199
  98. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/UppercaseMagicConstantsSniff.php +0 -89
  99. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowAlternativeSyntaxSniff.php +0 -216
  100. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowLonelyIfSniff.php +0 -348
  101. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/IfElseDeclarationSniff.php +0 -164
  102. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Files/SeparateFunctionsFromOOSniff.php +0 -190
  103. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/NoLongClosuresSniff.php +0 -233
  104. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/RequireFinalMethodsInTraitsSniff.php +0 -120
  105. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowLongListSyntaxSniff.php +0 -71
  106. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowShortListSyntaxSniff.php +0 -86
  107. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowCurlyBraceSyntaxSniff.php +0 -81
  108. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowDeclarationWithoutNameSniff.php +0 -80
  109. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/EnforceCurlyBraceSyntaxSniff.php +0 -81
  110. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/OneDeclarationPerFileSniff.php +0 -96
  111. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/NamingConventions/NoReservedKeywordParameterNamesSniff.php +0 -190
  112. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/OOStructures/AlphabeticExtendsImplementsSniff.php +0 -275
  113. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/ConcatPositionSniff.php +0 -204
  114. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowLogicalAndOrSniff.php +0 -112
  115. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowShortTernarySniff.php +0 -76
  116. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowStandalonePostIncrementDecrementSniff.php +0 -197
  117. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/StrictComparisonsSniff.php +0 -116
  118. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/TypeSeparatorSpacingSniff.php +0 -85
  119. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/LowercasePHPTagSniff.php +0 -87
  120. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/OneStatementInShortEchoTagSniff.php +0 -101
  121. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowMixedGroupUseSniff.php +0 -248
  122. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseClassSniff.php +0 -211
  123. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseConstSniff.php +0 -211
  124. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseFunctionSniff.php +0 -211
  125. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/KeywordSpacingSniff.php +0 -207
  126. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/LowercaseFunctionConstSniff.php +0 -156
  127. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoLeadingBackslashSniff.php +0 -170
  128. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoUselessAliasesSniff.php +0 -155
  129. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/AnonClassKeywordSpacingSniff.php +0 -79
  130. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/CommaSpacingSniff.php +0 -408
  131. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/DisallowInlineTabsSniff.php +0 -173
  132. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php +0 -445
  133. package/vendor/phpcsstandards/phpcsextra/Universal/ruleset.xml +0 -5
  134. package/vendor/phpcsstandards/phpcsextra/composer.json +0 -69
  135. package/vendor/phpcsstandards/phpcsutils/.phpdoc.xml.dist +0 -36
  136. package/vendor/phpcsstandards/phpcsutils/CHANGELOG.md +0 -1106
  137. package/vendor/phpcsstandards/phpcsutils/LICENSE +0 -165
  138. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php +0 -551
  139. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php +0 -781
  140. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php +0 -123
  141. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/Helper.php +0 -202
  142. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/InvalidTokenArray.php +0 -44
  143. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestFileNotFound.php +0 -47
  144. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestMarkerNotFound.php +0 -43
  145. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestTargetNotFound.php +0 -50
  146. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Fixers/SpacesFixer.php +0 -246
  147. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/Cache.php +0 -218
  148. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrList.php +0 -687
  149. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrListWithCache.php +0 -269
  150. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/NoFileCache.php +0 -164
  151. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/StableCollections.php +0 -75
  152. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php +0 -459
  153. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php +0 -837
  154. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/TokenHelper.php +0 -55
  155. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Arrays.php +0 -227
  156. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Conditions.php +0 -156
  157. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Context.php +0 -232
  158. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ControlStructures.php +0 -276
  159. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/FunctionDeclarations.php +0 -828
  160. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/GetTokensAsString.php +0 -262
  161. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Lists.php +0 -359
  162. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/MessageHelper.php +0 -145
  163. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Namespaces.php +0 -389
  164. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/NamingConventions.php +0 -116
  165. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Numbers.php +0 -322
  166. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php +0 -359
  167. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Operators.php +0 -252
  168. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Orthography.php +0 -120
  169. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Parentheses.php +0 -419
  170. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/PassedParameters.php +0 -510
  171. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Scopes.php +0 -143
  172. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TextStrings.php +0 -331
  173. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/UseStatements.php +0 -432
  174. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php +0 -333
  175. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/ruleset.xml +0 -4
  176. package/vendor/phpcsstandards/phpcsutils/README.md +0 -297
  177. package/vendor/phpcsstandards/phpcsutils/composer.json +0 -92
  178. package/vendor/phpcsstandards/phpcsutils/phpcsutils-autoload.php +0 -68
  179. package/vendor/wp-coding-standards/wpcs/CHANGELOG.md +0 -1654
  180. package/vendor/wp-coding-standards/wpcs/LICENSE +0 -21
  181. package/vendor/wp-coding-standards/wpcs/README.md +0 -261
  182. package/vendor/wp-coding-standards/wpcs/WordPress/AbstractArrayAssignmentRestrictionsSniff.php +0 -261
  183. package/vendor/wp-coding-standards/wpcs/WordPress/AbstractClassRestrictionsSniff.php +0 -257
  184. package/vendor/wp-coding-standards/wpcs/WordPress/AbstractFunctionParameterSniff.php +0 -111
  185. package/vendor/wp-coding-standards/wpcs/WordPress/AbstractFunctionRestrictionsSniff.php +0 -358
  186. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayIndentationStandard.xml +0 -116
  187. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayKeySpacingRestrictionsStandard.xml +0 -31
  188. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/MultipleStatementAlignmentStandard.xml +0 -50
  189. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/CodeAnalysis/EscapedNotTranslatedStandard.xml +0 -24
  190. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/DateTime/CurrentTimeTimestampStandard.xml +0 -35
  191. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/DateTime/RestrictedFunctionsStandard.xml +0 -54
  192. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/PrefixAllGlobalsStandard.xml +0 -119
  193. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidHookNameStandard.xml +0 -35
  194. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml +0 -121
  195. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/IniSetStandard.xml +0 -40
  196. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/StrictInArrayStandard.xml +0 -53
  197. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/YodaConditionsStandard.xml +0 -27
  198. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Security/SafeRedirectStandard.xml +0 -23
  199. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CapabilitiesStandard.xml +0 -69
  200. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CapitalPDangitStandard.xml +0 -43
  201. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/ClassNameCaseStandard.xml +0 -23
  202. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CronIntervalStandard.xml +0 -45
  203. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedClassesStandard.xml +0 -23
  204. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedFunctionsStandard.xml +0 -23
  205. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedParameterValuesStandard.xml +0 -23
  206. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedParametersStandard.xml +0 -40
  207. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/EnqueuedResourceParametersStandard.xml +0 -92
  208. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/EnqueuedResourcesStandard.xml +0 -57
  209. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/PostsPerPageStandard.xml +0 -73
  210. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/CastStructureSpacingStandard.xml +0 -27
  211. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/ControlStructureSpacingStandard.xml +0 -150
  212. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/ObjectOperatorSpacingStandard.xml +0 -19
  213. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +0 -61
  214. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ArrayWalkingFunctionsHelper.php +0 -108
  215. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ConstantsHelper.php +0 -135
  216. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ContextHelper.php +0 -394
  217. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/DeprecationHelper.php +0 -84
  218. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/EscapingFunctionsTrait.php +0 -256
  219. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/FormattingFunctionsHelper.php +0 -60
  220. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/IsUnitTestTrait.php +0 -238
  221. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ListHelper.php +0 -101
  222. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/MinimumWPVersionTrait.php +0 -159
  223. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/PrintingFunctionsTrait.php +0 -122
  224. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/RulesetPropertyHelper.php +0 -73
  225. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/SanitizationHelperTrait.php +0 -418
  226. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/SnakeCaseHelper.php +0 -60
  227. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/UnslashingFunctionsHelper.php +0 -59
  228. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ValidationHelper.php +0 -349
  229. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/VariableHelper.php +0 -262
  230. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPDBTrait.php +0 -115
  231. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPGlobalVariablesHelper.php +0 -312
  232. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPHookHelper.php +0 -113
  233. package/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php +0 -72
  234. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayDeclarationSpacingSniff.php +0 -252
  235. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayIndentationSniff.php +0 -550
  236. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayKeySpacingRestrictionsSniff.php +0 -174
  237. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/MultipleStatementAlignmentSniff.php +0 -583
  238. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/CodeAnalysis/AssignmentInTernaryConditionSniff.php +0 -173
  239. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/CodeAnalysis/EscapedNotTranslatedSniff.php +0 -89
  240. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/DirectDatabaseQuerySniff.php +0 -301
  241. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php +0 -761
  242. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/PreparedSQLSniff.php +0 -242
  243. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/RestrictedClassesSniff.php +0 -57
  244. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/RestrictedFunctionsSniff.php +0 -63
  245. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/SlowDBQuerySniff.php +0 -58
  246. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DateTime/CurrentTimeTimestampSniff.php +0 -168
  247. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DateTime/RestrictedFunctionsSniff.php +0 -59
  248. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Files/FileNameSniff.php +0 -313
  249. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +0 -1297
  250. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidFunctionNameSniff.php +0 -188
  251. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidHookNameSniff.php +0 -277
  252. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidPostTypeSlugSniff.php +0 -230
  253. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php +0 -289
  254. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DevelopmentFunctionsSniff.php +0 -63
  255. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DiscouragedPHPFunctionsSniff.php +0 -100
  256. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DontExtractSniff.php +0 -52
  257. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/IniSetSniff.php +0 -193
  258. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/NoSilencedErrorsSniff.php +0 -245
  259. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/POSIXFunctionsSniff.php +0 -73
  260. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/PregQuoteDelimiterSniff.php +0 -70
  261. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/RestrictedPHPFunctionsSniff.php +0 -45
  262. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/StrictInArraySniff.php +0 -122
  263. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/TypeCastsSniff.php +0 -90
  264. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/YodaConditionsSniff.php +0 -124
  265. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/EscapeOutputSniff.php +0 -903
  266. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/NonceVerificationSniff.php +0 -422
  267. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/PluginMenuSlugSniff.php +0 -126
  268. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/SafeRedirectSniff.php +0 -45
  269. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php +0 -244
  270. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php +0 -862
  271. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/AlternativeFunctionsSniff.php +0 -371
  272. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CapabilitiesSniff.php +0 -478
  273. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CapitalPDangitSniff.php +0 -315
  274. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/ClassNameCaseSniff.php +0 -897
  275. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CronIntervalSniff.php +0 -321
  276. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedClassesSniff.php +0 -152
  277. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedFunctionsSniff.php +0 -1708
  278. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedParameterValuesSniff.php +0 -291
  279. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedParametersSniff.php +0 -509
  280. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DiscouragedConstantsSniff.php +0 -160
  281. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DiscouragedFunctionsSniff.php +0 -54
  282. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/EnqueuedResourceParametersSniff.php +0 -241
  283. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/EnqueuedResourcesSniff.php +0 -108
  284. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/GlobalVariablesOverrideSniff.php +0 -436
  285. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php +0 -977
  286. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/PostsPerPageSniff.php +0 -102
  287. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/CastStructureSpacingSniff.php +0 -59
  288. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php +0 -486
  289. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php +0 -63
  290. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/OperatorSpacingSniff.php +0 -60
  291. package/vendor/wp-coding-standards/wpcs/WordPress/ruleset.xml +0 -13
  292. package/vendor/wp-coding-standards/wpcs/WordPress-Core/ruleset.xml +0 -948
  293. package/vendor/wp-coding-standards/wpcs/WordPress-Docs/ruleset.xml +0 -109
  294. package/vendor/wp-coding-standards/wpcs/WordPress-Extra/ruleset.xml +0 -199
  295. package/vendor/wp-coding-standards/wpcs/composer.json +0 -88
  296. package/vendor/wp-coding-standards/wpcs/phpcs.xml.dist.sample +0 -153
@@ -1,637 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * This file is part of the Dealerdirect PHP_CodeSniffer Standards
5
- * Composer Installer Plugin package.
6
- *
7
- * @copyright 2016-2022 Dealerdirect B.V.
8
- * @license MIT
9
- */
10
-
11
- namespace PHPCSStandards\Composer\Plugin\Installers\PHPCodeSniffer;
12
-
13
- use Composer\Composer;
14
- use Composer\EventDispatcher\EventSubscriberInterface;
15
- use Composer\IO\IOInterface;
16
- use Composer\Package\AliasPackage;
17
- use Composer\Package\PackageInterface;
18
- use Composer\Package\RootPackageInterface;
19
- use Composer\Plugin\PluginInterface;
20
- use Composer\Script\Event;
21
- use Composer\Script\ScriptEvents;
22
- use Composer\Util\Filesystem;
23
- use Composer\Util\ProcessExecutor;
24
- use Symfony\Component\Finder\Finder;
25
- use Symfony\Component\Process\Exception\LogicException;
26
- use Symfony\Component\Process\Exception\ProcessFailedException;
27
- use Symfony\Component\Process\Exception\RuntimeException;
28
- use Symfony\Component\Process\PhpExecutableFinder;
29
-
30
- /**
31
- * PHP_CodeSniffer standard installation manager.
32
- *
33
- * @author Franck Nijhof <franck.nijhof@dealerdirect.com>
34
- */
35
- class Plugin implements PluginInterface, EventSubscriberInterface
36
- {
37
- const KEY_MAX_DEPTH = 'phpcodesniffer-search-depth';
38
-
39
- const MESSAGE_ERROR_WRONG_MAX_DEPTH =
40
- 'The value of "%s" (in the composer.json "extra".section) must be an integer larger than %d, %s given.';
41
-
42
- const MESSAGE_NOT_INSTALLED = 'PHPCodeSniffer is not installed';
43
- const MESSAGE_NOTHING_TO_INSTALL = 'No PHPCS standards to install or update';
44
- const MESSAGE_PLUGIN_UNINSTALLED = 'PHPCodeSniffer Composer Installer is uninstalled';
45
- const MESSAGE_RUNNING_INSTALLER = 'Running PHPCodeSniffer Composer Installer';
46
-
47
- const PACKAGE_NAME = 'squizlabs/php_codesniffer';
48
- const PACKAGE_TYPE = 'phpcodesniffer-standard';
49
-
50
- const PHPCS_CONFIG_REGEX = '`%s:[^\r\n]+`';
51
- const PHPCS_CONFIG_KEY = 'installed_paths';
52
-
53
- const PLUGIN_NAME = 'dealerdirect/phpcodesniffer-composer-installer';
54
-
55
- /**
56
- * @var Composer
57
- */
58
- private $composer;
59
-
60
- /**
61
- * @var string
62
- */
63
- private $cwd;
64
-
65
- /**
66
- * @var Filesystem
67
- */
68
- private $filesystem;
69
-
70
- /**
71
- * @var array
72
- */
73
- private $installedPaths;
74
-
75
- /**
76
- * @var IOInterface
77
- */
78
- private $io;
79
-
80
- /**
81
- * @var ProcessExecutor
82
- */
83
- private $processExecutor;
84
-
85
- /**
86
- * Triggers the plugin's main functionality.
87
- *
88
- * Makes it possible to run the plugin as a custom command.
89
- *
90
- * @param Event $event
91
- *
92
- * @throws \InvalidArgumentException
93
- * @throws \RuntimeException
94
- * @throws LogicException
95
- * @throws ProcessFailedException
96
- * @throws RuntimeException
97
- */
98
- public static function run(Event $event)
99
- {
100
- $io = $event->getIO();
101
- $composer = $event->getComposer();
102
-
103
- $instance = new static();
104
-
105
- $instance->io = $io;
106
- $instance->composer = $composer;
107
- $instance->init();
108
- $instance->onDependenciesChangedEvent();
109
- }
110
-
111
- /**
112
- * {@inheritDoc}
113
- *
114
- * @throws \RuntimeException
115
- * @throws LogicException
116
- * @throws ProcessFailedException
117
- * @throws RuntimeException
118
- */
119
- public function activate(Composer $composer, IOInterface $io)
120
- {
121
- $this->composer = $composer;
122
- $this->io = $io;
123
-
124
- $this->init();
125
- }
126
-
127
- /**
128
- * {@inheritDoc}
129
- */
130
- public function deactivate(Composer $composer, IOInterface $io)
131
- {
132
- }
133
-
134
- /**
135
- * {@inheritDoc}
136
- */
137
- public function uninstall(Composer $composer, IOInterface $io)
138
- {
139
- }
140
-
141
- /**
142
- * Prepares the plugin so it's main functionality can be run.
143
- *
144
- * @throws \RuntimeException
145
- * @throws LogicException
146
- * @throws ProcessFailedException
147
- * @throws RuntimeException
148
- */
149
- private function init()
150
- {
151
- $this->cwd = getcwd();
152
- $this->installedPaths = array();
153
-
154
- $this->processExecutor = new ProcessExecutor($this->io);
155
- $this->filesystem = new Filesystem($this->processExecutor);
156
- }
157
-
158
- /**
159
- * {@inheritDoc}
160
- */
161
- public static function getSubscribedEvents()
162
- {
163
- return array(
164
- ScriptEvents::POST_INSTALL_CMD => array(
165
- array('onDependenciesChangedEvent', 0),
166
- ),
167
- ScriptEvents::POST_UPDATE_CMD => array(
168
- array('onDependenciesChangedEvent', 0),
169
- ),
170
- );
171
- }
172
-
173
- /**
174
- * Entry point for post install and post update events.
175
- *
176
- * @throws \InvalidArgumentException
177
- * @throws LogicException
178
- * @throws ProcessFailedException
179
- * @throws RuntimeException
180
- */
181
- public function onDependenciesChangedEvent()
182
- {
183
- $io = $this->io;
184
- $isVerbose = $io->isVerbose();
185
- $exitCode = 0;
186
-
187
- if ($isVerbose) {
188
- $io->write(sprintf('<info>%s</info>', self::MESSAGE_RUNNING_INSTALLER));
189
- }
190
-
191
- if ($this->isPHPCodeSnifferInstalled() === true) {
192
- $this->loadInstalledPaths();
193
- $installPathCleaned = $this->cleanInstalledPaths();
194
- $installPathUpdated = $this->updateInstalledPaths();
195
-
196
- if ($installPathCleaned === true || $installPathUpdated === true) {
197
- $exitCode = $this->saveInstalledPaths();
198
- } elseif ($isVerbose) {
199
- $io->write(sprintf('<info>%s</info>', self::MESSAGE_NOTHING_TO_INSTALL));
200
- }
201
- } else {
202
- $pluginPackage = $this
203
- ->composer
204
- ->getRepositoryManager()
205
- ->getLocalRepository()
206
- ->findPackages(self::PLUGIN_NAME)
207
- ;
208
-
209
- $isPluginUninstalled = count($pluginPackage) === 0;
210
-
211
- if ($isPluginUninstalled) {
212
- if ($isVerbose) {
213
- $io->write(sprintf('<info>%s</info>', self::MESSAGE_PLUGIN_UNINSTALLED));
214
- }
215
- } else {
216
- $exitCode = 1;
217
- if ($isVerbose) {
218
- $io->write(sprintf('<error>%s</error>', self::MESSAGE_NOT_INSTALLED));
219
- }
220
- }
221
- }
222
-
223
- return $exitCode;
224
- }
225
-
226
- /**
227
- * Load all paths from PHP_CodeSniffer into an array.
228
- *
229
- * @throws LogicException
230
- * @throws ProcessFailedException
231
- * @throws RuntimeException
232
- */
233
- private function loadInstalledPaths()
234
- {
235
- if ($this->isPHPCodeSnifferInstalled() === true) {
236
- $this->processExecutor->execute(
237
- $this->getPhpcsCommand() . ' --config-show',
238
- $output,
239
- $this->getPHPCodeSnifferInstallPath()
240
- );
241
-
242
- $regex = sprintf(self::PHPCS_CONFIG_REGEX, self::PHPCS_CONFIG_KEY);
243
- if (preg_match($regex, $output, $match) === 1) {
244
- $phpcsInstalledPaths = str_replace(self::PHPCS_CONFIG_KEY . ': ', '', $match[0]);
245
- $phpcsInstalledPaths = trim($phpcsInstalledPaths);
246
-
247
- if ($phpcsInstalledPaths !== '') {
248
- $this->installedPaths = explode(',', $phpcsInstalledPaths);
249
- }
250
- }
251
- }
252
- }
253
-
254
- /**
255
- * Save all coding standard paths back into PHP_CodeSniffer
256
- *
257
- * @throws LogicException
258
- * @throws ProcessFailedException
259
- * @throws RuntimeException
260
- *
261
- * @return int Exit code. 0 for success, 1 or higher for failure.
262
- */
263
- private function saveInstalledPaths()
264
- {
265
- // Check if we found installed paths to set.
266
- if (count($this->installedPaths) !== 0) {
267
- sort($this->installedPaths);
268
- $paths = implode(',', $this->installedPaths);
269
- $arguments = array('--config-set', self::PHPCS_CONFIG_KEY, $paths);
270
- $configMessage = sprintf(
271
- 'PHP CodeSniffer Config <info>%s</info> <comment>set to</comment> <info>%s</info>',
272
- self::PHPCS_CONFIG_KEY,
273
- $paths
274
- );
275
- } else {
276
- // Delete the installed paths if none were found.
277
- $arguments = array('--config-delete', self::PHPCS_CONFIG_KEY);
278
- $configMessage = sprintf(
279
- 'PHP CodeSniffer Config <info>%s</info> <comment>delete</comment>',
280
- self::PHPCS_CONFIG_KEY
281
- );
282
- }
283
-
284
- // Prepare message in case of failure
285
- $failMessage = sprintf(
286
- 'Failed to set PHP CodeSniffer <info>%s</info> Config',
287
- self::PHPCS_CONFIG_KEY
288
- );
289
-
290
- // Okay, lets rock!
291
- $command = vsprintf(
292
- '%s %s',
293
- array(
294
- 'phpcs command' => $this->getPhpcsCommand(),
295
- 'arguments' => implode(' ', $arguments),
296
- )
297
- );
298
-
299
- $exitCode = $this->processExecutor->execute($command, $configResult, $this->getPHPCodeSnifferInstallPath());
300
- if ($exitCode === 0) {
301
- $exitCode = $this->verifySaveSuccess();
302
- }
303
-
304
- if ($exitCode === 0) {
305
- $this->io->write($configMessage);
306
- } else {
307
- $this->io->write($failMessage);
308
- }
309
-
310
- if ($this->io->isVerbose() && !empty($configResult)) {
311
- $this->io->write(sprintf('<info>%s</info>', $configResult));
312
- }
313
-
314
- return $exitCode;
315
- }
316
-
317
- /**
318
- * Verify that the paths which were expected to be saved, have been.
319
- *
320
- * @return int Exit code. 0 for success, 1 for failure.
321
- */
322
- private function verifySaveSuccess()
323
- {
324
- $exitCode = 1;
325
- $expectedPaths = $this->installedPaths;
326
-
327
- // Request the currently set installed paths after the save.
328
- $this->loadInstalledPaths();
329
-
330
- $registeredPaths = array_intersect($this->installedPaths, $expectedPaths);
331
- $registeredCount = count($registeredPaths);
332
- $expectedCount = count($expectedPaths);
333
-
334
- if ($expectedCount === $registeredCount) {
335
- $exitCode = 0;
336
- }
337
-
338
- if ($exitCode === 1 && $this->io->isVerbose()) {
339
- $verificationMessage = sprintf(
340
- "Paths to external standards found by the plugin: <info>%s</info>\n"
341
- . 'Actual paths registered with PHPCS: <info>%s</info>',
342
- implode(', ', $expectedPaths),
343
- implode(', ', $this->installedPaths)
344
- );
345
- $this->io->write($verificationMessage);
346
- }
347
-
348
- return $exitCode;
349
- }
350
-
351
- /**
352
- * Get the command to call PHPCS.
353
- */
354
- protected function getPhpcsCommand()
355
- {
356
- // Determine the path to the main PHPCS file.
357
- $phpcsPath = $this->getPHPCodeSnifferInstallPath();
358
- if (file_exists($phpcsPath . '/bin/phpcs') === true) {
359
- // PHPCS 3.x.
360
- $phpcsExecutable = './bin/phpcs';
361
- } else {
362
- // PHPCS 2.x.
363
- $phpcsExecutable = './scripts/phpcs';
364
- }
365
-
366
- return vsprintf(
367
- '%s %s',
368
- array(
369
- 'php executable' => $this->getPhpExecCommand(),
370
- 'phpcs executable' => $phpcsExecutable,
371
- )
372
- );
373
- }
374
-
375
- /**
376
- * Get the path to the current PHP version being used.
377
- *
378
- * Duplicate of the same in the EventDispatcher class in Composer itself.
379
- */
380
- protected function getPhpExecCommand()
381
- {
382
- $finder = new PhpExecutableFinder();
383
-
384
- $phpPath = $finder->find(false);
385
-
386
- if ($phpPath === false) {
387
- throw new \RuntimeException('Failed to locate PHP binary to execute ' . $phpPath);
388
- }
389
-
390
- $phpArgs = $finder->findArguments();
391
- $phpArgs = $phpArgs
392
- ? ' ' . implode(' ', $phpArgs)
393
- : ''
394
- ;
395
-
396
- $command = ProcessExecutor::escape($phpPath) .
397
- $phpArgs .
398
- ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen')) .
399
- ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions')) .
400
- ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'))
401
- ;
402
-
403
- return $command;
404
- }
405
-
406
- /**
407
- * Iterate trough all known paths and check if they are still valid.
408
- *
409
- * If path does not exists, is not an directory or isn't readable, the path
410
- * is removed from the list.
411
- *
412
- * @return bool True if changes where made, false otherwise
413
- */
414
- private function cleanInstalledPaths()
415
- {
416
- $changes = false;
417
- foreach ($this->installedPaths as $key => $path) {
418
- // This might be a relative path as well
419
- $alternativePath = realpath($this->getPHPCodeSnifferInstallPath() . \DIRECTORY_SEPARATOR . $path);
420
-
421
- if (
422
- (is_dir($path) === false || is_readable($path) === false) &&
423
- (
424
- $alternativePath === false ||
425
- is_dir($alternativePath) === false ||
426
- is_readable($alternativePath) === false
427
- )
428
- ) {
429
- unset($this->installedPaths[$key]);
430
- $changes = true;
431
- }
432
- }
433
- return $changes;
434
- }
435
-
436
- /**
437
- * Check all installed packages (including the root package) against
438
- * the installed paths from PHP_CodeSniffer and add the missing ones.
439
- *
440
- * @return bool True if changes where made, false otherwise
441
- *
442
- * @throws \InvalidArgumentException
443
- * @throws \RuntimeException
444
- */
445
- private function updateInstalledPaths()
446
- {
447
- $changes = false;
448
- $searchPaths = array();
449
-
450
- // Add root package only if it has the expected package type.
451
- if (
452
- $this->composer->getPackage() instanceof RootPackageInterface
453
- && $this->composer->getPackage()->getType() === self::PACKAGE_TYPE
454
- ) {
455
- $searchPaths[] = $this->cwd;
456
- }
457
-
458
- $codingStandardPackages = $this->getPHPCodingStandardPackages();
459
- foreach ($codingStandardPackages as $package) {
460
- $installPath = $this->composer->getInstallationManager()->getInstallPath($package);
461
- if ($this->filesystem->isAbsolutePath($installPath) === false) {
462
- $installPath = $this->filesystem->normalizePath(
463
- $this->cwd . \DIRECTORY_SEPARATOR . $installPath
464
- );
465
- }
466
- $searchPaths[] = $installPath;
467
- }
468
-
469
- // Nothing to do.
470
- if ($searchPaths === array()) {
471
- return false;
472
- }
473
-
474
- $finder = new Finder();
475
- $finder->files()
476
- ->depth('<= ' . $this->getMaxDepth())
477
- ->depth('>= ' . $this->getMinDepth())
478
- ->ignoreUnreadableDirs()
479
- ->ignoreVCS(true)
480
- ->in($searchPaths)
481
- ->name('ruleset.xml');
482
-
483
- // Process each found possible ruleset.
484
- foreach ($finder as $ruleset) {
485
- $standardsPath = $ruleset->getPath();
486
-
487
- // Pick the directory above the directory containing the standard, unless this is the project root.
488
- if ($standardsPath !== $this->cwd) {
489
- $standardsPath = dirname($standardsPath);
490
- }
491
-
492
- // Use relative paths for local project repositories.
493
- if ($this->isRunningGlobally() === false) {
494
- $standardsPath = $this->filesystem->findShortestPath(
495
- $this->getPHPCodeSnifferInstallPath(),
496
- $standardsPath,
497
- true
498
- );
499
- }
500
-
501
- // De-duplicate and add when directory is not configured.
502
- if (in_array($standardsPath, $this->installedPaths, true) === false) {
503
- $this->installedPaths[] = $standardsPath;
504
- $changes = true;
505
- }
506
- }
507
-
508
- return $changes;
509
- }
510
-
511
- /**
512
- * Iterates through Composers' local repository looking for valid Coding
513
- * Standard packages.
514
- *
515
- * @return array Composer packages containing coding standard(s)
516
- */
517
- private function getPHPCodingStandardPackages()
518
- {
519
- $codingStandardPackages = array_filter(
520
- $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(),
521
- function (PackageInterface $package) {
522
- if ($package instanceof AliasPackage) {
523
- return false;
524
- }
525
- return $package->getType() === Plugin::PACKAGE_TYPE;
526
- }
527
- );
528
-
529
- return $codingStandardPackages;
530
- }
531
-
532
- /**
533
- * Searches for the installed PHP_CodeSniffer Composer package
534
- *
535
- * @param null|string|\Composer\Semver\Constraint\ConstraintInterface $versionConstraint to match against
536
- *
537
- * @return PackageInterface|null
538
- */
539
- private function getPHPCodeSnifferPackage($versionConstraint = null)
540
- {
541
- $packages = $this
542
- ->composer
543
- ->getRepositoryManager()
544
- ->getLocalRepository()
545
- ->findPackages(self::PACKAGE_NAME, $versionConstraint);
546
-
547
- return array_shift($packages);
548
- }
549
-
550
- /**
551
- * Returns the path to the PHP_CodeSniffer package installation location
552
- *
553
- * @return string
554
- */
555
- private function getPHPCodeSnifferInstallPath()
556
- {
557
- return $this->composer->getInstallationManager()->getInstallPath($this->getPHPCodeSnifferPackage());
558
- }
559
-
560
- /**
561
- * Simple check if PHP_CodeSniffer is installed.
562
- *
563
- * @param null|string|\Composer\Semver\Constraint\ConstraintInterface $versionConstraint to match against
564
- *
565
- * @return bool Whether PHP_CodeSniffer is installed
566
- */
567
- private function isPHPCodeSnifferInstalled($versionConstraint = null)
568
- {
569
- return ($this->getPHPCodeSnifferPackage($versionConstraint) !== null);
570
- }
571
-
572
- /**
573
- * Test if composer is running "global"
574
- * This check kinda dirty, but it is the "Composer Way"
575
- *
576
- * @return bool Whether Composer is running "globally"
577
- *
578
- * @throws \RuntimeException
579
- */
580
- private function isRunningGlobally()
581
- {
582
- return ($this->composer->getConfig()->get('home') === $this->cwd);
583
- }
584
-
585
- /**
586
- * Determines the maximum search depth when searching for Coding Standards.
587
- *
588
- * @return int
589
- *
590
- * @throws \InvalidArgumentException
591
- */
592
- private function getMaxDepth()
593
- {
594
- $maxDepth = 3;
595
-
596
- $extra = $this->composer->getPackage()->getExtra();
597
-
598
- if (array_key_exists(self::KEY_MAX_DEPTH, $extra)) {
599
- $maxDepth = $extra[self::KEY_MAX_DEPTH];
600
- $minDepth = $this->getMinDepth();
601
-
602
- if (
603
- (string) (int) $maxDepth !== (string) $maxDepth /* Must be an integer or cleanly castable to one */
604
- || $maxDepth <= $minDepth /* Larger than the minimum */
605
- || is_float($maxDepth) === true /* Within the boundaries of integer */
606
- ) {
607
- $message = vsprintf(
608
- self::MESSAGE_ERROR_WRONG_MAX_DEPTH,
609
- array(
610
- 'key' => self::KEY_MAX_DEPTH,
611
- 'min' => $minDepth,
612
- 'given' => var_export($maxDepth, true),
613
- )
614
- );
615
-
616
- throw new \InvalidArgumentException($message);
617
- }
618
- }
619
-
620
- return (int) $maxDepth;
621
- }
622
-
623
- /**
624
- * Returns the minimal search depth for Coding Standard packages.
625
- *
626
- * Usually this is 0, unless PHP_CodeSniffer >= 3 is used.
627
- *
628
- * @return int
629
- */
630
- private function getMinDepth()
631
- {
632
- if ($this->isPHPCodeSnifferInstalled('>= 3.0.0') !== true) {
633
- return 1;
634
- }
635
- return 0;
636
- }
637
- }