Version Description
Download this release
Release Info
Developer | automattic |
Plugin | Instant Articles for WP |
Version | 5.0.0 |
Comparing to | |
See all releases |
Code changes from version 4.2.1 to 5.0.0
- CHANGELOG.md +274 -219
- LABELS.md +0 -19
- README.md +8 -45
- assets/banner-1544x500.jpg +0 -0
- assets/banner-772x250.jpg +0 -0
- assets/check@2x.png +0 -0
- assets/connect@2x.png +0 -0
- assets/customize@2x.png +0 -0
- assets/icon-128x128.jpg +0 -0
- assets/icon-256x256.jpg +0 -0
- assets/key@2x.png +0 -0
- class-instant-articles-post.php +24 -23
- class-instant-articles-publisher.php +0 -145
- embeds.php +6 -0
- facebook-instant-articles.php +489 -486
- js/instant-articles-wizard.js +0 -135
- meta-box/meta-box-template.php +1 -1
- readme.txt +331 -309
- release.sh +0 -494
- settings/class-instant-articles-option-ads.php +0 -245
- settings/class-instant-articles-option-analytics.php +0 -144
- settings/class-instant-articles-option-fb-app.php +0 -58
- settings/class-instant-articles-option-fb-page.php +0 -71
- settings/class-instant-articles-option-publishing.php +0 -114
- settings/class-instant-articles-option-styles.php +0 -45
- settings/class-instant-articles-option.php +0 -457
- settings/class-instant-articles-settings-fb-page.php +0 -181
- settings/class-instant-articles-settings-wizard.php +0 -50
- settings/class-instant-articles-settings.php +0 -146
- settings/template-settings-advanced.php +0 -25
- settings/template-settings-info.php +0 -58
- settings/template-settings-wizard.php +0 -174
- settings/template-settings.php +0 -33
- vendor/apache/log4php +0 -1
- vendor/autoload.php +1 -1
- vendor/bin/phpcbf +0 -19
- vendor/bin/phpcs +0 -19
- vendor/composer/ClassLoader.php +40 -4
- vendor/composer/InstalledVersions.php +337 -0
- vendor/composer/autoload_classmap.php +269 -0
- vendor/composer/autoload_real.php +15 -19
- vendor/composer/autoload_static.php +276 -3
- vendor/composer/installed.json +362 -380
- vendor/composer/installed.php +68 -0
- vendor/composer/platform_check.php +26 -0
- vendor/doctrine/instantiator/.doctrine-project.json +47 -0
- vendor/doctrine/instantiator/.gitignore +0 -5
- vendor/doctrine/instantiator/.scrutinizer.yml +0 -46
- vendor/doctrine/instantiator/.travis.install.sh +0 -14
- vendor/doctrine/instantiator/.travis.yml +0 -22
- vendor/doctrine/instantiator/CONTRIBUTING.md +1 -1
- vendor/doctrine/instantiator/README.md +2 -4
- vendor/doctrine/instantiator/composer.json +12 -9
- vendor/doctrine/instantiator/docs/en/index.rst +68 -0
- vendor/doctrine/instantiator/docs/en/sidebar.rst +4 -0
- vendor/doctrine/instantiator/phpmd.xml.dist +0 -27
- vendor/doctrine/instantiator/phpunit.xml.dist +0 -22
- vendor/doctrine/instantiator/psalm.xml +16 -0
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php +3 -20
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php +20 -32
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php +15 -35
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php +100 -113
- vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php +7 -20
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorPerformance/InstantiatorPerformanceEvent.php +0 -96
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/Exception/InvalidArgumentExceptionTest.php +0 -83
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/Exception/UnexpectedValueExceptionTest.php +0 -69
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php +0 -219
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/AbstractClassAsset.php +0 -29
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ArrayObjectAsset.php +0 -41
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php +0 -41
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php +0 -41
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharAsset.php +0 -41
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharExceptionAsset.php +0 -44
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SerializableArrayObjectAsset.php +0 -62
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleSerializableAsset.php +0 -61
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleTraitAsset.php +0 -29
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnCloneableAsset.php +0 -50
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnserializeExceptionArrayObjectAsset.php +0 -39
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/WakeUpNoticesAsset.php +0 -38
- vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/XMLReaderAsset.php +0 -41
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/composer.json +12 -4
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/composer.lock +618 -147
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/examples/quiet_logger.php +0 -18
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPHeader.php +1 -1
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/configuration/global.amp.css +2 -1
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/Observer.php +2 -1
- vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/default.amp-custom.css +1 -0
- vendor/facebook/facebook-instant-articles-sdk-php/.circleci/config.yml +18 -0
- vendor/facebook/facebook-instant-articles-sdk-php/.travis.yml +0 -30
- vendor/facebook/facebook-instant-articles-sdk-php/README.md +6 -1
- vendor/facebook/facebook-instant-articles-sdk-php/composer.json +13 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Author.php +4 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Container.php +0 -39
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php +9 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/FragmentGetter.php +0 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/JSONGetter.php +0 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php +0 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingElementGetter.php +0 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Compat/JetpackSlideshowRule.php +0 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveInsideParagraphRule.php +0 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php +8 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php +8 -13
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/NoRootInstantArticleFoundWarning.php +2 -14
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/UnrecognizedElement.php +2 -17
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/ValidatorWarning.php +2 -15
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/Warning.php +80 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/ClientExceptionTest.php +7 -1
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/SimpleTransformerTest.php +6 -1
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Warnings/WarningTest.php +67 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example-multibyte.html +0 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example-nonutf8.html +0 -0
- vendor/facebook/graph-sdk/LICENSE +0 -0
- vendor/facebook/graph-sdk/composer.json +3 -2
- vendor/facebook/{facebook-instant-articles-sdk-php → graph-sdk}/composer.lock +737 -226
- vendor/facebook/graph-sdk/phpcs.xml.dist +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Authentication/AccessToken.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Authentication/AccessTokenMetadata.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Authentication/OAuth2Client.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthenticationException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthorizationException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookClientException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookOtherException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResponseException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookSDKException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookServerException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookThrottleException.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Facebook.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FacebookApp.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FacebookBatchRequest.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FacebookBatchResponse.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FacebookClient.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FacebookRequest.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FacebookResponse.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookFile.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookVideo.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/FileUpload/Mimetypes.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/Birthday.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/Collection.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphApplication.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEdge.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEvent.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphGroup.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphList.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphLocation.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNode.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObject.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPage.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPicture.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphUser.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookJavaScriptHelper.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookPageTabHelper.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Http/GraphRawResponse.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyInterface.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyMultipart.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyUrlEncoded.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurl.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookHttpClientInterface.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStream.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataFactory.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataInterface.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php +1 -1
- vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/SignedRequest.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Url/FacebookUrlDetectionHandler.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/Url/UrlDetectionInterface.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/autoload.php +0 -0
- vendor/facebook/graph-sdk/src/Facebook/polyfills.php +0 -0
- vendor/squizlabs/php_codesniffer/.gitattributes +0 -5
- vendor/squizlabs/php_codesniffer/.gitignore +0 -6
- vendor/squizlabs/php_codesniffer/CONTRIBUTING.md +0 -13
- vendor/squizlabs/php_codesniffer/CodeSniffer.conf.dist +0 -9
- vendor/squizlabs/php_codesniffer/CodeSniffer.php +0 -2578
- vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php +0 -1444
- vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators/Generator.php +0 -184
- vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators/HTML.php +0 -292
- vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators/Markdown.php +0 -179
- vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators/Text.php +0 -265
- vendor/squizlabs/php_codesniffer/CodeSniffer/Exception.php +0 -31
- vendor/squizlabs/php_codesniffer/CodeSniffer/File.php +0 -3814
- vendor/squizlabs/php_codesniffer/CodeSniffer/Fixer.php +0 -741
- vendor/squizlabs/php_codesniffer/CodeSniffer/Report.php +0 -83
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reporting.php +0 -425
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Cbf.php +0 -151
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Checkstyle.php +0 -128
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Csv.php +0 -111
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Diff.php +0 -149
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Emacs.php +0 -110
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Full.php +0 -237
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Gitblame.php +0 -105
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Hgblame.php +0 -124
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Info.php +0 -162
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Json.php +0 -128
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Junit.php +0 -149
- vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Notifysend.php +0 -177
CHANGELOG.md
CHANGED
@@ -1,219 +1,274 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
- [#
|
13 |
-
|
14 |
-
|
15 |
-
- [#
|
16 |
-
- [#
|
17 |
-
- [#
|
18 |
-
|
19 |
-
|
20 |
-
- [#
|
21 |
-
- [#
|
22 |
-
- [#
|
23 |
-
- [#
|
24 |
-
|
25 |
-
|
26 |
-
- [#
|
27 |
-
- [#
|
28 |
-
- [#
|
29 |
-
|
30 |
-
|
31 |
-
- [#
|
32 |
-
|
33 |
-
|
34 |
-
- [#
|
35 |
-
|
36 |
-
|
37 |
-
- [#
|
38 |
-
- [#
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
- [#
|
45 |
-
- [#
|
46 |
-
|
47 |
-
|
48 |
-
- [#
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
- [#
|
56 |
-
- [#
|
57 |
-
- [#
|
58 |
-
|
59 |
-
|
60 |
-
- [#
|
61 |
-
|
62 |
-
|
63 |
-
- [#
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
- [#
|
71 |
-
|
72 |
-
|
73 |
-
- [#
|
74 |
-
- [#
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
- [#
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
- [#
|
85 |
-
- [#
|
86 |
-
- [#
|
87 |
-
- [#
|
88 |
-
|
89 |
-
|
90 |
-
- [#
|
91 |
-
- [#
|
92 |
-
- [#
|
93 |
-
|
94 |
-
|
95 |
-
- [#
|
96 |
-
- [#
|
97 |
-
- [#
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
- [#
|
104 |
-
|
105 |
-
|
106 |
-
- [#
|
107 |
-
- [#
|
108 |
-
- [#
|
109 |
-
- [#
|
110 |
-
- [#
|
111 |
-
- [#
|
112 |
-
|
113 |
-
|
114 |
-
- [#
|
115 |
-
|
116 |
-
|
117 |
-
- [#
|
118 |
-
- [#
|
119 |
-
- [#
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
- [#
|
126 |
-
- [#
|
127 |
-
- [#
|
128 |
-
- [#
|
129 |
-
- [#
|
130 |
-
- [#
|
131 |
-
- [#
|
132 |
-
- [#
|
133 |
-
- [#
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
- [#
|
138 |
-
- [#
|
139 |
-
- [#
|
140 |
-
- [#
|
141 |
-
- [#
|
142 |
-
- [#
|
143 |
-
|
144 |
-
|
145 |
-
- [#
|
146 |
-
- [#
|
147 |
-
- [#
|
148 |
-
- [#
|
149 |
-
- [#
|
150 |
-
- [#
|
151 |
-
- [#
|
152 |
-
- [#
|
153 |
-
- [#
|
154 |
-
|
155 |
-
|
156 |
-
- [#
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
- [#
|
161 |
-
- [#
|
162 |
-
- [#
|
163 |
-
- [#
|
164 |
-
- [#
|
165 |
-
- [#
|
166 |
-
- [#
|
167 |
-
- [#
|
168 |
-
- [#
|
169 |
-
- [#
|
170 |
-
- [#
|
171 |
-
- [#
|
172 |
-
- [#
|
173 |
-
- [#
|
174 |
-
- [#
|
175 |
-
- [#
|
176 |
-
|
177 |
-
|
178 |
-
- [#
|
179 |
-
- [#
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
- [#
|
185 |
-
- [#
|
186 |
-
- [#
|
187 |
-
- [#
|
188 |
-
|
189 |
-
|
190 |
-
- [#
|
191 |
-
- [#
|
192 |
-
- [#
|
193 |
-
|
194 |
-
|
195 |
-
- [#
|
196 |
-
- [#
|
197 |
-
- [#
|
198 |
-
- [#
|
199 |
-
- [#
|
200 |
-
|
201 |
-
|
202 |
-
- [#
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
- [#
|
207 |
-
|
208 |
-
|
209 |
-
- [#
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
- [#
|
215 |
-
|
216 |
-
|
217 |
-
- [#
|
218 |
-
- [#
|
219 |
-
- [#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Change Log
|
2 |
+
|
3 |
+
All notable changes to this project will be documented in this file.
|
4 |
+
|
5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6 |
+
|
7 |
+
## [5.0.0] - 2022-10-18
|
8 |
+
|
9 |
+
**Minimum PHP requirement is increased from PHP 5.4 to PHP 7.1.**
|
10 |
+
**Minimum WordPress requirement is increased from WP 4.3.0 to WP 4.7.0.**
|
11 |
+
|
12 |
+
- [#683](https://github.com/Automattic/fb-instant-articles/pull/683) Fix wizard option dynamic properties for PHP 8.2.
|
13 |
+
- [#831](https://github.com/Automattic/fb-instant-articles/pull/831) Fix the way filters are applied in get_cover_media().
|
14 |
+
- [#1025](https://github.com/Automattic/fb-instant-articles/pull/1025) Support for installing as Composer Package.
|
15 |
+
- [#1058](https://github.com/Automattic/fb-instant-articles/pull/1058) Allow post content caching to be disabled.
|
16 |
+
- [#1073](https://github.com/Automattic/fb-instant-articles/pull/1073) Update release.sh.
|
17 |
+
- [#1076](https://github.com/Automattic/fb-instant-articles/pull/1076) Reduce plugin's cache burden for remote requests.
|
18 |
+
- [#1082](https://github.com/Automattic/fb-instant-articles/pull/1082) Fix: pass the missing $post param to the get_the_excerpt filter.
|
19 |
+
- [#1092](https://github.com/Automattic/fb-instant-articles/pull/1092) Add support for PHP 8.
|
20 |
+
- [#1095](https://github.com/Automattic/fb-instant-articles/pull/1095) Add GitHub workflow to mark issues and PR as stale.
|
21 |
+
- [#1097](https://github.com/Automattic/fb-instant-articles/pull/1097) Actions: Remove separate PHP 8.2 composer install.
|
22 |
+
- [#1098](https://github.com/Automattic/fb-instant-articles/pull/1098) Improve tests.
|
23 |
+
- [#1099](https://github.com/Automattic/fb-instant-articles/pull/1099) Basic code maintenance improvements.
|
24 |
+
|
25 |
+
## [4.2.1] - 2020-06-10
|
26 |
+
- [#1049](https://github.com/automattic/fb-instant-articles/pull/1049) Add support for new guttenberg layout elements (@diegoquinteiro)
|
27 |
+
- [#1012](https://github.com/automattic/fb-instant-articles/pull/1012) update composer modules (@paulschreiber)
|
28 |
+
- [#1001](https://github.com/automattic/fb-instant-articles/pull/1001) Load functions which rely on `plugins_loaded` action hook in VIP Go environment (@paulschreiber)
|
29 |
+
- [#990](https://github.com/automattic/fb-instant-articles/pull/990) avoid undefined index error in $display_warning_column (@paulschreiber)
|
30 |
+
- [#1002](https://github.com/automattic/fb-instant-articles/pull/1002) add Comscore plugin (@paulschreiber)
|
31 |
+
- [#1007](https://github.com/automattic/fb-instant-articles/pull/1007) Update Facebook SDK versions (@paulschreiber)
|
32 |
+
|
33 |
+
## [4.2.0] - 2018-11-29
|
34 |
+
- [#997](https://github.com/automattic/fb-instant-articles/pull/997) Removed fields from deprecated feature to enable comments/likes/share from media content (@everton-rosario)
|
35 |
+
|
36 |
+
## [4.1.1] - 2018-07-17
|
37 |
+
- [#962](https://github.com/automattic/fb-instant-articles/pull/962) Updating description for the plugin on website (@Blakomen)
|
38 |
+
- [#1](https://github.com/automattic/fb-instant-articles/pull/1) Merging into local (@diegoquinteiro, @everton-rosario, @algmelo)
|
39 |
+
- [#957](https://github.com/automattic/fb-instant-articles/pull/957) Delete current transient with autoload=yes. (@everton-rosario, @algmelo)
|
40 |
+
|
41 |
+
## [4.1.0] - 2018-07-02
|
42 |
+
- [#937](https://github.com/automattic/fb-instant-articles/pull/937) Add token-less re-scrape with request signature (@diegoquinteiro)
|
43 |
+
- [#952](https://github.com/automattic/fb-instant-articles/pull/952) Updating description for the plugin (@Blakomen)
|
44 |
+
- [#910](https://github.com/automattic/fb-instant-articles/pull/910) Add PassThroughRule for Grammarly (@robbiet480)
|
45 |
+
- [#941](https://github.com/automattic/fb-instant-articles/pull/941) Add support for GTM4WP (@robbiet480)
|
46 |
+
- [#898](https://github.com/automattic/fb-instant-articles/pull/898) Added tranformation warning indicator column (@Kluny)
|
47 |
+
- [#904](https://github.com/automattic/fb-instant-articles/pull/904) Enables setup for updating/invalidating articles cache from Facebook scraper (@everton-rosario, @diegoquinteiro)
|
48 |
+
- [#896](https://github.com/automattic/fb-instant-articles/pull/896) feat(playbuzz): support for the next major playbuzz plugin version (@playbuzz)
|
49 |
+
- [#740](https://github.com/automattic/fb-instant-articles/pull/740) (wizard) Update wording about AMP markup gen (@Djiit)
|
50 |
+
- [#870](https://github.com/automattic/fb-instant-articles/pull/870) [bugfix] calling get_article_style to apply the style filter (@vkama)
|
51 |
+
|
52 |
+
## [4.0.6] - 2017-12-04
|
53 |
+
- [#814](https://github.com/automattic/fb-instant-articles/pull/814) Add default rule for Twitter blockquote (@pestevez)
|
54 |
+
- [#806](https://github.com/automattic/fb-instant-articles/pull/806) Clarify requirement of site connection in README (@pestevez)
|
55 |
+
- [#798](https://github.com/automattic/fb-instant-articles/pull/798) remove article rescrape code (@timjacobi)
|
56 |
+
- [#777](https://github.com/automattic/fb-instant-articles/pull/777) update instructions (@timjacobi)
|
57 |
+
- [#778](https://github.com/automattic/fb-instant-articles/pull/778) Add label definitions (@timjacobi)
|
58 |
+
- [#792](https://github.com/automattic/fb-instant-articles/pull/792) Change meta box and readme so user doesn't think IAs are actually submitted to Facebook (@timjacobi)
|
59 |
+
- [#797](https://github.com/automattic/fb-instant-articles/pull/797) Display error message if meta box can't be loaded (@timjacobi)
|
60 |
+
- [#775](https://github.com/automattic/fb-instant-articles/pull/775) Adds caching to instant_articles_embed_oembed_html (@emrikol)
|
61 |
+
|
62 |
+
## [4.0.5] - 2017-08-24
|
63 |
+
- [#750](https://github.com/automattic/fb-instant-articles/pull/750) Fix query limit and escaping on AMP generation (@diegoquinteiro)
|
64 |
+
|
65 |
+
## [4.0.4] - 2017-07-27
|
66 |
+
- [#738](https://github.com/automattic/fb-instant-articles/pull/738) Add changelog to script (@diegoquinteiro)
|
67 |
+
- [#737](https://github.com/automattic/fb-instant-articles/pull/737) Updates IA SDK to 1.6.2 and dependencies (@diegoquinteiro)
|
68 |
+
|
69 |
+
## [4.0.3] - 2017-07-20
|
70 |
+
- [#725](https://github.com/automattic/fb-instant-articles/pull/725) Restore the $current_blog global and fix the post ID reference (@kasparsd)
|
71 |
+
|
72 |
+
## [4.0.2] - 2017-06-30
|
73 |
+
- [#708](https://github.com/automattic/fb-instant-articles/pull/708) Do not process non-post pages. Fixes #707 (@diegoquinteiro)
|
74 |
+
- [#709](https://github.com/automattic/fb-instant-articles/pull/709) Add cache layer for avoiding transforming the article at page render (@diegoquinteiro)
|
75 |
+
|
76 |
+
## [4.0.1] - 2017-06-28
|
77 |
+
- [#706](https://github.com/automattic/fb-instant-articles/pull/706) Check for array index before using it (@diegoquinteiro)
|
78 |
+
- [#705](https://github.com/automattic/fb-instant-articles/pull/705) Enable deletion of JSON AMP Style and removes an undef index (@vkama)
|
79 |
+
- [#704](https://github.com/automattic/fb-instant-articles/pull/704) Fixed several php notices. Also fixed a bug in should_subit_post() (@vkama)
|
80 |
+
|
81 |
+
## [4.0.0] - 2017-06-27
|
82 |
+
- [#702](https://github.com/automattic/fb-instant-articles/pull/702) V4.0 (@vkama, @diegoquinteiro, @everton-rosario, @sakatam, @abdusfauzi)
|
83 |
+
- [#647](https://github.com/automattic/fb-instant-articles/pull/647) Fix "Empty string supplied as input" bug (@abdusfauzi)
|
84 |
+
- [#680](https://github.com/automattic/fb-instant-articles/pull/680) Adding support to IA->AMP conversion (@vkama)
|
85 |
+
- [#649](https://github.com/automattic/fb-instant-articles/pull/649) allow markups in footer/copyright (@sakatam)
|
86 |
+
- [#643](https://github.com/automattic/fb-instant-articles/pull/643) Open Graph Ingestion Flow (@diegoquinteiro, @everton-rosario)
|
87 |
+
- [#629](https://github.com/automattic/fb-instant-articles/pull/629) Update Google Analytics compat (@dlackty)
|
88 |
+
|
89 |
+
## [3.3.4] - 2017-05-10
|
90 |
+
- [#602](https://github.com/automattic/fb-instant-articles/pull/602) Add post ID to `instant_articles_content` filter (@carlalexander)
|
91 |
+
- [#622](https://github.com/automattic/fb-instant-articles/pull/622) Adds ver=<VERSION_TOKEN> to invalidate plugin resource files (@everton-rosario)
|
92 |
+
- [#645](https://github.com/automattic/fb-instant-articles/pull/645) Fix wp_is_post_autosave() parameter value (@abdusfauzi)
|
93 |
+
- [#623](https://github.com/automattic/fb-instant-articles/pull/623) Allow for alternative file path for json rules (@andykillen)
|
94 |
+
- [#624](https://github.com/automattic/fb-instant-articles/pull/624) fix merge damage (@sakatam)
|
95 |
+
- [#616](https://github.com/automattic/fb-instant-articles/pull/616) Extracted anonymous inline function (@everton-rosario)
|
96 |
+
- [#609](https://github.com/automattic/fb-instant-articles/pull/609) Apester plugin support (@oraricha)
|
97 |
+
- [#617](https://github.com/automattic/fb-instant-articles/pull/617) Switch on/off configuration for enabling comments/likes by default (@everton-rosario)
|
98 |
+
- [#612](https://github.com/automattic/fb-instant-articles/pull/612) Add an option to set a footer (@sakatam)
|
99 |
+
|
100 |
+
## [3.3.2] - 2017-02-13
|
101 |
+
- [#418](https://github.com/automattic/fb-instant-articles/pull/418) Call instant_articles_post_published hook to determine published status (@apeschar)
|
102 |
+
- [#611](https://github.com/automattic/fb-instant-articles/pull/611) capability to toggle RTL option (@sakatam)
|
103 |
+
- [#604](https://github.com/automattic/fb-instant-articles/pull/604) Fix typo for $provider_url at L42, L44 and L46 (@abdusfauzi)
|
104 |
+
|
105 |
+
## [3.3.1] - 2017-01-31
|
106 |
+
- [#598](https://github.com/automattic/fb-instant-articles/pull/598) Fix typo on script (@diegoquinteiro)
|
107 |
+
- [#595](https://github.com/automattic/fb-instant-articles/pull/595) Add transformer rule for cite element (@davebonds)
|
108 |
+
- [#59](https://github.com/automattic/fb-instant-articles/pull/59) add vimeo.com into oEmbed $provider_name (@abdusfauzi)
|
109 |
+
- [#597](https://github.com/automattic/fb-instant-articles/pull/597) Don't try to load embeds compat unless we're in Instant Articles context (@diegoquinteiro, @rinatkhaziev)
|
110 |
+
- [#568](https://github.com/automattic/fb-instant-articles/pull/568) Add `is_transforming_instant_article()` conditional (@goldenapples)
|
111 |
+
- [#287](https://github.com/automattic/fb-instant-articles/pull/287) Ad de_DE (@swissky)
|
112 |
+
- [#578](https://github.com/automattic/fb-instant-articles/pull/578) Change save_post priority (@cmjaimet)
|
113 |
+
- [#592](https://github.com/automattic/fb-instant-articles/pull/592) Add missing information to composer.json (@onnimonni)
|
114 |
+
- [#562](https://github.com/automattic/fb-instant-articles/pull/562) Add release script (@diegoquinteiro)
|
115 |
+
|
116 |
+
## [3.3] - 2016-12-16
|
117 |
+
- [#560](https://github.com/automattic/fb-instant-articles/pull/560) Remove deprecated rules and add rules for imgs inside links (@diegoquinteiro)
|
118 |
+
- [#525](https://github.com/automattic/fb-instant-articles/pull/525) Update WordPress.com stats code to use FBIA SDK. (@Automattic)
|
119 |
+
- [#535](https://github.com/automattic/fb-instant-articles/pull/535) Fixes #515 - Enables Playbuzz plugin out of the box (@everton-rosario)
|
120 |
+
|
121 |
+
## [3.2.2] - 2016-11-29
|
122 |
+
- [#543](https://github.com/automattic/fb-instant-articles/pull/543) Fix variable name (@diegoquinteiro)
|
123 |
+
|
124 |
+
## [3.2.1] - 2016-11-25
|
125 |
+
- [#538](https://github.com/automattic/fb-instant-articles/pull/538) Show message on meta-box when post is filtered out (@diegoquinteiro)
|
126 |
+
- [#504](https://github.com/automattic/fb-instant-articles/pull/504) Add instant_articles_should_submit_post filter hook to allow developers control of whether the post should be submitted to IA (@rinatkhaziev)
|
127 |
+
- [#498](https://github.com/automattic/fb-instant-articles/pull/498) Release v3.2 (@Automattic)
|
128 |
+
- [#437](https://github.com/automattic/fb-instant-articles/pull/437) Blocks publishing of articles with transformation warnings (@diegoquinteiro, @everton-rosario)
|
129 |
+
- [#423](https://github.com/automattic/fb-instant-articles/pull/423) Fixes #205 - Caption in <p> tag (@everton-rosario)
|
130 |
+
- [#435](https://github.com/automattic/fb-instant-articles/pull/435) Setup Wizard copy updates (@demoive)
|
131 |
+
- [#497](https://github.com/automattic/fb-instant-articles/pull/497) Getter was renamed on SDK, updating here too (@diegoquinteiro)
|
132 |
+
- [#417](https://github.com/automattic/fb-instant-articles/pull/417) Support for Playbuzz plugin (@everton-rosario)
|
133 |
+
- [#416](https://github.com/automattic/fb-instant-articles/pull/416) Use the instant_articles_post_types filter when registering metaboxes (@technosailor)
|
134 |
+
|
135 |
+
## [3.2] - 2016-10-05
|
136 |
+
- [#484](https://github.com/automattic/fb-instant-articles/pull/484) Apply the second argument to `the_title` (@srtfisher)
|
137 |
+
- [#481](https://github.com/automattic/fb-instant-articles/pull/481) Token Invalidation flow (@everton-rosario)
|
138 |
+
- [#462](https://github.com/automattic/fb-instant-articles/pull/462) Migration from old facebook sdk (@everton-rosario)
|
139 |
+
- [#436](https://github.com/automattic/fb-instant-articles/pull/436) Wp tests migration (@everton-rosario)
|
140 |
+
- [#421](https://github.com/automattic/fb-instant-articles/pull/421) Fixes #408 adding rules for gallery (@everton-rosario)
|
141 |
+
- [#376](https://github.com/automattic/fb-instant-articles/pull/376) Added rule configuration for Instagram embed (@everton-rosario)
|
142 |
+
- [#316](https://github.com/automattic/fb-instant-articles/pull/316) Add development mode support to status meta box (@simonengelhardt)
|
143 |
+
|
144 |
+
## [3.1.3] - 2016-09-19
|
145 |
+
- [#469](https://github.com/automattic/fb-instant-articles/pull/469) Release stuff for v3.1.3 (@Automattic)
|
146 |
+
- [#450](https://github.com/automattic/fb-instant-articles/pull/450) Do not block page selection if URL is not claimed (@diegoquinteiro)
|
147 |
+
- [#464](https://github.com/automattic/fb-instant-articles/pull/464) Fixes #452 - Use of empty() on PHP prior to v5.5 (@demoive)
|
148 |
+
- [#465](https://github.com/automattic/fb-instant-articles/pull/465) Relative CSS to fix missing icons (@everton-rosario)
|
149 |
+
- [#458](https://github.com/automattic/fb-instant-articles/pull/458) Fix expiring token blocking users on page selection state (@diegoquinteiro)
|
150 |
+
- [#403](https://github.com/automattic/fb-instant-articles/pull/403) fix travis.ci build (@sakatam)
|
151 |
+
- [#425](https://github.com/automattic/fb-instant-articles/pull/425) Final release of v3.1 (@Automattic)
|
152 |
+
- [#385](https://github.com/automattic/fb-instant-articles/pull/385) Implemented compat for the get-the-image plugin (@everton-rosario)
|
153 |
+
- [#392](https://github.com/automattic/fb-instant-articles/pull/392) Load functions which rely on `plugins_loaded` action hook in wp.com e… (@nprasath002)
|
154 |
+
- [#402](https://github.com/automattic/fb-instant-articles/pull/402) Properly implemented the get_cover_media function. (@menzow)
|
155 |
+
- [#420](https://github.com/automattic/fb-instant-articles/pull/420) Article with password protection (@everton-rosario)
|
156 |
+
- [#409](https://github.com/automattic/fb-instant-articles/pull/409) Check for undefined index (@gemedet)
|
157 |
+
|
158 |
+
## [3.1] - 2016-08-17
|
159 |
+
- [#413](https://github.com/automattic/fb-instant-articles/pull/413) Fix lingering reference to the old settings page on meta-box (@diegoquinteiro)
|
160 |
+
- [#412](https://github.com/automattic/fb-instant-articles/pull/412) Content update (@diegoquinteiro)
|
161 |
+
- [#400](https://github.com/automattic/fb-instant-articles/pull/400) New flow (@diegoquinteiro, @everton-rosario)
|
162 |
+
- [#399](https://github.com/automattic/fb-instant-articles/pull/399) Revert "Redirect settings" (@philipjohn)
|
163 |
+
- [#394](https://github.com/automattic/fb-instant-articles/pull/394) Apply "the_title" filter (@everton-rosario)
|
164 |
+
- [#389](https://github.com/automattic/fb-instant-articles/pull/389) Redirect settings (@everton-rosario)
|
165 |
+
- [#387](https://github.com/automattic/fb-instant-articles/pull/387) Fix loadHTML warning (@gemedet)
|
166 |
+
- [#378](https://github.com/automattic/fb-instant-articles/pull/378) Added rules for jetpack carousel component (@everton-rosario)
|
167 |
+
- [#379](https://github.com/automattic/fb-instant-articles/pull/379) Don't call wpautop directly when trying to prepare content for transformation. (@rinatkhaziev)
|
168 |
+
- [#383](https://github.com/automattic/fb-instant-articles/pull/383) Fix updating published posts result in error (@chrisadas)
|
169 |
+
- [#375](https://github.com/automattic/fb-instant-articles/pull/375) Commit blocker option - No warnings in transformer to publish (@everton-rosario)
|
170 |
+
- [#374](https://github.com/automattic/fb-instant-articles/pull/374) Jetpack plugin compatibility - Transformation rules (@everton-rosario)
|
171 |
+
- [#371](https://github.com/automattic/fb-instant-articles/pull/371) Migrated take_live parameter to the published (@everton-rosario)
|
172 |
+
- [#366](https://github.com/automattic/fb-instant-articles/pull/366) InteractiveInsideParagraphRule support and configuration (@everton-rosario)
|
173 |
+
- [#367](https://github.com/automattic/fb-instant-articles/pull/367) Add subtitle to $header when rendering post to IA (@jacobarriola)
|
174 |
+
- [#360](https://github.com/automattic/fb-instant-articles/pull/360) Improve rules for Images inside Paragraphs and Interactive elements (@everton-rosario)
|
175 |
+
- [#356](https://github.com/automattic/fb-instant-articles/pull/356) Ensure that relative URL checking has a host and a path. (@srtfisher)
|
176 |
+
|
177 |
+
## [3.0.1] - 2016-07-13
|
178 |
+
- [#359](https://github.com/automattic/fb-instant-articles/pull/359) Release 3.0.1 (@Automattic)
|
179 |
+
- [#358](https://github.com/automattic/fb-instant-articles/pull/358) Revert "escaping and sanitization fixes" (@diegoquinteiro)
|
180 |
+
|
181 |
+
## [3.0] - 2016-07-12
|
182 |
+
- [#355](https://github.com/automattic/fb-instant-articles/pull/355) Release v3.0 (@Automattic)
|
183 |
+
- [#354](https://github.com/automattic/fb-instant-articles/pull/354) Remove to avoid breaking elements. See #331 (@Automattic)
|
184 |
+
- [#353](https://github.com/automattic/fb-instant-articles/pull/353) Store and use submission ID when available to fetch the status (@diegoquinteiro)
|
185 |
+
- [#329](https://github.com/automattic/fb-instant-articles/pull/329) always use HTTPS to load JavaScript SDK; update to 2.6 (@paulschreiber)
|
186 |
+
- [#327](https://github.com/automattic/fb-instant-articles/pull/327) use v2.6 of Facebook API (@paulschreiber)
|
187 |
+
- [#263](https://github.com/automattic/fb-instant-articles/pull/263) Escape ampersands before displaying on settings page (@gemedet)
|
188 |
+
- [#301](https://github.com/automattic/fb-instant-articles/pull/301) Check if the global $post object has been set (@srtfisher)
|
189 |
+
- [#290](https://github.com/automattic/fb-instant-articles/pull/290) Fix relative URL issue with oembeds not using absolute URLs (@stuartshields)
|
190 |
+
- [#255](https://github.com/automattic/fb-instant-articles/pull/255) Support <mark> tag (@demoive)
|
191 |
+
- [#313](https://github.com/automattic/fb-instant-articles/pull/313) Fixed statically-called loadHTML() (@gemedet)
|
192 |
+
- [#258](https://github.com/automattic/fb-instant-articles/pull/258) Width and Height for Interactive in default rules (@gemedet)
|
193 |
+
- [#343](https://github.com/automattic/fb-instant-articles/pull/343) Only publish posts (ignores pages and other post types) (@diegoquinteiro)
|
194 |
+
- [#342](https://github.com/automattic/fb-instant-articles/pull/342) Replace SocialEmbed rules with Interactive rules (@diegoquinteiro)
|
195 |
+
- [#330](https://github.com/automattic/fb-instant-articles/pull/330) fix whitespace in select/optgroup tags (@paulschreiber)
|
196 |
+
- [#331](https://github.com/automattic/fb-instant-articles/pull/331) WordPress coding standards fixes (@paulschreiber)
|
197 |
+
- [#328](https://github.com/automattic/fb-instant-articles/pull/328) Fix whitespace to match WordPress coding standards (@paulschreiber)
|
198 |
+
- [#285](https://github.com/automattic/fb-instant-articles/pull/285) Remove hyperlinks beginning with a # (@markbarnes)
|
199 |
+
- [#341](https://github.com/automattic/fb-instant-articles/pull/341) Avoid crawler to cache a 404 (@diegoquinteiro)
|
200 |
+
- [#305](https://github.com/automattic/fb-instant-articles/pull/305) Allow filtering of the post types used in the feed (@Automattic)
|
201 |
+
- [#308](https://github.com/automattic/fb-instant-articles/pull/308) Fixed error message: Deprecated: Non-static method DOMDocument::loadH… (@everton-rosario)
|
202 |
+
- [#286](https://github.com/automattic/fb-instant-articles/pull/286) Add GitHub Issue and PR templates (@simonengelhardt)
|
203 |
+
- [#177](https://github.com/automattic/fb-instant-articles/pull/177) Use H1 for header title and cover image caption (@gemedet)
|
204 |
+
|
205 |
+
## [2.11] - 2016-05-17
|
206 |
+
- [#257](https://github.com/automattic/fb-instant-articles/pull/257) Fix scheduled posts with empty IA content (@Aioros)
|
207 |
+
- [#273](https://github.com/automattic/fb-instant-articles/pull/273) Copy updated to align better with scheduled posts (@demoive)
|
208 |
+
- [#271](https://github.com/automattic/fb-instant-articles/pull/271) Checks if it have the node to be shown as warning body (@everton-rosario)
|
209 |
+
- [#264](https://github.com/automattic/fb-instant-articles/pull/264) Add new application header (@diegoquinteiro)
|
210 |
+
|
211 |
+
## [2.10] - 2016-04-29
|
212 |
+
- [#179](https://github.com/automattic/fb-instant-articles/pull/179) Graphics for banner and icon (@demoive)
|
213 |
+
- [#183](https://github.com/automattic/fb-instant-articles/pull/183) Wordpress -> WordPress (@lesterchan)
|
214 |
+
- [#213](https://github.com/automattic/fb-instant-articles/pull/213) Labels and documentation changes re: custom transformer rules (@demoive)
|
215 |
+
|
216 |
+
## [2.9] - 2016-04-19
|
217 |
+
- [#174](https://github.com/automattic/fb-instant-articles/pull/174) Prevents <figcaptions> from being added to images that were not saved with captions (@bobderrico80)
|
218 |
+
- [#176](https://github.com/automattic/fb-instant-articles/pull/176) Remove unused image.caption property from ImageRule (@demoive)
|
219 |
+
- [#180](https://github.com/automattic/fb-instant-articles/pull/180) Fix empty articles being uploaded on bulk update (@diegoquinteiro)
|
220 |
+
- [#167](https://github.com/automattic/fb-instant-articles/pull/167) Fixes #116 encoding problem (@everton-rosario)
|
221 |
+
- [#173](https://github.com/automattic/fb-instant-articles/pull/173) Fixed empty link to Instant Articles signup (@demoive)
|
222 |
+
|
223 |
+
## [2.8] - 2016-04-14
|
224 |
+
- [#151](https://github.com/automattic/fb-instant-articles/pull/151) Stop publishing drafts (@diegoquinteiro)
|
225 |
+
|
226 |
+
## [2.6] - 2016-04-13
|
227 |
+
- [#115](https://github.com/automattic/fb-instant-articles/pull/115) Added information about initial publishing (@msurguy)
|
228 |
+
- [#105](https://github.com/automattic/fb-instant-articles/pull/105) Update template-settings-info.php (@piscis)
|
229 |
+
|
230 |
+
## [2.1] - 2016-04-11
|
231 |
+
- [#98](https://github.com/automattic/fb-instant-articles/pull/98) Fixes #72 (@diegoquinteiro)
|
232 |
+
- [#90](https://github.com/automattic/fb-instant-articles/pull/90) Change readme.txt to reflect changes in 2.0 (@diegoquinteiro)
|
233 |
+
- [#87](https://github.com/automattic/fb-instant-articles/pull/87) Clean unused files + fixes for 5.4 compatibility (@diegoquinteiro)
|
234 |
+
|
235 |
+
## [2.0] - 2016-04-06
|
236 |
+
- [#70](https://github.com/automattic/fb-instant-articles/pull/70) Use SDK engine (@diegoquinteiro)
|
237 |
+
|
238 |
+
## [0.2] - 2016-03-09
|
239 |
+
- [#41](https://github.com/automattic/fb-instant-articles/pull/41) Add support for subtitles through the filter instant_articles_subtitle (@bjornjohansen)
|
240 |
+
- [#39](https://github.com/automattic/fb-instant-articles/pull/39) Jetpack compat: YouTube and Facebook embeds (@bjornjohansen)
|
241 |
+
- [#22](https://github.com/automattic/fb-instant-articles/pull/22) Migrate the wpcom-helper.php from WordPress.com. (@Automattic)
|
242 |
+
|
243 |
+
[Unreleased]: https://github.com/automattic/fb-instant-articles/compare/5.0.0...HEAD
|
244 |
+
[5.0.0]: https://github.com/automattic/fb-instant-articles/compare/4.2.1...5.0.0
|
245 |
+
[4.2.1]: https://github.com/automattic/fb-instant-articles/compare/4.2.0...4.2.1
|
246 |
+
[4.2.0]: https://github.com/automattic/fb-instant-articles/compare/4.1.1...4.2.0
|
247 |
+
[4.1.1]: https://github.com/automattic/fb-instant-articles/compare/4.1.0...4.1.1
|
248 |
+
[4.1.0]: https://github.com/automattic/fb-instant-articles/compare/4.0.6...4.1.0
|
249 |
+
[4.0.6]: https://github.com/automattic/fb-instant-articles/compare/4.0.5...4.0.6
|
250 |
+
[4.0.5]: https://github.com/automattic/fb-instant-articles/compare/4.0.4...4.0.5
|
251 |
+
[4.0.4]: https://github.com/automattic/fb-instant-articles/compare/4.0.3...4.0.4
|
252 |
+
[4.0.3]: https://github.com/automattic/fb-instant-articles/compare/4.0.2...4.0.3
|
253 |
+
[4.0.2]: https://github.com/automattic/fb-instant-articles/compare/4.0.1...4.0.2
|
254 |
+
[4.0.1]: https://github.com/automattic/fb-instant-articles/compare/4.0.0...4.0.1
|
255 |
+
[4.0.0]: https://github.com/automattic/fb-instant-articles/compare/3.3.4...4.0.0
|
256 |
+
[3.3.4]: https://github.com/automattic/fb-instant-articles/compare/3.3.2...3.3.4
|
257 |
+
[3.3.2]: https://github.com/automattic/fb-instant-articles/compare/3.3.1...3.3.2
|
258 |
+
[3.3.1]: https://github.com/automattic/fb-instant-articles/compare/3.3...3.3.1
|
259 |
+
[3.3]: https://github.com/automattic/fb-instant-articles/compare/3.2.2...3.3
|
260 |
+
[3.2.2]: https://github.com/automattic/fb-instant-articles/compare/3.2.1...3.2.2
|
261 |
+
[3.2.1]: https://github.com/automattic/fb-instant-articles/compare/3.2...3.2.1
|
262 |
+
[3.2]: https://github.com/automattic/fb-instant-articles/compare/3.1.3...3.2
|
263 |
+
[3.1.3]: https://github.com/automattic/fb-instant-articles/compare/3.1...3.1.3
|
264 |
+
[3.1]: https://github.com/automattic/fb-instant-articles/compare/3.0.1...3.1
|
265 |
+
[3.0.1]: https://github.com/automattic/fb-instant-articles/compare/3.0...3.0.1
|
266 |
+
[3.0]: https://github.com/automattic/fb-instant-articles/compare/2.11...3.0
|
267 |
+
[2.11]: https://github.com/automattic/fb-instant-articles/compare/2.10...2.11
|
268 |
+
[2.10]: https://github.com/automattic/fb-instant-articles/compare/2.9...2.10
|
269 |
+
[2.9]: https://github.com/automattic/fb-instant-articles/compare/2.8...2.9
|
270 |
+
[2.8]: https://github.com/automattic/fb-instant-articles/compare/2.6...2.8
|
271 |
+
[2.6]: https://github.com/automattic/fb-instant-articles/compare/2.1...2.6
|
272 |
+
[2.1]: https://github.com/automattic/fb-instant-articles/compare/2.0...2.1
|
273 |
+
[2.0]: https://github.com/automattic/fb-instant-articles/compare/0.2...2.0
|
274 |
+
[0.2]: https://github.com/automattic/fb-instant-articles/releases/tag/0.2
|
LABELS.md
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
## Labels
|
2 |
-
### bug
|
3 |
-
A general bug in the plugin that needs to be fixed
|
4 |
-
### compat: wordpress.com
|
5 |
-
An incompatibility between the plugin and wordpress.com
|
6 |
-
### compat: 3rd party
|
7 |
-
An incompatibility between the plugin and another 3rd party plugin
|
8 |
-
### documentation
|
9 |
-
Incomplete or misleading information in the official documentation
|
10 |
-
### enhancement/feature request
|
11 |
-
Something that is currently not supported but requested by one or more users
|
12 |
-
### help wanted
|
13 |
-
An issue for which the contributors look for help from the community
|
14 |
-
### missing rule
|
15 |
-
A transformation rule that should be added
|
16 |
-
### more info needed
|
17 |
-
The author of the issue has provided insufficient information
|
18 |
-
### transformation
|
19 |
-
An bug in the transformation which is not related to a missing rule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
[![
|
2 |
-
|
3 |
# Instant Articles for WP
|
4 |
|
5 |
Enable [Instant Articles for Facebook](https://developers.facebook.com/docs/instant-articles) on your WordPress site.
|
6 |
|
7 |
-
##
|
8 |
-
|
|
|
9 |
|
10 |
## Description
|
11 |
|
@@ -46,7 +46,7 @@ More likely than not, this is because there is markup in the body of your post t
|
|
46 |
|
47 |
**Why doesn't my post appear in the list of Instant Articles in the publisher tools?**
|
48 |
Your posts are imported to your library when they are shared on Facebook for the first time.
|
49 |
-
|
50 |
Alternatively, you can trigger a manual scrape by pasting your URL on our [Share Debugger](http://developers.facebook.com/tools/debug)
|
51 |
|
52 |
Only Instant Articles with URLs in [domains you have claimed](https://developers.facebook.com/docs/instant-articles/guides/publishertools#connect) will show up in the Publishing Tools section.
|
@@ -79,43 +79,6 @@ By default it is set to `instant-articles` which usually will give you a feed UR
|
|
79 |
|
80 |
Usually simply visiting the permalinks settings page in the WordPress dashboard will do the trick (/wp-admin/options-permalink.php)
|
81 |
|
82 |
-
##
|
83 |
-
|
84 |
-
|
85 |
-
### Setup SDK and WP to use the Github code
|
86 |
-
Most of development and debugging we use the master or any feature branch for the development of WP plugin.
|
87 |
-
Sometimes it needs specific or newest version of the SDK to match all the new features that are release candidates to every new release of SDK and WP plugin.
|
88 |
-
|
89 |
-
The SDK is also under development @ GitHub: <https://github.com/facebook/facebook-instant-articles-sdk-php>
|
90 |
-
|
91 |
-
#### Pre-requisites
|
92 |
-
- Have PHP installed (you can install with homebrew)
|
93 |
-
- Have WebServer installed (you can use MAMP)
|
94 |
-
- Have WP installed (downloading from wordpress.org)
|
95 |
-
|
96 |
-
#### Setup
|
97 |
-
Clone both repositories into your developer folder (ex: ~/instant-articles).
|
98 |
-
```
|
99 |
-
git clone git@github.com:Automattic/facebook-instant-articles-wp.git
|
100 |
-
git clone git@github.com:facebook/facebook-instant-articles-sdk-php.git
|
101 |
-
```
|
102 |
-
|
103 |
-
Build both source folders:
|
104 |
-
```
|
105 |
-
cd facebook-instant-articles-sdk-php
|
106 |
-
composer install
|
107 |
-
|
108 |
-
cd ../facebook-instant-articles-wp
|
109 |
-
composer install
|
110 |
-
```
|
111 |
-
|
112 |
-
Now remove the build from your WordPress, so it will include the code you've just built.
|
113 |
-
```
|
114 |
-
rm -rf vendor/facebook/facebook-instant-articles-sdk-php
|
115 |
-
ln -s ~/facebook-instant-articles-sdk-php vendor/facebook/facebook-instant-articles-sdk-php
|
116 |
-
```
|
117 |
-
|
118 |
-
and now you can create a link inside your /wp-content/plugins to your folder
|
119 |
-
```
|
120 |
-
ln -s ~/facebook-instant-articles-wp wp-content/plugins/facebook-instant-articles-wp
|
121 |
-
```
|
1 |
+
[![CS & Lint](https://github.com/Automattic/fb-instant-articles/actions/workflows/cs-lint.yml/badge.svg)](https://github.com/Automattic/fb-instant-articles/actions/workflows/cs-lint.yml) [![Integration Tests](https://github.com/Automattic/fb-instant-articles/actions/workflows/tests.yml/badge.svg)](https://github.com/Automattic/fb-instant-articles/actions/workflows/tests.yml) [![Stale monitor](https://github.com/Automattic/fb-instant-articles/actions/workflows/stale.yml/badge.svg)](https://github.com/Automattic/fb-instant-articles/actions/workflows/stale.yml)
|
|
|
2 |
# Instant Articles for WP
|
3 |
|
4 |
Enable [Instant Articles for Facebook](https://developers.facebook.com/docs/instant-articles) on your WordPress site.
|
5 |
|
6 |
+
## Maintenance 🚩
|
7 |
+
Support for this plugin is provided for PHP 8 migrations, but both Automattic/WPVIP and Facebook/Meta have stopped all active development. At this point in the product lifecycle, publishers should be advised to stop using this plugin, and instead, use direct site traffic for Facebook content.
|
8 |
+
Meta have announced that Instant Articles will have all support dropped at April 2023.
|
9 |
|
10 |
## Description
|
11 |
|
46 |
|
47 |
**Why doesn't my post appear in the list of Instant Articles in the publisher tools?**
|
48 |
Your posts are imported to your library when they are shared on Facebook for the first time.
|
49 |
+
|
50 |
Alternatively, you can trigger a manual scrape by pasting your URL on our [Share Debugger](http://developers.facebook.com/tools/debug)
|
51 |
|
52 |
Only Instant Articles with URLs in [domains you have claimed](https://developers.facebook.com/docs/instant-articles/guides/publishertools#connect) will show up in the Publishing Tools section.
|
79 |
|
80 |
Usually simply visiting the permalinks settings page in the WordPress dashboard will do the trick (/wp-admin/options-permalink.php)
|
81 |
|
82 |
+
## Changelog
|
83 |
+
|
84 |
+
Please visit the [changelog](https://github.com/Automattic/fb-instant-articles/blob/develop/CHANGELOG.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/banner-1544x500.jpg
DELETED
Binary file
|
assets/banner-772x250.jpg
DELETED
Binary file
|
assets/check@2x.png
DELETED
Binary file
|
assets/connect@2x.png
DELETED
Binary file
|
assets/customize@2x.png
DELETED
Binary file
|
assets/icon-128x128.jpg
DELETED
Binary file
|
assets/icon-256x256.jpg
DELETED
Binary file
|
assets/key@2x.png
DELETED
Binary file
|
class-instant-articles-post.php
CHANGED
@@ -59,6 +59,11 @@ class Instant_Articles_Post {
|
|
59 |
*/
|
60 |
public $transformer = null;
|
61 |
|
|
|
|
|
|
|
|
|
|
|
62 |
/**
|
63 |
* Setup data and build the content
|
64 |
*
|
@@ -187,7 +192,6 @@ class Instant_Articles_Post {
|
|
187 |
* @return string The excerpt.
|
188 |
*/
|
189 |
public function get_the_excerpt() {
|
190 |
-
|
191 |
$post = get_post( $this->get_the_id() );
|
192 |
|
193 |
// This should ideally not happen, but it may do so if someone tampers with the query.
|
@@ -201,12 +205,14 @@ class Instant_Articles_Post {
|
|
201 |
|
202 |
/**
|
203 |
* Apply the default WP Filters for the post excerpt.
|
|
|
204 |
*
|
205 |
* @since 0.1
|
206 |
*
|
207 |
* @param string $post_excerpt The post excerpt.
|
|
|
208 |
*/
|
209 |
-
$excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt );
|
210 |
|
211 |
/**
|
212 |
* Filter the post excerpt for instant articles.
|
@@ -294,7 +300,8 @@ class Instant_Articles_Post {
|
|
294 |
|
295 |
// Try to get the content from a transient, but only if the cached version have the same modtime.
|
296 |
$cache_mod_time = get_transient( 'instantarticles_mod_' . $this->_post->ID );
|
297 |
-
if (
|
|
|
298 |
$content = get_transient( 'instantarticles_content_' . $this->_post->ID );
|
299 |
if ( false !== $content && strlen( $content ) ) {
|
300 |
return $content;
|
@@ -503,28 +510,22 @@ class Instant_Articles_Post {
|
|
503 |
|
504 |
$cover_media = Image::create();
|
505 |
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
*
|
512 |
-
* @since 0.1
|
513 |
-
* @param Image $cover_media The cover media object.
|
514 |
-
* @param int $post_id The current post ID.
|
515 |
-
*/
|
516 |
-
$cover_media = apply_filters( 'instant_articles_cover_media', $cover_media, $this->_post->ID );
|
517 |
-
} else {
|
518 |
-
|
519 |
-
$featured_image_data = $this->get_the_featured_image();
|
520 |
-
if ( isset( $featured_image_data['src'] ) && strlen( $featured_image_data['src'] ) ) {
|
521 |
-
$cover_media = Image::create()->withURL($featured_image_data['src']);
|
522 |
-
if( isset( $featured_image_data['caption'] ) && strlen( $featured_image_data['caption'] )) {
|
523 |
-
$cover_media->withCaption(Caption::create()->withTitle($featured_image_data['caption']));
|
524 |
-
}
|
525 |
}
|
526 |
}
|
527 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
return $cover_media;
|
529 |
}
|
530 |
|
@@ -718,7 +719,7 @@ class Instant_Articles_Post {
|
|
718 |
$height = 250;
|
719 |
|
720 |
$dimensions_match = array();
|
721 |
-
$dimensions_raw = isset( $settings_ads['dimensions'] ) ? $settings_ads['dimensions'] :
|
722 |
if ( preg_match( '/^(?:\s)*(\d+)x(\d+)(?:\s)*$/', $dimensions_raw, $dimensions_match ) ) {
|
723 |
$width = intval( $dimensions_match[1] );
|
724 |
$height = intval( $dimensions_match[2] );
|
59 |
*/
|
60 |
public $transformer = null;
|
61 |
|
62 |
+
/**
|
63 |
+
* @var InstantArticle|mixed|null
|
64 |
+
*/
|
65 |
+
private $instant_article;
|
66 |
+
|
67 |
/**
|
68 |
* Setup data and build the content
|
69 |
*
|
192 |
* @return string The excerpt.
|
193 |
*/
|
194 |
public function get_the_excerpt() {
|
|
|
195 |
$post = get_post( $this->get_the_id() );
|
196 |
|
197 |
// This should ideally not happen, but it may do so if someone tampers with the query.
|
205 |
|
206 |
/**
|
207 |
* Apply the default WP Filters for the post excerpt.
|
208 |
+
* https://developer.wordpress.org/reference/hooks/get_the_excerpt/
|
209 |
*
|
210 |
* @since 0.1
|
211 |
*
|
212 |
* @param string $post_excerpt The post excerpt.
|
213 |
+
* @param WP_Post $post The post object.
|
214 |
*/
|
215 |
+
$excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
|
216 |
|
217 |
/**
|
218 |
* Filter the post excerpt for instant articles.
|
300 |
|
301 |
// Try to get the content from a transient, but only if the cached version have the same modtime.
|
302 |
$cache_mod_time = get_transient( 'instantarticles_mod_' . $this->_post->ID );
|
303 |
+
if ( apply_filters( 'instant_articles_cache_content', true, $this->_post->ID )
|
304 |
+
&& get_post_modified_time( 'Y-m-d H:i:s', true, $this->_post->ID ) === $cache_mod_time ) {
|
305 |
$content = get_transient( 'instantarticles_content_' . $this->_post->ID );
|
306 |
if ( false !== $content && strlen( $content ) ) {
|
307 |
return $content;
|
510 |
|
511 |
$cover_media = Image::create();
|
512 |
|
513 |
+
$featured_image_data = $this->get_the_featured_image();
|
514 |
+
if ( isset( $featured_image_data['src'] ) && strlen( $featured_image_data['src'] ) ) {
|
515 |
+
$cover_media = Image::create()->withURL($featured_image_data['src']);
|
516 |
+
if( isset( $featured_image_data['caption'] ) && strlen( $featured_image_data['caption'] )) {
|
517 |
+
$cover_media->withCaption(Caption::create()->withTitle($featured_image_data['caption']));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
}
|
519 |
}
|
520 |
|
521 |
+
/**
|
522 |
+
* Filter the cover media
|
523 |
+
*
|
524 |
+
* @since 0.1
|
525 |
+
* @param Image $cover_media The cover media object.
|
526 |
+
* @param int $post_id The current post ID.
|
527 |
+
*/
|
528 |
+
$cover_media = apply_filters( 'instant_articles_cover_media', $cover_media, $this->_post->ID );
|
529 |
return $cover_media;
|
530 |
}
|
531 |
|
719 |
$height = 250;
|
720 |
|
721 |
$dimensions_match = array();
|
722 |
+
$dimensions_raw = isset( $settings_ads['dimensions'] ) ? $settings_ads['dimensions'] : '';
|
723 |
if ( preg_match( '/^(?:\s)*(\d+)x(\d+)(?:\s)*$/', $dimensions_raw, $dimensions_match ) ) {
|
724 |
$width = intval( $dimensions_match[1] );
|
725 |
$height = intval( $dimensions_match[2] );
|
class-instant-articles-publisher.php
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
use Facebook\InstantArticles\Client\Client;
|
11 |
-
use Facebook\Facebook;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Class responsible for drawing the meta box on the post edit page
|
15 |
-
*
|
16 |
-
* @since 0.1
|
17 |
-
*/
|
18 |
-
class Instant_Articles_Publisher {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Key to store the submission status ID on meta data
|
22 |
-
*/
|
23 |
-
const SUBMISSION_ID_KEY = 'instant_articles_submission_id';
|
24 |
-
const FORCE_SUBMIT_KEY = 'instant_articles_force_submit';
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Inits publisher.
|
28 |
-
* Change by cmjaimet submitted Jan 3, 2016: Delay save_post action hook (3rd param 10 => 999) so that all custom meta data is processed and saved before submission to FBIA
|
29 |
-
*/
|
30 |
-
public static function init() {
|
31 |
-
add_action( 'save_post', array( 'Instant_Articles_Publisher', 'submit_article' ), 999, 2 );
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Submits article to Instant Articles.
|
36 |
-
*
|
37 |
-
* @param string $post_id The identifier of post.
|
38 |
-
* @param Post $post The WP Post.
|
39 |
-
*/
|
40 |
-
public static function submit_article( $post_id, $post ) {
|
41 |
-
|
42 |
-
// Don't process if this is just a revision or an autosave.
|
43 |
-
if ( wp_is_post_revision( $post ) || wp_is_post_autosave( $post->ID ) ) {
|
44 |
-
return;
|
45 |
-
}
|
46 |
-
|
47 |
-
// Don't process if this post is not published
|
48 |
-
if ( 'publish' !== $post->post_status ) {
|
49 |
-
return;
|
50 |
-
}
|
51 |
-
|
52 |
-
// Only process posts
|
53 |
-
$post_types = apply_filters( 'instant_articles_post_types', array( 'post' ) );
|
54 |
-
if ( ! in_array( $post->post_type, $post_types ) ) {
|
55 |
-
return;
|
56 |
-
}
|
57 |
-
|
58 |
-
// Transform the post to an Instant Article.
|
59 |
-
$adapter = new Instant_Articles_Post( $post );
|
60 |
-
|
61 |
-
// Allow to disable post submit via filter
|
62 |
-
if ( false === apply_filters( 'instant_articles_should_submit_post', true, $adapter ) ) {
|
63 |
-
return;
|
64 |
-
}
|
65 |
-
|
66 |
-
$article = $adapter->to_instant_article();
|
67 |
-
|
68 |
-
// Skip empty articles or articles missing title.
|
69 |
-
// This is important because the save_post action is also triggered by bulk updates, but in this case
|
70 |
-
// WordPress does not load the content field from DB for performance reasons. In this case, articles
|
71 |
-
// will be empty here, despite of them actually having content.
|
72 |
-
if ( count( $article->getChildren() ) === 0 || ! $article->getHeader() || ! $article->getHeader()->getTitle() ) {
|
73 |
-
return;
|
74 |
-
}
|
75 |
-
|
76 |
-
// Instantiate an API client.
|
77 |
-
try {
|
78 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
79 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
80 |
-
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
81 |
-
$force_submit = get_post_meta( $post_id, self::FORCE_SUBMIT_KEY, true );
|
82 |
-
|
83 |
-
$dev_mode = isset( $publishing_settings['dev_mode'] )
|
84 |
-
? ( $publishing_settings['dev_mode'] ? true : false )
|
85 |
-
: false;
|
86 |
-
|
87 |
-
if ( isset( $fb_app_settings['app_id'] )
|
88 |
-
&& isset( $fb_app_settings['app_secret'] )
|
89 |
-
&& isset( $fb_page_settings['page_access_token'] )
|
90 |
-
&& isset( $fb_page_settings['page_id'] ) ) {
|
91 |
-
|
92 |
-
$client = Client::create(
|
93 |
-
$fb_app_settings['app_id'],
|
94 |
-
$fb_app_settings['app_secret'],
|
95 |
-
$fb_page_settings['page_access_token'],
|
96 |
-
$fb_page_settings['page_id'],
|
97 |
-
$dev_mode
|
98 |
-
);
|
99 |
-
|
100 |
-
// Don't publish posts with password protection
|
101 |
-
if ( post_password_required( $post ) ) {
|
102 |
-
// Unpublishes if already published and from now on it started to have password protection
|
103 |
-
$client->removeArticle( $article->getCanonicalURL() );
|
104 |
-
delete_post_meta( $post_id, self::SUBMISSION_ID_KEY );
|
105 |
-
return;
|
106 |
-
}
|
107 |
-
|
108 |
-
// Don't process if contains warnings and blocker flag for transformation warnings is turned on.
|
109 |
-
if ( count( $adapter->transformer->getWarnings() ) > 0
|
110 |
-
&& ( ! isset( $publishing_settings[ 'publish_with_warnings' ] ) || ! $publishing_settings[ 'publish_with_warnings' ] )
|
111 |
-
&& ( ! $force_submit )
|
112 |
-
) {
|
113 |
-
|
114 |
-
// Unpublishes if already published
|
115 |
-
$client->removeArticle( $article->getCanonicalURL() );
|
116 |
-
delete_post_meta( $post_id, self::SUBMISSION_ID_KEY );
|
117 |
-
|
118 |
-
return;
|
119 |
-
}
|
120 |
-
|
121 |
-
if ( $dev_mode ) {
|
122 |
-
$published = false;
|
123 |
-
} else {
|
124 |
-
// Any publish status other than 'publish' means draft for the Instant Article.
|
125 |
-
$published = apply_filters( 'instant_articles_post_published', true, $post_id );
|
126 |
-
}
|
127 |
-
|
128 |
-
try {
|
129 |
-
// Import the article.
|
130 |
-
$submission_id = $client->importArticle( $article, $published );
|
131 |
-
update_post_meta( $post_id, self::SUBMISSION_ID_KEY, $submission_id );
|
132 |
-
} catch ( Exception $e ) {
|
133 |
-
// Try without taking live for pages not yet reviewed.
|
134 |
-
$submission_id = $client->importArticle( $article, false );
|
135 |
-
update_post_meta( $post_id, self::SUBMISSION_ID_KEY, $submission_id );
|
136 |
-
}
|
137 |
-
}
|
138 |
-
} catch ( Exception $e ) {
|
139 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
140 |
-
'Unable to submit article.',
|
141 |
-
$e->getTraceAsString()
|
142 |
-
);
|
143 |
-
}
|
144 |
-
}
|
145 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
embeds.php
CHANGED
@@ -24,6 +24,12 @@ remove_all_filters( 'embed_oembed_html' );
|
|
24 |
*/
|
25 |
function instant_articles_embed_oembed_html( $html, $url, $attr, $post_id ) {
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
$cache_key = md5( $url . ':instant_articles_oembed_provider' );
|
28 |
$provider_name = get_transient( $cache_key );
|
29 |
|
24 |
*/
|
25 |
function instant_articles_embed_oembed_html( $html, $url, $attr, $post_id ) {
|
26 |
|
27 |
+
// Don't try to fix embeds unless we're in Instant Articles context.
|
28 |
+
// No need to populate cache outside of Instant Articles context.
|
29 |
+
if ( ! is_transforming_instant_article() ) {
|
30 |
+
return $html;
|
31 |
+
}
|
32 |
+
|
33 |
$cache_key = md5( $url . ':instant_articles_oembed_provider' );
|
34 |
$provider_name = get_transient( $cache_key );
|
35 |
|
facebook-instant-articles.php
CHANGED
@@ -1,555 +1,576 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
* Description: Add support for Instant Articles for Facebook to your WordPress site.
|
5 |
-
* Author: Automattic, Dekode, Facebook
|
6 |
-
* Author URI: https://vip.wordpress.com/plugins/instant-articles/
|
7 |
-
* Version: 4.2.1
|
8 |
-
* Text Domain: instant-articles
|
9 |
-
* License: GPLv2
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*
|
12 |
-
* @package
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
23 |
}
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
return;
|
30 |
-
}
|
31 |
|
|
|
32 |
$autoloader = require __DIR__ . '/vendor/autoload.php';
|
33 |
$autoloader->add( 'Facebook\\', __DIR__ . '/vendor/facebook/facebook-instant-articles-sdk-php/src' );
|
34 |
$autoloader->add( 'Facebook\\', __DIR__ . '/vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src' );
|
|
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
|
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
register_activation_hook( __FILE__, 'instant_articles_activate' );
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
echo '<div class="updated settings-error notice is-dismissible">';
|
78 |
-
echo '<p>Congrats, you\'ve installed the Instant Articles for WP plugin. Now <a href="' . esc_url_raw($settings_url) . '">set it up</a> to start publishing Instant Articles.';
|
79 |
-
echo '</div>';
|
80 |
-
}
|
81 |
-
}
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
load_plugin_textdomain( 'instant-articles', false, plugin_dir_path( __FILE__ ) . '/languages' );
|
100 |
-
}
|
101 |
-
add_action( 'plugins_loaded', 'instant_articles_load_textdomain' );
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
*
|
106 |
-
* @since 2.0
|
107 |
-
*/
|
108 |
-
function instant_articles_load_compat() {
|
109 |
-
require_once( dirname( __FILE__ ) . '/compat.php' );
|
110 |
-
}
|
111 |
-
add_action( 'plugins_loaded', 'instant_articles_load_compat' );
|
112 |
|
113 |
-
|
114 |
-
* Register our special feed.
|
115 |
-
*
|
116 |
-
* @since 0.1
|
117 |
-
*/
|
118 |
-
function instant_articles_init() {
|
119 |
-
add_feed( INSTANT_ARTICLES_SLUG, 'instant_articles_feed' );
|
120 |
-
}
|
121 |
-
add_action( 'init', 'instant_articles_init' );
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
* @since 0.1
|
128 |
-
*/
|
129 |
-
function instant_articles_feed() {
|
130 |
|
131 |
-
|
132 |
-
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
|
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
|
149 |
-
|
|
|
|
|
150 |
}
|
151 |
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
* We want the posts in the modified order, to provide Facebook with content updates even for older posts.
|
156 |
-
* Facebook will only import 100 posts at the time.
|
157 |
-
* Facebook will only update posts modified within the last 24 hours
|
158 |
-
*
|
159 |
-
* @param WP_Query $query The WP_Query object. Passed by reference.
|
160 |
-
*/
|
161 |
-
function instant_articles_query( $query ) {
|
162 |
-
|
163 |
-
if ( $query->is_main_query() && $query->is_feed( INSTANT_ARTICLES_SLUG ) ) {
|
164 |
-
|
165 |
-
$query->set( 'orderby', 'modified' );
|
166 |
-
$query->set( 'posts_per_page', 10 );
|
167 |
-
$query->set( 'posts_per_rss', 10 );
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Filter the post types to include in the query.
|
171 |
-
*
|
172 |
-
* Default to `post` only, but allow other post types to be included by the theme/plugins.
|
173 |
-
*
|
174 |
-
* @since 2.12
|
175 |
-
*
|
176 |
-
* @param array $post_types Array of post types
|
177 |
-
*/
|
178 |
-
$post_types = apply_filters( 'instant_articles_post_types', array( 'post' ) );
|
179 |
-
$query->set( 'post_type', $post_types );
|
180 |
-
|
181 |
-
/**
|
182 |
-
* If the constant INSTANT_ARTICLES_LIMIT_POSTS is set to true, we will limit the feed
|
183 |
-
* to only include posts which are modified within the last 24 hours.
|
184 |
-
* Facebook will initially need 100 posts to pass the review, but will only update
|
185 |
-
* already imported articles if they are modified within the last 24 hours.
|
186 |
-
*/
|
187 |
-
if ( defined( 'INSTANT_ARTICLES_LIMIT_POSTS' ) && INSTANT_ARTICLES_LIMIT_POSTS ) {
|
188 |
-
$query->set( 'date_query', array(
|
189 |
-
array(
|
190 |
-
'column' => 'post_modified',
|
191 |
-
'after' => '1 day ago',
|
192 |
-
),
|
193 |
-
) );
|
194 |
-
}
|
195 |
-
}
|
196 |
}
|
197 |
-
|
198 |
|
|
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
plugins_url( '/css/instant-articles-settings.css', __FILE__ ),
|
240 |
-
null,
|
241 |
-
IA_PLUGIN_VERSION,
|
242 |
-
false
|
243 |
-
);
|
244 |
-
wp_register_style(
|
245 |
-
'instant-articles-wizard',
|
246 |
-
plugins_url( '/css/instant-articles-wizard.css', __FILE__ ),
|
247 |
-
null,
|
248 |
-
IA_PLUGIN_VERSION,
|
249 |
-
false
|
250 |
-
);
|
251 |
-
wp_register_style(
|
252 |
-
'instant-articles-index-column',
|
253 |
-
plugins_url( '/css/instant-articles-index-column.css', __FILE__ ),
|
254 |
-
null,
|
255 |
-
IA_PLUGIN_VERSION,
|
256 |
-
false
|
257 |
-
);
|
258 |
-
|
259 |
-
|
260 |
-
wp_register_script(
|
261 |
-
'instant-articles-meta-box',
|
262 |
-
plugins_url( '/js/instant-articles-meta-box.js', __FILE__ ),
|
263 |
-
null,
|
264 |
-
IA_PLUGIN_VERSION,
|
265 |
-
false
|
266 |
-
);
|
267 |
-
wp_register_script(
|
268 |
-
'instant-articles-option-ads',
|
269 |
-
plugins_url( '/js/instant-articles-option-ads.js', __FILE__ ),
|
270 |
-
null,
|
271 |
-
IA_PLUGIN_VERSION,
|
272 |
-
false
|
273 |
-
);
|
274 |
-
wp_register_script(
|
275 |
-
'instant-articles-option-analytics',
|
276 |
-
plugins_url( '/js/instant-articles-option-analytics.js', __FILE__ ),
|
277 |
-
null,
|
278 |
-
IA_PLUGIN_VERSION,
|
279 |
-
false
|
280 |
-
);
|
281 |
-
wp_register_script(
|
282 |
-
'instant-articles-option-publishing',
|
283 |
-
plugins_url( '/js/instant-articles-option-publishing.js', __FILE__ ),
|
284 |
-
null,
|
285 |
-
IA_PLUGIN_VERSION,
|
286 |
-
false
|
287 |
-
);
|
288 |
-
wp_register_script(
|
289 |
-
'instant-articles-settings',
|
290 |
-
plugins_url( '/js/instant-articles-settings.js', __FILE__ ),
|
291 |
-
null,
|
292 |
-
IA_PLUGIN_VERSION,
|
293 |
-
false
|
294 |
-
);
|
295 |
}
|
296 |
-
|
297 |
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
wp_enqueue_script( 'instant-articles-meta-box' );
|
311 |
-
wp_enqueue_script( 'instant-articles-option-ads' );
|
312 |
-
wp_enqueue_script( 'instant-articles-option-analytics' );
|
313 |
-
wp_enqueue_script( 'instant-articles-option-publishing' );
|
314 |
-
wp_enqueue_script( 'instant-articles-settings' );
|
315 |
-
wp_enqueue_script( 'instant-articles-wizard' );
|
316 |
}
|
317 |
-
add_action( 'admin_enqueue_scripts', 'instant_articles_enqueue_scripts' );
|
318 |
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
*/
|
325 |
-
function inject_url_claiming_meta_tag() {
|
326 |
-
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
327 |
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
|
|
|
|
|
|
|
|
328 |
|
329 |
-
if (
|
|
|
|
|
|
|
|
|
330 |
?>
|
331 |
-
<meta property="
|
332 |
<?php
|
333 |
}
|
334 |
}
|
335 |
-
|
336 |
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
function inject_ia_markup_meta_tag() {
|
343 |
-
$post = get_post();
|
344 |
-
|
345 |
-
// If there's no current post, return
|
346 |
-
if ( ! $post ) {
|
347 |
-
return;
|
348 |
-
}
|
349 |
|
|
|
|
|
|
|
|
|
|
|
350 |
// Transform the post to an Instant Article.
|
351 |
$adapter = new Instant_Articles_Post( $post );
|
352 |
-
|
353 |
-
|
354 |
-
$url = add_query_arg( 'ia_markup', '1', $url );
|
355 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
356 |
-
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
357 |
-
$dev_mode = isset( $publishing_settings['dev_mode'] )
|
358 |
-
? ( $publishing_settings['dev_mode'] ? true : false )
|
359 |
-
: false;
|
360 |
-
|
361 |
-
if ( $dev_mode ) {
|
362 |
-
?>
|
363 |
-
<meta property="ia:markup_url_dev" content="<?php echo esc_attr( $url ); ?>" />
|
364 |
-
<?php
|
365 |
-
} else {
|
366 |
-
?>
|
367 |
-
<meta property="ia:markup_url" content="<?php echo esc_attr( $url ); ?>" />
|
368 |
-
<?php
|
369 |
-
}
|
370 |
-
}
|
371 |
-
}
|
372 |
-
add_action( 'wp_head', 'inject_ia_markup_meta_tag' );
|
373 |
|
374 |
-
|
375 |
-
|
|
|
376 |
|
377 |
-
// Initialize the Instant Articles meta box.
|
378 |
-
Instant_Articles_Meta_Box::init();
|
379 |
|
380 |
-
|
381 |
-
|
382 |
|
383 |
-
|
384 |
-
|
385 |
-
$adapter = new Instant_Articles_Post( $post );
|
386 |
-
$article = $adapter->to_instant_article();
|
387 |
-
echo $article->render( null, true );
|
388 |
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
Instant_Articles_Wizard::init();
|
398 |
-
Instant_Articles_Signer::init();
|
399 |
|
400 |
-
|
|
|
|
|
|
|
|
|
401 |
// These post metas are caches on the calculations made to decide if
|
402 |
// a post is in good state to be converted to an Instant Article or not
|
403 |
-
|
404 |
-
|
405 |
}
|
406 |
-
|
407 |
-
|
408 |
-
// We also need to invalidate the transformation caches when the option containing
|
409 |
-
// the custom transformer rules is updated
|
410 |
-
function invalidate_all_posts_transformation_info_cache( $option ) {
|
411 |
-
if ( $option === Instant_Articles_Option_Publishing::OPTION_KEY ) {
|
412 |
-
// These post metas are caches on the calculations made to decide if
|
413 |
-
// a post is in good state to be converted to an Instant Article or not
|
414 |
-
delete_post_meta_by_key( '_has_warnings_after_transformation' );
|
415 |
-
delete_post_meta_by_key( '_is_empty_after_transformation' );
|
416 |
-
}
|
417 |
-
}
|
418 |
-
add_action( 'updated_option', 'invalidate_all_posts_transformation_info_cache', 10, 1 );
|
419 |
|
420 |
-
|
421 |
-
|
422 |
-
|
|
|
423 |
|
424 |
-
|
425 |
-
|
426 |
-
}
|
427 |
-
return $columns;
|
428 |
}
|
429 |
-
|
430 |
-
|
431 |
-
function fbia_indication_column( $column_name, $post_ID ) {
|
432 |
-
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
433 |
-
$display_warning_column = isset( $publishing_settings[ 'display_warning_column' ] ) ? $publishing_settings[ 'display_warning_column' ] : '0';
|
434 |
-
|
435 |
-
if( "1" === $display_warning_column ) {
|
436 |
-
$red_light = '<span title="Instant article is empty after transformation." class="instant-articles-col-status error"></span>';
|
437 |
|
438 |
-
|
|
|
|
|
|
|
439 |
|
440 |
-
|
|
|
441 |
|
442 |
-
|
443 |
-
$post = get_post( $post_ID );
|
444 |
-
$instant_articles_post = new \Instant_Articles_Post( $post );
|
445 |
|
446 |
-
|
447 |
-
if ( true === $is_empty ) {
|
448 |
-
echo wp_kses_post( $red_light );
|
449 |
-
return;
|
450 |
-
}
|
451 |
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
return;
|
456 |
-
}
|
457 |
|
458 |
-
|
|
|
|
|
|
|
|
|
459 |
|
|
|
|
|
|
|
460 |
return;
|
461 |
}
|
|
|
|
|
|
|
|
|
462 |
}
|
463 |
}
|
464 |
-
|
465 |
-
|
466 |
-
function invalidate_scrape_on_update( $post_ID, $post_after, $post_before ) {
|
467 |
-
$adapter = new Instant_Articles_Post( $post_after );
|
468 |
-
if ( $adapter->should_submit_post() ) {
|
469 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
470 |
-
if (
|
471 |
-
( isset( $fb_app_settings[ 'page_access_token' ] ) && $fb_app_settings[ 'page_access_token' ] ) &&
|
472 |
-
( isset( $fb_app_settings[ 'app_id' ] ) && $fb_app_settings[ 'app_id' ] ) &&
|
473 |
-
( isset( $fb_app_settings[ 'app_secret' ] ) && $fb_app_settings[ 'app_secret' ] )
|
474 |
-
) {
|
475 |
-
// Fetches the right URL to invalidate
|
476 |
-
$url = $adapter->get_canonical_url();
|
477 |
-
|
478 |
-
// oAuth info
|
479 |
-
$app_id = $fb_app_settings[ 'app_id' ];
|
480 |
-
$app_secret = $fb_app_settings[ 'app_secret' ];
|
481 |
-
$access_token = $fb_app_settings[ 'page_access_token' ];
|
482 |
-
|
483 |
-
// Build Graph SDK instance
|
484 |
-
$fb = new \Facebook\Facebook([
|
485 |
-
'app_id' => $app_id,
|
486 |
-
'app_secret' => $app_secret,
|
487 |
-
'default_access_token' => $access_token
|
488 |
-
]);
|
489 |
-
|
490 |
-
function admin_notice__scrape_invalidation_failed() {
|
491 |
-
?>
|
492 |
-
<div class="notice notice-error is-dismissible">
|
493 |
-
<p>
|
494 |
-
<?php _e( 'It was not possible to automatically invalidate the scrape for this article.', IA_PLUGIN_TEXT_DOMAIN ) ?>
|
495 |
-
<?php _e( 'Please trigger a new scrape manually using the Facebook Share Debugger.', IA_PLUGIN_TEXT_DOMAIN ) ?>
|
496 |
-
</p>
|
497 |
-
</div>
|
498 |
-
<?php
|
499 |
-
}
|
500 |
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
|
|
|
|
|
|
510 |
|
|
|
|
|
|
|
|
|
511 |
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
|
|
|
|
516 |
|
517 |
-
|
518 |
-
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
|
521 |
-
|
522 |
-
|
523 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
|
525 |
-
add_action( 'admin_notices', 'admin_notice__scrape_invalidation_failed' );
|
526 |
-
} catch(Facebook\Exceptions\FacebookSDKException $e) {
|
527 |
|
528 |
-
|
529 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
}
|
531 |
}
|
532 |
}
|
533 |
-
|
534 |
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
)
|
545 |
-
|
546 |
-
|
547 |
-
|
|
|
548 |
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
$client->send(
|
554 |
Instant_Articles_Signer::sign_request_path(
|
555 |
"https://graph.facebook.com/?id=$url_encoded&scrape=true"
|
@@ -559,28 +580,10 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
559 |
array(),
|
560 |
60
|
561 |
);
|
562 |
-
foreach ( $old_slugs as $slug ) {
|
563 |
-
$clone_post = clone $post;
|
564 |
-
$clone_post->post_name = $slug;
|
565 |
-
$clone_adapter = new Instant_Articles_Post( $clone_post );
|
566 |
-
|
567 |
-
$url_encoded = urlencode($clone_adapter->get_canonical_url());
|
568 |
-
$client->send(
|
569 |
-
Instant_Articles_Signer::sign_request_path(
|
570 |
-
"https://graph.facebook.com/?id=$url_encoded&scrape=true"
|
571 |
-
),
|
572 |
-
'POST',
|
573 |
-
'',
|
574 |
-
array(),
|
575 |
-
60
|
576 |
-
);
|
577 |
-
}
|
578 |
}
|
579 |
-
} catch ( Exception $e ) {
|
580 |
-
error_log( 'Unable to submit article.'.$e->getTraceAsString() );
|
581 |
}
|
|
|
|
|
582 |
}
|
583 |
}
|
584 |
-
add_action( 'save_post', 'rescrape_article', 999, 2 );
|
585 |
-
|
586 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Facebook Instant Articles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
*
|
5 |
+
* @package Automattic\FacebookInstantArticles
|
6 |
+
* @author Automattic, Dekode, Facebook
|
7 |
+
* @license GPL-2.0-or-later
|
8 |
+
*
|
9 |
+
* @wordpress-plugin
|
10 |
+
* Plugin Name: Instant Articles for WP
|
11 |
+
* Description: Add support for Instant Articles for Facebook to your WordPress site.
|
12 |
+
* Author: Automattic, Dekode, Facebook
|
13 |
+
* Version: 5.0.0
|
14 |
+
* Text Domain: instant-articles
|
15 |
+
* License: GPL-2.0-or-later
|
16 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
17 |
+
* GitHub Plugin URI: https://github.com/Automattic/fb-instant-articles
|
18 |
+
* Requires PHP: 7.1
|
19 |
+
* Requires WP: 4.7.0
|
20 |
*/
|
21 |
|
22 |
+
defined( 'ABSPATH' ) || die();
|
23 |
+
|
24 |
+
const IA_PLUGIN_VERSION = '5.0.0';
|
25 |
+
const IA_PLUGIN_FILE = __FILE__;
|
26 |
+
const IA_PLUGIN_FORCE_SUBMIT_KEY = 'instant_articles_force_submit';
|
27 |
+
|
28 |
+
// Let users define their own feed slug.
|
29 |
+
if ( ! defined( 'INSTANT_ARTICLES_SLUG' ) ) {
|
30 |
+
define( 'INSTANT_ARTICLES_SLUG', 'instant-articles' );
|
31 |
}
|
32 |
+
|
33 |
+
if ( version_compare( PHP_VERSION, '7.1', '<' ) ) {
|
34 |
+
add_action( 'admin_notices', 'fbia_show_version_incompatible_warning' );
|
35 |
+
/**
|
36 |
+
* Prints error about incompatible version. Extracted as function issue: #390
|
37 |
+
*
|
38 |
+
* @since 3.3.4
|
39 |
+
*/
|
40 |
+
function fbia_show_version_incompatible_warning() {
|
41 |
+
echo '<div class="error"><p>' .
|
42 |
+
esc_html__( 'Instant Articles for WP requires PHP 7.1 to function properly. Please upgrade PHP or deactivate Instant Articles for WP.', 'instant-articles' ) . '</p></div>';
|
43 |
+
}
|
44 |
+
|
45 |
return;
|
46 |
+
}
|
47 |
|
48 |
+
if ( ! class_exists( 'Facebook\\Facebook' ) && file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
|
49 |
$autoloader = require __DIR__ . '/vendor/autoload.php';
|
50 |
$autoloader->add( 'Facebook\\', __DIR__ . '/vendor/facebook/facebook-instant-articles-sdk-php/src' );
|
51 |
$autoloader->add( 'Facebook\\', __DIR__ . '/vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src' );
|
52 |
+
}
|
53 |
|
54 |
+
require_once __DIR__ . '/embeds.php';
|
55 |
+
require_once __DIR__ . '/class-instant-articles-post.php';
|
56 |
+
require_once __DIR__ . '/wizard/class-instant-articles-wizard.php';
|
57 |
+
require_once __DIR__ . '/meta-box/class-instant-articles-meta-box.php';
|
58 |
+
require_once __DIR__ . '/class-instant-articles-amp-markup.php';
|
59 |
+
require_once __DIR__ . '/class-instant-articles-signer.php';
|
60 |
|
61 |
+
register_activation_hook( __FILE__, 'instant_articles_activate' );
|
62 |
+
/**
|
63 |
+
* Plugin activation hook to add our rewrite rules.
|
64 |
+
*
|
65 |
+
* @since 0.1
|
66 |
+
*/
|
67 |
+
function instant_articles_activate() {
|
68 |
+
instant_articles_init();
|
69 |
+
flush_rewrite_rules();
|
70 |
+
}
|
71 |
|
72 |
+
add_action( 'admin_notices', 'instant_articles_setup_admin_notice' );
|
73 |
+
add_action( 'network_admin_notices', 'instant_articles_setup_admin_notice' ); // also show message on multisite
|
74 |
+
/**
|
75 |
+
* Show a message to set up the plugin when it is activated
|
76 |
+
*/
|
77 |
+
function instant_articles_setup_admin_notice() {
|
78 |
+
global $pagenow;
|
79 |
+
if ( $pagenow === 'plugins.php' && ! isset( Instant_Articles_Option_FB_Page::get_option_decoded()['page_id'] ) ) {
|
80 |
+
$settings_url = Instant_Articles_Wizard::get_url();
|
81 |
+
echo '<div class="updated settings-error notice is-dismissible">';
|
82 |
+
echo '<p>Congrats, you\'ve installed the Instant Articles for WP plugin. Now <a href="' . esc_url( $settings_url ) . '">set it up</a> to start publishing Instant Articles.';
|
83 |
+
echo '</div>';
|
84 |
}
|
85 |
+
}
|
86 |
|
87 |
+
register_deactivation_hook( __FILE__, 'instant_articles_deactivate' );
|
88 |
+
/**
|
89 |
+
* Plugin activation hook to remove our rewrite rules.
|
90 |
+
*
|
91 |
+
* @since 0.1
|
92 |
+
*/
|
93 |
+
function instant_articles_deactivate() {
|
94 |
+
flush_rewrite_rules();
|
95 |
+
}
|
96 |
|
97 |
+
add_action( 'plugins_loaded', 'instant_articles_load_textdomain' );
|
98 |
+
/**
|
99 |
+
* Load plugin textdomain.
|
100 |
+
*
|
101 |
+
* @since 0.1
|
102 |
+
*/
|
103 |
+
function instant_articles_load_textdomain() {
|
104 |
+
load_plugin_textdomain( 'instant-articles', false, plugin_dir_path( __FILE__ ) . '/languages' );
|
105 |
+
}
|
|
|
106 |
|
107 |
+
add_action( 'plugins_loaded', 'instant_articles_load_compat' );
|
108 |
+
/**
|
109 |
+
* Plugin hook to load compat layers.
|
110 |
+
*
|
111 |
+
* @since 2.0
|
112 |
+
*/
|
113 |
+
function instant_articles_load_compat() {
|
114 |
+
require_once __DIR__ . '/compat.php';
|
115 |
+
}
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
+
add_action( 'init', 'instant_articles_init' );
|
118 |
+
/**
|
119 |
+
* Register our special feed.
|
120 |
+
*
|
121 |
+
* @since 0.1
|
122 |
+
*/
|
123 |
+
function instant_articles_init() {
|
124 |
+
add_feed( INSTANT_ARTICLES_SLUG, 'instant_articles_feed' );
|
125 |
+
}
|
126 |
|
127 |
+
/**
|
128 |
+
* Feed display callback.
|
129 |
+
*
|
130 |
+
* @since 0.1
|
131 |
+
*/
|
132 |
+
function instant_articles_feed() {
|
|
|
|
|
|
|
133 |
|
134 |
+
// Load the feed template.
|
135 |
+
include( __DIR__ . '/feed-template.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
+
/**
|
140 |
+
* Whether currently processing an instant article.
|
141 |
+
*
|
142 |
+
* @param bool Set the status
|
143 |
+
*
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
+
function is_transforming_instant_article( $set_status = null ) {
|
147 |
+
static $is_instant_article = false;
|
148 |
|
149 |
+
if ( isset( $set_status ) ) {
|
150 |
+
$is_instant_article = (bool) $set_status;
|
151 |
+
}
|
|
|
|
|
|
|
152 |
|
153 |
+
return $is_instant_article;
|
154 |
+
}
|
155 |
|
156 |
+
add_action( 'pre_get_posts', 'instant_articles_query', 10, 1 );
|
157 |
+
/**
|
158 |
+
* Modify the main query for our feed.
|
159 |
+
*
|
160 |
+
* We want the posts in the modified order, to provide Facebook with content updates even for older posts.
|
161 |
+
* Facebook will only import 100 posts at the time.
|
162 |
+
* Facebook will only update posts modified within the last 24 hours
|
163 |
+
*
|
164 |
+
* @param WP_Query $query The WP_Query object. Passed by reference.
|
165 |
+
*/
|
166 |
+
function instant_articles_query( $query ) {
|
167 |
+
|
168 |
+
if ( $query->is_main_query() && $query->is_feed( INSTANT_ARTICLES_SLUG ) ) {
|
169 |
+
|
170 |
+
$query->set( 'orderby', 'modified' );
|
171 |
+
$query->set( 'posts_per_page', 10 );
|
172 |
+
$query->set( 'posts_per_rss', 10 );
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Filter the post types to include in the query.
|
176 |
+
*
|
177 |
+
* Default to `post` only, but allow other post types to be included by the theme/plugins.
|
178 |
+
*
|
179 |
+
* @since 2.12
|
180 |
+
*
|
181 |
+
* @param array $post_types Array of post types
|
182 |
+
*/
|
183 |
+
$post_types = apply_filters( 'instant_articles_post_types', array( 'post' ) );
|
184 |
+
$query->set( 'post_type', $post_types );
|
185 |
+
|
186 |
+
/**
|
187 |
+
* If the constant INSTANT_ARTICLES_LIMIT_POSTS is set to true, we will limit the feed
|
188 |
+
* to only include posts which are modified within the last 24 hours.
|
189 |
+
* Facebook will initially need 100 posts to pass the review, but will only update
|
190 |
+
* already imported articles if they are modified within the last 24 hours.
|
191 |
+
*/
|
192 |
+
if ( defined( 'INSTANT_ARTICLES_LIMIT_POSTS' ) && INSTANT_ARTICLES_LIMIT_POSTS ) {
|
193 |
+
$query->set( 'date_query', array(
|
194 |
+
array(
|
195 |
+
'column' => 'post_modified',
|
196 |
+
'after' => '1 day ago',
|
197 |
+
),
|
198 |
+
) );
|
199 |
+
}
|
200 |
}
|
201 |
+
}
|
202 |
|
203 |
+
add_filter( 'posts_where' , 'instant_articles_query_where', 10, 2 );
|
204 |
+
/**
|
205 |
+
* Filter the SQL query to not include posts with empty content -- FB will complain.
|
206 |
+
*
|
207 |
+
* @since 0.1
|
208 |
+
*
|
209 |
+
* @param string $where The original where part of the SQL statement.
|
210 |
+
* @param WP_Query $query The WP_Query instance.
|
211 |
+
* @return string The modified where part of the SQL statement.
|
212 |
+
*
|
213 |
+
*/
|
214 |
+
function instant_articles_query_where( $where, $query ) {
|
215 |
|
216 |
+
// Don’t modify the SQL query with a potentially expensive WHERE clause if we’re OK with fewer posts than 100 and are OK with filtering in the loop.
|
217 |
+
if ( defined( 'INSTANT_ARTICLES_LIMIT_POSTS' ) && INSTANT_ARTICLES_LIMIT_POSTS ) {
|
218 |
+
return $where;
|
219 |
}
|
220 |
|
221 |
+
if ( $query->is_main_query() && $query->is_feed( INSTANT_ARTICLES_SLUG ) ) {
|
222 |
+
global $wpdb;
|
223 |
+
$where .= " AND {$wpdb->posts}.post_content NOT LIKE ''";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
225 |
+
return $where;
|
226 |
|
227 |
+
}
|
228 |
|
229 |
+
add_action( 'init', 'instant_articles_register_scripts' );
|
230 |
+
/**
|
231 |
+
* Register all scripts and styles for the admin UI.
|
232 |
+
*
|
233 |
+
* @since 0.4
|
234 |
+
*/
|
235 |
+
function instant_articles_register_scripts() {
|
236 |
+
wp_register_style(
|
237 |
+
'instant-articles-meta-box',
|
238 |
+
plugins_url( '/css/instant-articles-meta-box.css', __FILE__ ),
|
239 |
+
null,
|
240 |
+
IA_PLUGIN_VERSION,
|
241 |
+
false
|
242 |
+
);
|
243 |
+
wp_register_style(
|
244 |
+
'instant-articles-settings',
|
245 |
+
plugins_url( '/css/instant-articles-settings.css', __FILE__ ),
|
246 |
+
null,
|
247 |
+
IA_PLUGIN_VERSION,
|
248 |
+
false
|
249 |
+
);
|
250 |
+
wp_register_style(
|
251 |
+
'instant-articles-wizard',
|
252 |
+
plugins_url( '/css/instant-articles-wizard.css', __FILE__ ),
|
253 |
+
null,
|
254 |
+
IA_PLUGIN_VERSION,
|
255 |
+
false
|
256 |
+
);
|
257 |
+
wp_register_style(
|
258 |
+
'instant-articles-index-column',
|
259 |
+
plugins_url( '/css/instant-articles-index-column.css', __FILE__ ),
|
260 |
+
null,
|
261 |
+
IA_PLUGIN_VERSION,
|
262 |
+
false
|
263 |
+
);
|
264 |
|
265 |
+
wp_register_script(
|
266 |
+
'instant-articles-meta-box',
|
267 |
+
plugins_url( '/js/instant-articles-meta-box.js', __FILE__ ),
|
268 |
+
null,
|
269 |
+
IA_PLUGIN_VERSION,
|
270 |
+
false
|
271 |
+
);
|
272 |
+
wp_register_script(
|
273 |
+
'instant-articles-option-ads',
|
274 |
+
plugins_url( '/js/instant-articles-option-ads.js', __FILE__ ),
|
275 |
+
null,
|
276 |
+
IA_PLUGIN_VERSION,
|
277 |
+
false
|
278 |
+
);
|
279 |
+
wp_register_script(
|
280 |
+
'instant-articles-option-analytics',
|
281 |
+
plugins_url( '/js/instant-articles-option-analytics.js', __FILE__ ),
|
282 |
+
null,
|
283 |
+
IA_PLUGIN_VERSION,
|
284 |
+
false
|
285 |
+
);
|
286 |
+
wp_register_script(
|
287 |
+
'instant-articles-option-publishing',
|
288 |
+
plugins_url( '/js/instant-articles-option-publishing.js', __FILE__ ),
|
289 |
+
null,
|
290 |
+
IA_PLUGIN_VERSION,
|
291 |
+
false
|
292 |
+
);
|
293 |
+
wp_register_script(
|
294 |
+
'instant-articles-settings',
|
295 |
+
plugins_url( '/js/instant-articles-settings.js', __FILE__ ),
|
296 |
+
null,
|
297 |
+
IA_PLUGIN_VERSION,
|
298 |
+
false
|
299 |
+
);
|
300 |
+
}
|
301 |
|
302 |
+
add_action( 'admin_enqueue_scripts', 'instant_articles_enqueue_scripts' );
|
303 |
+
/**
|
304 |
+
* Enqueue all scripts and styles for the admin UI.
|
305 |
+
*
|
306 |
+
* @since 0.4
|
307 |
+
*/
|
308 |
+
function instant_articles_enqueue_scripts() {
|
309 |
+
wp_enqueue_style( 'instant-articles-meta-box' );
|
310 |
+
wp_enqueue_style( 'instant-articles-settings-wizard' );
|
311 |
+
wp_enqueue_style( 'instant-articles-settings' );
|
312 |
+
wp_enqueue_style( 'instant-articles-wizard' );
|
313 |
+
wp_enqueue_style( 'instant-articles-index-column' );
|
314 |
+
|
315 |
+
wp_enqueue_script( 'instant-articles-meta-box' );
|
316 |
+
wp_enqueue_script( 'instant-articles-option-ads' );
|
317 |
+
wp_enqueue_script( 'instant-articles-option-analytics' );
|
318 |
+
wp_enqueue_script( 'instant-articles-option-publishing' );
|
319 |
+
wp_enqueue_script( 'instant-articles-settings' );
|
320 |
+
wp_enqueue_script( 'instant-articles-wizard' );
|
321 |
+
}
|
322 |
|
323 |
+
add_action( 'wp_head', 'inject_url_claiming_meta_tag' );
|
324 |
+
/**
|
325 |
+
* Automatically add meta tag for Instant Articles URL claiming
|
326 |
+
* when page is set.
|
327 |
+
*
|
328 |
+
* @since 0.4
|
329 |
+
*/
|
330 |
+
function inject_url_claiming_meta_tag() {
|
331 |
+
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
332 |
+
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
333 |
+
|
334 |
+
if ( isset( $fb_page_settings[ 'page_id' ] ) ) {
|
335 |
+
?>
|
336 |
+
<meta property="fb:pages" content="<?php echo esc_attr( $fb_page_settings[ 'page_id' ] ); ?>" />
|
337 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
}
|
339 |
+
}
|
340 |
|
341 |
+
add_action( 'wp_head', 'inject_ia_markup_meta_tag' );
|
342 |
+
/**
|
343 |
+
* Automatically add meta tag for Instant Articles Open Publish scraper
|
344 |
+
*
|
345 |
+
* @since 4.0
|
346 |
+
*/
|
347 |
+
function inject_ia_markup_meta_tag() {
|
348 |
+
$post = get_post();
|
349 |
+
|
350 |
+
// If there's no current post, return
|
351 |
+
if ( ! $post ) {
|
352 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
|
|
354 |
|
355 |
+
// Transform the post to an Instant Article.
|
356 |
+
$adapter = new Instant_Articles_Post( $post );
|
357 |
+
if ( $adapter->should_submit_post() ) {
|
358 |
+
$url = $adapter->get_canonical_url();
|
359 |
+
$url = add_query_arg( 'ia_markup', '1', $url );
|
|
|
|
|
|
|
360 |
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
361 |
+
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
362 |
+
$dev_mode = isset( $publishing_settings['dev_mode'] )
|
363 |
+
? ( $publishing_settings['dev_mode'] ? true : false )
|
364 |
+
: false;
|
365 |
|
366 |
+
if ( $dev_mode ) {
|
367 |
+
?>
|
368 |
+
<meta property="ia:markup_url_dev" content="<?php echo esc_attr( $url ); ?>" />
|
369 |
+
<?php
|
370 |
+
} else {
|
371 |
?>
|
372 |
+
<meta property="ia:markup_url" content="<?php echo esc_attr( $url ); ?>" />
|
373 |
<?php
|
374 |
}
|
375 |
}
|
376 |
+
}
|
377 |
|
378 |
+
// Injects the <link rel...> tag if the AMP Markup is enabled
|
379 |
+
add_action( 'wp_head', array('Instant_Articles_AMP_Markup', 'inject_link_rel' ) );
|
380 |
+
|
381 |
+
// Initialize the Instant Articles meta box.
|
382 |
+
Instant_Articles_Meta_Box::init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
|
384 |
+
add_action( 'wp', 'ia_markup_version' );
|
385 |
+
function ia_markup_version( ) {
|
386 |
+
$post = get_post();
|
387 |
+
|
388 |
+
if (isset( $_GET[ 'ia_markup' ] ) && $_GET[ 'ia_markup' ]) {
|
389 |
// Transform the post to an Instant Article.
|
390 |
$adapter = new Instant_Articles_Post( $post );
|
391 |
+
$article = $adapter->to_instant_article();
|
392 |
+
echo $article->render( null, true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
|
394 |
+
die();
|
395 |
+
}
|
396 |
+
}
|
397 |
|
|
|
|
|
398 |
|
399 |
+
// Add hook for generating the AMP markup
|
400 |
+
add_action( 'wp', array('Instant_Articles_AMP_Markup', 'markup_version' ) );
|
401 |
|
402 |
+
Instant_Articles_Wizard::init();
|
403 |
+
Instant_Articles_Signer::init();
|
|
|
|
|
|
|
404 |
|
405 |
+
add_action( 'save_post', 'invalidate_post_transformation_info_cache', 10, 2 );
|
406 |
+
function invalidate_post_transformation_info_cache( $post_id, $post ) {
|
407 |
+
// These post metas are caches on the calculations made to decide if
|
408 |
+
// a post is in good state to be converted to an Instant Article or not
|
409 |
+
delete_post_meta( $post_id, '_has_warnings_after_transformation' );
|
410 |
+
delete_post_meta( $post_id, '_is_empty_after_transformation' );
|
411 |
+
}
|
|
|
|
|
|
|
412 |
|
413 |
+
add_action( 'updated_option', 'invalidate_all_posts_transformation_info_cache', 10, 1 );
|
414 |
+
// We also need to invalidate the transformation caches when the option containing
|
415 |
+
// the custom transformer rules is updated
|
416 |
+
function invalidate_all_posts_transformation_info_cache( $option ) {
|
417 |
+
if ( $option === Instant_Articles_Option_Publishing::OPTION_KEY ) {
|
418 |
// These post metas are caches on the calculations made to decide if
|
419 |
// a post is in good state to be converted to an Instant Article or not
|
420 |
+
delete_post_meta_by_key( '_has_warnings_after_transformation' );
|
421 |
+
delete_post_meta_by_key( '_is_empty_after_transformation' );
|
422 |
}
|
423 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
|
425 |
+
add_filter( 'manage_posts_columns', 'fbia_indicator_column_heading' );
|
426 |
+
function fbia_indicator_column_heading( $columns ) {
|
427 |
+
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
428 |
+
$display_warning_column = isset( $publishing_settings[ 'display_warning_column' ] ) ? $publishing_settings[ 'display_warning_column' ] : '0';
|
429 |
|
430 |
+
if( "1" === $display_warning_column ) {
|
431 |
+
$columns[ 'FBIA' ] = "<span title='Facebook Instant Article Distribution Status' class='fbia-col-heading'>FB IA Status</span>";
|
|
|
|
|
432 |
}
|
433 |
+
return $columns;
|
434 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
|
436 |
+
add_action( 'manage_posts_custom_column', 'fbia_indication_column', 10, 2 );
|
437 |
+
function fbia_indication_column( $column_name, $post_ID ) {
|
438 |
+
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
439 |
+
$display_warning_column = isset( $publishing_settings[ 'display_warning_column' ] ) ? $publishing_settings[ 'display_warning_column' ] : '0';
|
440 |
|
441 |
+
if( "1" === $display_warning_column ) {
|
442 |
+
$red_light = '<span title="Instant article is empty after transformation." class="instant-articles-col-status error"></span>';
|
443 |
|
444 |
+
$yellow_light = '<span title="Instant article has warnings after transformation." class="instant-articles-col-status warning"></span>';
|
|
|
|
|
445 |
|
446 |
+
$green_light = '<span title="Instant article transformed successfully." class="instant-articles-col-status ok"></span>';
|
|
|
|
|
|
|
|
|
447 |
|
448 |
+
if ( $column_name === "FBIA" ) {
|
449 |
+
$post = get_post( $post_ID );
|
450 |
+
$instant_articles_post = new \Instant_Articles_Post( $post );
|
|
|
|
|
451 |
|
452 |
+
$is_empty = $instant_articles_post->is_empty_after_transformation();
|
453 |
+
if ( true === $is_empty ) {
|
454 |
+
echo wp_kses_post( $red_light );
|
455 |
+
return;
|
456 |
+
}
|
457 |
|
458 |
+
$has_warnings = $instant_articles_post->has_warnings_after_transformation();
|
459 |
+
if ( true === $has_warnings ) {
|
460 |
+
echo wp_kses_post( $yellow_light );
|
461 |
return;
|
462 |
}
|
463 |
+
|
464 |
+
echo wp_kses_post( $green_light );
|
465 |
+
|
466 |
+
return;
|
467 |
}
|
468 |
}
|
469 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
|
471 |
+
add_action( 'post_updated', 'invalidate_scrape_on_update', 10, 3 );
|
472 |
+
function invalidate_scrape_on_update( $post_ID, $post_after, $post_before ) {
|
473 |
+
$adapter = new Instant_Articles_Post( $post_after );
|
474 |
+
if ( $adapter->should_submit_post() ) {
|
475 |
+
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
476 |
+
if (
|
477 |
+
( isset( $fb_app_settings[ 'page_access_token' ] ) && $fb_app_settings[ 'page_access_token' ] ) &&
|
478 |
+
( isset( $fb_app_settings[ 'app_id' ] ) && $fb_app_settings[ 'app_id' ] ) &&
|
479 |
+
( isset( $fb_app_settings[ 'app_secret' ] ) && $fb_app_settings[ 'app_secret' ] )
|
480 |
+
) {
|
481 |
+
// Fetches the right URL to invalidate
|
482 |
+
$url = $adapter->get_canonical_url();
|
483 |
|
484 |
+
// oAuth info
|
485 |
+
$app_id = $fb_app_settings[ 'app_id' ];
|
486 |
+
$app_secret = $fb_app_settings[ 'app_secret' ];
|
487 |
+
$access_token = $fb_app_settings[ 'page_access_token' ];
|
488 |
|
489 |
+
// Build Graph SDK instance
|
490 |
+
$fb = new \Facebook\Facebook([
|
491 |
+
'app_id' => $app_id,
|
492 |
+
'app_secret' => $app_secret,
|
493 |
+
'default_access_token' => $access_token
|
494 |
+
]);
|
495 |
|
496 |
+
function admin_notice__scrape_invalidation_failed() {
|
497 |
+
?>
|
498 |
+
<div class="notice notice-error is-dismissible">
|
499 |
+
<p>
|
500 |
+
<?php _e( 'It was not possible to automatically invalidate the scrape for this article.', 'instant-articles' ) ?>
|
501 |
+
<?php _e( 'Please trigger a new scrape manually using the Facebook Share Debugger.', 'instant-articles' ) ?>
|
502 |
+
</p>
|
503 |
+
</div>
|
504 |
+
<?php
|
505 |
+
}
|
506 |
|
507 |
+
function admin_notice__scrape_invalidation_success() {
|
508 |
+
?>
|
509 |
+
<div class="notice notice-success is-dismissible">
|
510 |
+
<p>
|
511 |
+
<?php _e( 'Successfully refreshed the Instant Articles cache for this article.', 'instant-articles' ) ?>
|
512 |
+
</p>
|
513 |
+
</div>
|
514 |
+
<?php
|
515 |
+
}
|
516 |
|
|
|
|
|
517 |
|
518 |
+
// Make call
|
519 |
+
$graph_api_call = '/';
|
520 |
+
$graph_api_call = add_query_arg( 'id', rawurlencode($url), $graph_api_call);
|
521 |
+
$graph_api_call = add_query_arg( 'scrape', 'true', $graph_api_call);
|
522 |
+
|
523 |
+
try {
|
524 |
+
$fb->post( $graph_api_call, [], $access_token );
|
525 |
+
add_action( 'admin_notices', 'admin_notice__scrape_invalidation_success' );
|
526 |
+
|
527 |
+
} catch(Facebook\Exceptions\FacebookResponseException $e) {
|
528 |
+
echo '<pre>';
|
529 |
+
print_r($e->getTraceAsString());
|
530 |
+
|
531 |
+
add_action( 'admin_notices', 'admin_notice__scrape_invalidation_failed' );
|
532 |
+
} catch(Facebook\Exceptions\FacebookSDKException $e) {
|
533 |
+
|
534 |
+
add_action( 'admin_notices', 'admin_notice__scrape_invalidation_failed' );
|
535 |
}
|
536 |
}
|
537 |
}
|
538 |
+
}
|
539 |
|
540 |
+
add_action( 'save_post', 'rescrape_article', 999, 2 );
|
541 |
+
function rescrape_article( $post_id, $post ) {
|
542 |
+
$adapter = new Instant_Articles_Post( $post );
|
543 |
+
$old_slugs = get_post_meta( $post_id, '_wp_old_slug' );
|
544 |
+
if ( $adapter->should_submit_post() ) {
|
545 |
+
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
546 |
+
if (
|
547 |
+
( isset( $fb_app_settings[ 'page_access_token' ] ) && $fb_app_settings[ 'page_access_token' ] ) &&
|
548 |
+
( isset( $fb_app_settings[ 'app_id' ] ) && $fb_app_settings[ 'app_id' ] ) &&
|
549 |
+
( isset( $fb_app_settings[ 'app_secret' ] ) && $fb_app_settings[ 'app_secret' ] )
|
550 |
+
) {
|
551 |
+
// Defer to access_token if configured to ensure backwards compatibility
|
552 |
+
return;
|
553 |
+
}
|
554 |
|
555 |
+
try {
|
556 |
+
if ( extension_loaded('openssl') ) {
|
557 |
+
$client = Facebook\HttpClients\HttpClientsFactory::createHttpClient( null );
|
558 |
+
$url_encoded = urlencode($adapter->get_canonical_url());
|
559 |
+
$client->send(
|
560 |
+
Instant_Articles_Signer::sign_request_path(
|
561 |
+
"https://graph.facebook.com/?id=$url_encoded&scrape=true"
|
562 |
+
),
|
563 |
+
'POST',
|
564 |
+
'',
|
565 |
+
array(),
|
566 |
+
60
|
567 |
+
);
|
568 |
+
foreach ( $old_slugs as $slug ) {
|
569 |
+
$clone_post = clone $post;
|
570 |
+
$clone_post->post_name = $slug;
|
571 |
+
$clone_adapter = new Instant_Articles_Post( $clone_post );
|
572 |
+
|
573 |
+
$url_encoded = urlencode($clone_adapter->get_canonical_url());
|
574 |
$client->send(
|
575 |
Instant_Articles_Signer::sign_request_path(
|
576 |
"https://graph.facebook.com/?id=$url_encoded&scrape=true"
|
580 |
array(),
|
581 |
60
|
582 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
}
|
|
|
|
|
584 |
}
|
585 |
+
} catch ( Exception $e ) {
|
586 |
+
error_log( 'Unable to submit article.'.$e->getTraceAsString() );
|
587 |
}
|
588 |
}
|
|
|
|
|
589 |
}
|
js/instant-articles-wizard.js
DELETED
@@ -1,135 +0,0 @@
|
|
1 |
-
function instant_articles_wizard_load ( data ) {
|
2 |
-
jQuery( '#instant_articles_wizard' ).addClass( 'loading' );
|
3 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
4 |
-
jQuery( '#instant_articles_wizard' ).html( response );
|
5 |
-
instant_articles_wizard_bind_events();
|
6 |
-
jQuery( '#instant_articles_wizard' ).removeClass( 'loading' );
|
7 |
-
window.scrollTo(0, 0);
|
8 |
-
}, 'html' );
|
9 |
-
}
|
10 |
-
|
11 |
-
function instant_articles_wizard_transition ( new_state, params ) {
|
12 |
-
instant_articles_wizard_load ( {
|
13 |
-
'action': 'instant_articles_wizard_transition',
|
14 |
-
'new_state': new_state,
|
15 |
-
'params': JSON.stringify(params)
|
16 |
-
} );
|
17 |
-
}
|
18 |
-
|
19 |
-
function instant_articles_wizard_save_app ( app_id, app_secret ) {
|
20 |
-
instant_articles_wizard_load ( {
|
21 |
-
'action': 'instant_articles_wizard_save_app',
|
22 |
-
'app_id': app_id,
|
23 |
-
'app_secret': app_secret
|
24 |
-
} );
|
25 |
-
}
|
26 |
-
|
27 |
-
function instant_articles_wizard_edit_app () {
|
28 |
-
instant_articles_wizard_load ( {
|
29 |
-
'action': 'instant_articles_wizard_edit_app',
|
30 |
-
} );
|
31 |
-
}
|
32 |
-
|
33 |
-
|
34 |
-
function instant_articles_wizard_submit_for_review () {
|
35 |
-
instant_articles_wizard_load ( {
|
36 |
-
'action': 'instant_articles_wizard_submit_for_review',
|
37 |
-
} );
|
38 |
-
}
|
39 |
-
|
40 |
-
function instant_articles_wizard_bind_events () {
|
41 |
-
|
42 |
-
jQuery( '#instant_articles_wizard a' ).on( 'click', function () {
|
43 |
-
if ( ! jQuery( this ).attr( 'target' ) ) {
|
44 |
-
jQuery( '#instant_articles_wizard' ).addClass( 'loading' );
|
45 |
-
}
|
46 |
-
});
|
47 |
-
|
48 |
-
jQuery( '.instant-articles-wizard-transition' ).on( 'click', function () {
|
49 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
50 |
-
return false;
|
51 |
-
}
|
52 |
-
instant_articles_wizard_transition( jQuery( this ).attr( 'data-new-state' ) );
|
53 |
-
});
|
54 |
-
|
55 |
-
jQuery('input[name=app_id], input[name=app_secret]').on( 'change', function () {
|
56 |
-
var app_id = jQuery('input[name=app_id]').val();
|
57 |
-
var app_secret = jQuery('input[name=app_secret]').val();
|
58 |
-
if (app_id && app_secret) {
|
59 |
-
jQuery( '#instant-articles-wizard-save-app' ).removeClass( 'instant-articles-button-disabled' );
|
60 |
-
}
|
61 |
-
else {
|
62 |
-
jQuery( '#instant-articles-wizard-save-app' ).addClass( 'instant-articles-button-disabled' );
|
63 |
-
}
|
64 |
-
});
|
65 |
-
|
66 |
-
jQuery('input[name=page_id]').on( 'change', function () {
|
67 |
-
var input = jQuery( this );
|
68 |
-
var page_id = jQuery('input[name=page_id]:checked').val();
|
69 |
-
var signed_up = ( jQuery('input[name=page_id]:checked').attr( 'data-signed-up' ) === 'yes' );
|
70 |
-
if ( page_id && signed_up ) {
|
71 |
-
jQuery( '#instant-articles-wizard-select-page' ).removeClass( 'instant-articles-button-disabled' );
|
72 |
-
}
|
73 |
-
else {
|
74 |
-
jQuery( '#instant-articles-wizard-select-page' ).addClass( 'instant-articles-button-disabled' );
|
75 |
-
}
|
76 |
-
});
|
77 |
-
|
78 |
-
jQuery( '#instant-articles-wizard-save-app' ).on( 'click', function () {
|
79 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
80 |
-
return false;
|
81 |
-
}
|
82 |
-
var app_id = jQuery('input[name=app_id]').val();
|
83 |
-
var app_secret = jQuery('input[name=app_secret]').val();
|
84 |
-
instant_articles_wizard_save_app( app_id, app_secret );
|
85 |
-
});
|
86 |
-
|
87 |
-
jQuery( '#instant-articles-wizard-edit-app' ).on( 'click', function () {
|
88 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
89 |
-
return false;
|
90 |
-
}
|
91 |
-
instant_articles_wizard_edit_app();
|
92 |
-
});
|
93 |
-
|
94 |
-
jQuery( '#instant-articles-wizard-submit-for-review' ).on( 'click', function () {
|
95 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
96 |
-
return false;
|
97 |
-
}
|
98 |
-
instant_articles_wizard_submit_for_review();
|
99 |
-
});
|
100 |
-
|
101 |
-
jQuery( '#instant-articles-wizard-select-page' ).on( 'click', function () {
|
102 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
103 |
-
return false;
|
104 |
-
}
|
105 |
-
var page_id = jQuery('input[name=page_id]:checked').val();
|
106 |
-
instant_articles_wizard_transition( 'STATE_STYLE_SELECTION', { page_id: page_id } );
|
107 |
-
});
|
108 |
-
|
109 |
-
jQuery( '#instant-articles-wizard-customize-style' ).on( 'click', function () {
|
110 |
-
jQuery( '#instant-articles-wizard-customize-style-next' ).show();
|
111 |
-
});
|
112 |
-
|
113 |
-
jQuery( '.instant-articles-card-content-box li' ).on( 'click', function () {
|
114 |
-
jQuery( '.instant-articles-card-content-box li.instant-articles-radio-selected' ).removeClass( 'instant-articles-radio-selected' );
|
115 |
-
jQuery( this ).find( 'input' ).attr( 'checked', 'checked' );
|
116 |
-
jQuery( this ).find( 'input' ).trigger( 'change' );
|
117 |
-
jQuery( this ).toggleClass( 'instant-articles-radio-selected' );
|
118 |
-
});
|
119 |
-
}
|
120 |
-
|
121 |
-
|
122 |
-
jQuery( document ).ready( function () {
|
123 |
-
instant_articles_wizard_bind_events();
|
124 |
-
|
125 |
-
jQuery( '.instant-articles-wizard-toggle a' ).on( 'click', function () {
|
126 |
-
$advancedSettingsContainer = jQuery( '.instant-articles-advanced-settings' );
|
127 |
-
if ( $advancedSettingsContainer.attr( 'data-state') === 'closed' ) {
|
128 |
-
$advancedSettingsContainer.attr( 'data-state', 'opened' );
|
129 |
-
}
|
130 |
-
else {
|
131 |
-
$advancedSettingsContainer.attr( 'data-state', 'closed' );
|
132 |
-
}
|
133 |
-
return false;
|
134 |
-
});
|
135 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
meta-box/meta-box-template.php
CHANGED
@@ -18,7 +18,7 @@ use Facebook\InstantArticles\Client\ServerMessage;
|
|
18 |
</a>
|
19 |
<?php endif; ?>
|
20 |
|
21 |
-
<?php if ( $adapter->should_submit_post()
|
22 |
<p>
|
23 |
<b>
|
24 |
<span class="dashicons dashicons-yes"></span>
|
18 |
</a>
|
19 |
<?php endif; ?>
|
20 |
|
21 |
+
<?php if ( $adapter->should_submit_post() ) : ?>
|
22 |
<p>
|
23 |
<b>
|
24 |
<span class="dashicons dashicons-yes"></span>
|
readme.txt
CHANGED
@@ -1,309 +1,331 @@
|
|
1 |
-
=== Instant Articles for WP ===
|
2 |
-
Contributors: trrine, olethomas, bjornjohansen, dekode, automattic,
|
3 |
-
Tags: instant
|
4 |
-
Requires at least: 4.
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
License
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
*
|
41 |
-
*
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
*
|
46 |
-
*
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
- [#
|
97 |
-
- [#
|
98 |
-
- [#
|
99 |
-
- [#
|
100 |
-
|
101 |
-
|
102 |
-
- [#
|
103 |
-
|
104 |
-
|
105 |
-
- [#
|
106 |
-
- [#
|
107 |
-
- [#
|
108 |
-
|
109 |
-
### 4.1
|
110 |
-
- [#
|
111 |
-
- [#
|
112 |
-
- [#
|
113 |
-
- [#
|
114 |
-
- [#
|
115 |
-
- [#
|
116 |
-
|
117 |
-
|
118 |
-
- [#
|
119 |
-
|
120 |
-
### 4.
|
121 |
-
- [#
|
122 |
-
- [#
|
123 |
-
- [#
|
124 |
-
|
125 |
-
|
126 |
-
- [#
|
127 |
-
- [#
|
128 |
-
- [#
|
129 |
-
|
130 |
-
|
131 |
-
- [#
|
132 |
-
|
133 |
-
|
134 |
-
- [#
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
- [#
|
139 |
-
|
140 |
-
|
141 |
-
- [#
|
142 |
-
- [#
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
- [#
|
148 |
-
|
149 |
-
### 4.0.
|
150 |
-
- [#
|
151 |
-
- [#
|
152 |
-
|
153 |
-
|
154 |
-
- [#
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
- [#
|
159 |
-
|
160 |
-
|
161 |
-
- [#
|
162 |
-
- [#
|
163 |
-
- [#
|
164 |
-
|
165 |
-
|
166 |
-
- [#
|
167 |
-
|
168 |
-
|
169 |
-
- [#
|
170 |
-
- [#
|
171 |
-
- [#
|
172 |
-
|
173 |
-
### 3.3.
|
174 |
-
- [#
|
175 |
-
- [#
|
176 |
-
- [#
|
177 |
-
- [#
|
178 |
-
- [#
|
179 |
-
- [#
|
180 |
-
- [#
|
181 |
-
- [#
|
182 |
-
- [#
|
183 |
-
|
184 |
-
### 3.3
|
185 |
-
- [#
|
186 |
-
- [#
|
187 |
-
- [#
|
188 |
-
|
189 |
-
### 3.
|
190 |
-
- [#
|
191 |
-
|
192 |
-
|
193 |
-
- [#
|
194 |
-
- [#
|
195 |
-
- [#
|
196 |
-
- [#
|
197 |
-
- [#
|
198 |
-
- [#
|
199 |
-
|
200 |
-
|
201 |
-
- [#
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
- [#
|
207 |
-
|
208 |
-
|
209 |
-
- [#
|
210 |
-
- [#
|
211 |
-
|
212 |
-
|
213 |
-
- [#
|
214 |
-
- [#
|
215 |
-
- [#
|
216 |
-
- [#
|
217 |
-
- [#
|
218 |
-
|
219 |
-
|
220 |
-
- [#
|
221 |
-
- [#
|
222 |
-
- [#
|
223 |
-
- [#
|
224 |
-
- [#
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
- [#
|
230 |
-
- [#
|
231 |
-
- [#
|
232 |
-
- [#
|
233 |
-
- [#
|
234 |
-
- [#
|
235 |
-
- [#
|
236 |
-
- [#
|
237 |
-
- [#
|
238 |
-
- [#
|
239 |
-
- [#
|
240 |
-
- [#
|
241 |
-
|
242 |
-
|
243 |
-
- [#
|
244 |
-
|
245 |
-
|
246 |
-
- [#
|
247 |
-
- [#
|
248 |
-
|
249 |
-
|
250 |
-
- [#
|
251 |
-
- [#
|
252 |
-
- [#
|
253 |
-
- [#
|
254 |
-
- [#
|
255 |
-
- [#
|
256 |
-
- [#
|
257 |
-
- [#
|
258 |
-
- [#
|
259 |
-
- [#
|
260 |
-
|
261 |
-
|
262 |
-
- [#
|
263 |
-
- [#
|
264 |
-
|
265 |
-
|
266 |
-
- [#
|
267 |
-
- [#
|
268 |
-
- [#
|
269 |
-
- [#
|
270 |
-
- [#
|
271 |
-
- [#
|
272 |
-
|
273 |
-
|
274 |
-
- [#
|
275 |
-
- [#
|
276 |
-
- [#
|
277 |
-
- [#
|
278 |
-
|
279 |
-
|
280 |
-
- [#
|
281 |
-
- [#
|
282 |
-
- [#
|
283 |
-
|
284 |
-
|
285 |
-
- [#
|
286 |
-
- [#
|
287 |
-
- [#
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
- [#
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
- [#
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
- [#
|
302 |
-
|
303 |
-
|
304 |
-
- [#
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
- [#
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Instant Articles for WP ===
|
2 |
+
Contributors: trrine, olethomas, bjornjohansen, dekode, GaryJ, automattic, fb
|
3 |
+
Tags: instant-articles, fb, mobile, instant articles
|
4 |
+
Requires at least: 4.7
|
5 |
+
Requires PHP: 7.1
|
6 |
+
Tested up to: 6.0.2
|
7 |
+
Stable tag: 5.0.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Enable Instant Articles for Facebook on your WordPress site.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
This plugin adds support for Instant Articles for Facebook, which is a new way for publishers to distribute fast, interactive stories on Facebook. Instant Articles are preloaded in the Facebook mobile app so they load instantly.
|
16 |
+
|
17 |
+
With the plugin active, a new menu will be available for you to connect to your Facebook Page and start publishing your Instant Articles. You'll also see the status of each Instant Articles submission on the edit page of your posts.
|
18 |
+
|
19 |
+
A best effort is made to generate valid Instant Article markup from your posts' content/metadata and publish it to Facebook. The plugin knows how to transform your posts' markup from a set of rules which forms a mapping between elements in you *source markup* and the valid *Instant Article components*. We refer to this “glue” between the two as the ***Transformer Rules***.
|
20 |
+
|
21 |
+
Built-in to the plugin are many [pre-defined transformer rules](https://github.com/Automattic/fb-instant-articles/blob/master/rules-configuration.json) which aims to cover standard WordPress installations. If your WordPress content contains elements which are not covered by the built-in ruleset, you can define your own additional rules to extend or override the defaults in the Settings of this plugin, under: **Plugin Configuration** > **Publishing Settings** > **Custom transformer rules**.
|
22 |
+
|
23 |
+
= Access to Instant Articles =
|
24 |
+
|
25 |
+
The current criteria for access to Instant Articles are:
|
26 |
+
- your Facebook Page must have an established presence of at least 90 days
|
27 |
+
- your content adheres to the [Instant Article Policies](https://developers.facebook.com/docs/instant-articles/policy/)
|
28 |
+
|
29 |
+
Before your Instant Articles can be published on Facebook, your feed must undergo an initial review and approval. Facebook requires a minimum number of 10 articles in your feed before being eligible for review. The review process checks that your draft Instant Articles are properly formatted, have content consistency with their mobile web counterparts, and adhere to the [community standards](https://www.facebook.com/communitystandards/) and [content policies](https://www.facebook.com/help/publisher/1348682518563619).
|
30 |
+
|
31 |
+
It's important to note that if you use meta fields to add extra text, images or videos to your Posts, Facebook will expect you to add these to your Instant Articles output too. This plugin includes hooks to help you do that.
|
32 |
+
|
33 |
+
[See Facebook's documentation for full details of the submission process.](https://developers.facebook.com/docs/instant-articles)
|
34 |
+
|
35 |
+
Once your feed has been approved, new posts will automatically be taken live on Instant Articles, and existing posts will be taken live once you update them. In order to stay in the Instant Articles program, you must remain active by creating new content and maintaining a minimal readership.
|
36 |
+
|
37 |
+
== Installation ==
|
38 |
+
|
39 |
+
= From your WordPress dashboard =
|
40 |
+
* Visit 'Plugins > Add New'
|
41 |
+
* Search for 'Facebook Instant Articles for WP'
|
42 |
+
* Activate the plugin on your Plugins page
|
43 |
+
|
44 |
+
= From WordPress.org =
|
45 |
+
* Download Facebook Instant Articles for WP
|
46 |
+
* Upload the uncompressed directory to '/wp-content/plugins/'
|
47 |
+
* Activate the plugin on your Plugins page
|
48 |
+
|
49 |
+
= Once Activated =
|
50 |
+
* Click on the 'Instant Articles' menu and follow the instructions to activate the plugin
|
51 |
+
|
52 |
+
== Frequently Asked Questions ==
|
53 |
+
|
54 |
+
= Why is there content from my post missing in the generated Instant Article? =
|
55 |
+
|
56 |
+
More likely than not, this is because there is markup in the body of your post that is not mapped to a recognized Instant Article component. On the “Edit Post” screen for your post, look for additional information about the *transformed* output shown within the **Facebook Instant Articles** module located at the bottom of the screen.
|
57 |
+
|
58 |
+
= In the Instant Articles module for my post, what does the “This post was transformed into an Instant Article with some warnings” message mean? =
|
59 |
+
|
60 |
+
When transforming your post into an Instant Article, this plugin will show warnings when it encounters content which might not be valid when published to Facebook. When you see this message, it is recommended to resolve each warning individually.
|
61 |
+
|
62 |
+
= What does the “No rules defined for ____ in the context of ____” warning mean? =
|
63 |
+
|
64 |
+
This plugin transforms your post into an Instant Article by matching markup in your content to one of the [components available](https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/docs/QuickStart.md#transformer-classes) in Instant Articles markup. Although the plugin contains many [built-in rules](https://github.com/Automattic/fb-instant-articles/blob/master/rules-configuration.json) to handle common cases, there may be markup in your post which is not recognized by these existing rules. In this case, you may be required to define some of your own rules. See below for more details about where and how.
|
65 |
+
|
66 |
+
= How do I define my own transformer rules so that content from my site is rendered appropriately in an Instant Article? =
|
67 |
+
|
68 |
+
Your custom rules can be defined in the Settings of this plugin, under: **Plugin Configuration** > **Publishing Settings** > **Custom transformer rules**. More detailed instructions about all the options available is documented in the [Custom Transformer Rules](https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/docs/QuickStart.md#custom-transformer-rules) section of the Facebook Instant Articles SDK.
|
69 |
+
|
70 |
+
= I know of a custom transformer rule which is pretty common in the community. How can it be included by default in the plugin? =
|
71 |
+
|
72 |
+
You can propose popular transformer rules to be included in the plugin by [suggesting it on GitHub](https://github.com/Automattic/fb-instant-articles/issues/new).
|
73 |
+
|
74 |
+
= How do I post articles to Instant Articles after plugin is installed? =
|
75 |
+
|
76 |
+
You can re-publish existing articles (simply edit + save) or post new articles in order to submit them to Instant Articles. After you have 10 articles added, you will be able to submit them for review.
|
77 |
+
|
78 |
+
= How do I change the feed slug/URL if I'm using the RSS integration? =
|
79 |
+
|
80 |
+
To change the feed slug, set the constant INSTANT_ARTICLES_SLUG to whatever you like. If you do, remember to flush the rewrite rules afterwards.
|
81 |
+
By default it is set to `instant-articles` which usually will give you a feed URL set to `/feed/instant-articles`
|
82 |
+
|
83 |
+
= How do I flush the rewrite rules after changing the feed slug? =
|
84 |
+
|
85 |
+
Usually simply visiting the permalinks settings page in the WordPress dashboard will do the trick (/wp-admin/options-permalink.php)
|
86 |
+
|
87 |
+
== Screenshots ==
|
88 |
+
|
89 |
+
1. Customized transformer rules enabled on the main Settings page. The particular configuration shown here would cause `<u>` and `<bold>` tags in the source markup to be rendered in *italics* and **bold**, respectively, in the generated Instant Article.
|
90 |
+
|
91 |
+
== Changelog ==
|
92 |
+
### 5.0.0 - 2022-10-18
|
93 |
+
**Minimum PHP requirement is increased from PHP 5.4 to PHP 7.1.**
|
94 |
+
**Minimum WordPress requirement is increased from WP 4.3.0 to WP 4.7.0.**
|
95 |
+
|
96 |
+
- [#683](https://github.com/Automattic/fb-instant-articles/pull/683) Fix wizard option dynamic properties for PHP 8.2.
|
97 |
+
- [#831](https://github.com/Automattic/fb-instant-articles/pull/831) Fix the way filters are applied in get_cover_media().
|
98 |
+
- [#1025](https://github.com/Automattic/fb-instant-articles/pull/1025) Support for installing as Composer Package.
|
99 |
+
- [#1058](https://github.com/Automattic/fb-instant-articles/pull/1058) Allow post content caching to be disabled.
|
100 |
+
- [#1073](https://github.com/Automattic/fb-instant-articles/pull/1073) Update release.sh.
|
101 |
+
- [#1076](https://github.com/Automattic/fb-instant-articles/pull/1076) Reduce plugin's cache burden for remote requests.
|
102 |
+
- [#1082](https://github.com/Automattic/fb-instant-articles/pull/1082) Fix: pass the missing $post param to the get_the_excerpt filter.
|
103 |
+
- [#1092](https://github.com/Automattic/fb-instant-articles/pull/1092) Add support for PHP 8.
|
104 |
+
- [#1095](https://github.com/Automattic/fb-instant-articles/pull/1095) Add GitHub workflow to mark issues and PR as stale.
|
105 |
+
- [#1097](https://github.com/Automattic/fb-instant-articles/pull/1097) Actions: Remove separate PHP 8.2 composer install.
|
106 |
+
- [#1098](https://github.com/Automattic/fb-instant-articles/pull/1098) Improve tests.
|
107 |
+
- [#1099](https://github.com/Automattic/fb-instant-articles/pull/1099) Basic code maintenance improvements.
|
108 |
+
|
109 |
+
### 4.2.1 - 2020-06-10
|
110 |
+
- [#1049](https://github.com/automattic/fb-instant-articles/pull/1049) Add support for new guttenberg layout elements (@diegoquinteiro)
|
111 |
+
- [#1012](https://github.com/automattic/fb-instant-articles/pull/1012) update composer modules (@paulschreiber)
|
112 |
+
- [#1001](https://github.com/automattic/fb-instant-articles/pull/1001) Load functions which rely on `plugins_loaded` action hook in VIP Go environment (@paulschreiber)
|
113 |
+
- [#990](https://github.com/automattic/fb-instant-articles/pull/990) avoid undefined index error in $display_warning_column (@paulschreiber)
|
114 |
+
- [#1002](https://github.com/automattic/fb-instant-articles/pull/1002) add Comscore plugin (@paulschreiber)
|
115 |
+
- [#1007](https://github.com/automattic/fb-instant-articles/pull/1007) Update Facebook SDK versions (@paulschreiber)
|
116 |
+
|
117 |
+
### 4.2.0 - 2018-11-29
|
118 |
+
- [#997](https://github.com/automattic/fb-instant-articles/pull/997) Removed fields from deprecated feature to enable comments/likes/share from media content (@everton-rosario)
|
119 |
+
|
120 |
+
### 4.1.1 - 2018-07-17
|
121 |
+
- [#962](https://github.com/automattic/fb-instant-articles/pull/962) Updating description for the plugin on website (@Blakomen)
|
122 |
+
- [#1](https://github.com/automattic/fb-instant-articles/pull/1) Merging into local (@diegoquinteiro, @everton-rosario, @algmelo)
|
123 |
+
- [#957](https://github.com/automattic/fb-instant-articles/pull/957) Delete current transient with autoload=yes. (@everton-rosario, @algmelo)
|
124 |
+
|
125 |
+
### 4.1.0 2018-07-02
|
126 |
+
- [#937](https://github.com/automattic/fb-instant-articles/pull/937) Add token-less re-scrape with request signature (@diegoquinteiro)
|
127 |
+
- [#952](https://github.com/automattic/fb-instant-articles/pull/952) Updating description for the plugin (@Blakomen)
|
128 |
+
- [#910](https://github.com/automattic/fb-instant-articles/pull/910) Add PassThroughRule for Grammarly (@robbiet480)
|
129 |
+
- [#941](https://github.com/automattic/fb-instant-articles/pull/941) Add support for GTM4WP (@robbiet480)
|
130 |
+
- [#898](https://github.com/automattic/fb-instant-articles/pull/898) Added tranformation warning indicator column (@Kluny)
|
131 |
+
- [#904](https://github.com/automattic/fb-instant-articles/pull/904) Enables setup for updating/invalidating articles cache from Facebook scraper (@everton-rosario, @diegoquinteiro)
|
132 |
+
- [#896](https://github.com/automattic/fb-instant-articles/pull/896) feat(playbuzz): support for the next major playbuzz plugin version (@playbuzz)
|
133 |
+
- [#740](https://github.com/automattic/fb-instant-articles/pull/740) (wizard) Update wording about AMP markup gen (@Djiit)
|
134 |
+
- [#870](https://github.com/automattic/fb-instant-articles/pull/870) [bugfix] calling get_article_style to apply the style filter (@vkama)
|
135 |
+
|
136 |
+
### 4.0.6 - 2017-12-04
|
137 |
+
- [#814](https://github.com/automattic/fb-instant-articles/pull/814) Add default rule for Twitter blockquote (@pestevez)
|
138 |
+
- [#806](https://github.com/automattic/fb-instant-articles/pull/806) Clarify requirement of site connection in README (@pestevez)
|
139 |
+
- [#798](https://github.com/automattic/fb-instant-articles/pull/798) remove article rescrape code (@timjacobi)
|
140 |
+
- [#777](https://github.com/automattic/fb-instant-articles/pull/777) update instructions (@timjacobi)
|
141 |
+
- [#778](https://github.com/automattic/fb-instant-articles/pull/778) Add label definitions (@timjacobi)
|
142 |
+
- [#792](https://github.com/automattic/fb-instant-articles/pull/792) Change meta box and readme so user doesn't think IAs are actually submitted to Facebook (@timjacobi)
|
143 |
+
- [#797](https://github.com/automattic/fb-instant-articles/pull/797) Display error message if meta box can't be loaded (@timjacobi)
|
144 |
+
- [#775](https://github.com/automattic/fb-instant-articles/pull/775) Adds caching to instant_articles_embed_oembed_html (@emrikol)
|
145 |
+
|
146 |
+
### 4.0.5 - 2017-08-24
|
147 |
+
- [#750](https://github.com/automattic/fb-instant-articles/pull/750) Fix query limit and escaping on AMP generation (@diegoquinteiro)
|
148 |
+
|
149 |
+
### 4.0.4 - 2017-07-27
|
150 |
+
- [#738](https://github.com/automattic/fb-instant-articles/pull/738) Add changelog to script (@diegoquinteiro)
|
151 |
+
- [#737](https://github.com/automattic/fb-instant-articles/pull/737) Updates IA SDK to 1.6.2 and dependencies (@diegoquinteiro)
|
152 |
+
|
153 |
+
### 4.0.3 - 2017-07-20
|
154 |
+
- [#725](https://github.com/automattic/fb-instant-articles/pull/725) Restore the $current_blog global and fix the post ID reference (@kasparsd)
|
155 |
+
|
156 |
+
### 4.0.2 - 2017-06-30
|
157 |
+
- [#708](https://github.com/automattic/fb-instant-articles/pull/708) Do not process non-post pages. Fixes #707 (@diegoquinteiro)
|
158 |
+
- [#709](https://github.com/automattic/fb-instant-articles/pull/709) Add cache layer for avoiding transforming the article at page render (@diegoquinteiro)
|
159 |
+
|
160 |
+
### 4.0.1 - 2017-06-28
|
161 |
+
- [#706](https://github.com/automattic/fb-instant-articles/pull/706) Check for array index before using it (@diegoquinteiro)
|
162 |
+
- [#705](https://github.com/automattic/fb-instant-articles/pull/705) Enable deletion of JSON AMP Style and removes an undef index (@vkama)
|
163 |
+
- [#704](https://github.com/automattic/fb-instant-articles/pull/704) Fixed several php notices. Also fixed a bug in should_subit_post() (@vkama)
|
164 |
+
|
165 |
+
### 4.0.0 - 2017-06-27
|
166 |
+
- [#702](https://github.com/automattic/fb-instant-articles/pull/702) V4.0 (@vkama, @diegoquinteiro, @everton-rosario, @sakatam, @abdusfauzi)
|
167 |
+
- [#647](https://github.com/automattic/fb-instant-articles/pull/647) Fix "Empty string supplied as input" bug (@abdusfauzi)
|
168 |
+
- [#680](https://github.com/automattic/fb-instant-articles/pull/680) Adding support to IA->AMP conversion (@vkama)
|
169 |
+
- [#649](https://github.com/automattic/fb-instant-articles/pull/649) allow markups in footer/copyright (@sakatam)
|
170 |
+
- [#643](https://github.com/automattic/fb-instant-articles/pull/643) Open Graph Ingestion Flow (@diegoquinteiro, @everton-rosario)
|
171 |
+
- [#629](https://github.com/automattic/fb-instant-articles/pull/629) Update Google Analytics compat (@dlackty)
|
172 |
+
|
173 |
+
### 3.3.4 - 2017-05-10
|
174 |
+
- [#602](https://github.com/automattic/fb-instant-articles/pull/602) Add post ID to `instant_articles_content` filter (@carlalexander)
|
175 |
+
- [#622](https://github.com/automattic/fb-instant-articles/pull/622) Adds ver=<VERSION_TOKEN> to invalidate plugin resource files (@everton-rosario)
|
176 |
+
- [#645](https://github.com/automattic/fb-instant-articles/pull/645) Fix wp_is_post_autosave() parameter value (@abdusfauzi)
|
177 |
+
- [#623](https://github.com/automattic/fb-instant-articles/pull/623) Allow for alternative file path for json rules (@andykillen)
|
178 |
+
- [#624](https://github.com/automattic/fb-instant-articles/pull/624) fix merge damage (@sakatam)
|
179 |
+
- [#616](https://github.com/automattic/fb-instant-articles/pull/616) Extracted anonymous inline function (@everton-rosario)
|
180 |
+
- [#609](https://github.com/automattic/fb-instant-articles/pull/609) Apester plugin support (@oraricha)
|
181 |
+
- [#617](https://github.com/automattic/fb-instant-articles/pull/617) Switch on/off configuration for enabling comments/likes by default (@everton-rosario)
|
182 |
+
- [#612](https://github.com/automattic/fb-instant-articles/pull/612) Add an option to set a footer (@sakatam)
|
183 |
+
|
184 |
+
### 3.3.2 - 2017-02-13
|
185 |
+
- [#418](https://github.com/automattic/fb-instant-articles/pull/418) Call instant_articles_post_published hook to determine published status (@apeschar)
|
186 |
+
- [#611](https://github.com/automattic/fb-instant-articles/pull/611) capability to toggle RTL option (@sakatam)
|
187 |
+
- [#604](https://github.com/automattic/fb-instant-articles/pull/604) Fix typo for $provider_url at L42, L44 and L46 (@abdusfauzi)
|
188 |
+
|
189 |
+
### 3.3.1 - 2017-01-31
|
190 |
+
- [#598](https://github.com/automattic/fb-instant-articles/pull/598) Fix typo on script (@diegoquinteiro)
|
191 |
+
- [#595](https://github.com/automattic/fb-instant-articles/pull/595) Add transformer rule for cite element (@davebonds)
|
192 |
+
- [#59](https://github.com/automattic/fb-instant-articles/pull/59) add vimeo.com into oEmbed $provider_name (@abdusfauzi)
|
193 |
+
- [#597](https://github.com/automattic/fb-instant-articles/pull/597) Don't try to load embeds compat unless we're in Instant Articles context (@diegoquinteiro, @rinatkhaziev)
|
194 |
+
- [#568](https://github.com/automattic/fb-instant-articles/pull/568) Add `is_transforming_instant_article()` conditional (@goldenapples)
|
195 |
+
- [#287](https://github.com/automattic/fb-instant-articles/pull/287) Ad de_DE (@swissky)
|
196 |
+
- [#578](https://github.com/automattic/fb-instant-articles/pull/578) Change save_post priority (@cmjaimet)
|
197 |
+
- [#592](https://github.com/automattic/fb-instant-articles/pull/592) Add missing information to composer.json (@onnimonni)
|
198 |
+
- [#562](https://github.com/automattic/fb-instant-articles/pull/562) Add release script (@diegoquinteiro)
|
199 |
+
|
200 |
+
### 3.3 - 2016-12-16
|
201 |
+
- [#560](https://github.com/automattic/fb-instant-articles/pull/560) Remove deprecated rules and add rules for imgs inside links (@diegoquinteiro)
|
202 |
+
- [#525](https://github.com/automattic/fb-instant-articles/pull/525) Update WordPress.com stats code to use FBIA SDK. (@Automattic)
|
203 |
+
- [#535](https://github.com/automattic/fb-instant-articles/pull/535) Fixes #515 - Enables Playbuzz plugin out of the box (@everton-rosario)
|
204 |
+
|
205 |
+
### 3.2.2 - 2016-11-29
|
206 |
+
- [#543](https://github.com/automattic/fb-instant-articles/pull/543) Fix variable name (@diegoquinteiro)
|
207 |
+
|
208 |
+
### 3.2.1 - 2016-11-25
|
209 |
+
- [#538](https://github.com/automattic/fb-instant-articles/pull/538) Show message on meta-box when post is filtered out (@diegoquinteiro)
|
210 |
+
- [#504](https://github.com/automattic/fb-instant-articles/pull/504) Add instant_articles_should_submit_post filter hook to allow developers control of whether the post should be submitted to IA (@rinatkhaziev)
|
211 |
+
- [#498](https://github.com/automattic/fb-instant-articles/pull/498) Release v3.2 (@Automattic)
|
212 |
+
- [#437](https://github.com/automattic/fb-instant-articles/pull/437) Blocks publishing of articles with transformation warnings (@diegoquinteiro, @everton-rosario)
|
213 |
+
- [#423](https://github.com/automattic/fb-instant-articles/pull/423) Fixes #205 - Caption in <p> tag (@everton-rosario)
|
214 |
+
- [#435](https://github.com/automattic/fb-instant-articles/pull/435) Setup Wizard copy updates (@demoive)
|
215 |
+
- [#497](https://github.com/automattic/fb-instant-articles/pull/497) Getter was renamed on SDK, updating here too (@diegoquinteiro)
|
216 |
+
- [#417](https://github.com/automattic/fb-instant-articles/pull/417) Support for Playbuzz plugin (@everton-rosario)
|
217 |
+
- [#416](https://github.com/automattic/fb-instant-articles/pull/416) Use the instant_articles_post_types filter when registering metaboxes (@technosailor)
|
218 |
+
|
219 |
+
### 3.2 - 2016-10-05
|
220 |
+
- [#484](https://github.com/automattic/fb-instant-articles/pull/484) Apply the second argument to `the_title` (@srtfisher)
|
221 |
+
- [#481](https://github.com/automattic/fb-instant-articles/pull/481) Token Invalidation flow (@everton-rosario)
|
222 |
+
- [#462](https://github.com/automattic/fb-instant-articles/pull/462) Migration from old fb sdk (@evertonsario)
|
223 |
+
- [#436](https://github.com/automattic/fb-instant-articles/pull/436) Wp tests migration (@everton-rosario)
|
224 |
+
- [#421](https://github.com/automattic/fb-instant-articles/pull/421) Fixes #408 adding rules for gallery (@everton-rosario)
|
225 |
+
- [#376](https://github.com/automattic/fb-instant-articles/pull/376) Added rule configuration for Instagram embed (@everton-rosario)
|
226 |
+
- [#316](https://github.com/automattic/fb-instant-articles/pull/316) Add development mode support to status meta box (@simonengelhardt)
|
227 |
+
|
228 |
+
### 3.1.3 - 2016-09-19
|
229 |
+
- [#469](https://github.com/automattic/fb-instant-articles/pull/469) Release stuff for v3.1.3 (@Automattic)
|
230 |
+
- [#450](https://github.com/automattic/fb-instant-articles/pull/450) Do not block page selection if URL is not claimed (@diegoquinteiro)
|
231 |
+
- [#464](https://github.com/automattic/fb-instant-articles/pull/464) Fixes #452 - Use of empty() on PHP prior to v5.5 (@demoive)
|
232 |
+
- [#465](https://github.com/automattic/fb-instant-articles/pull/465) Relative CSS to fix missing icons (@everton-rosario)
|
233 |
+
- [#458](https://github.com/automattic/fb-instant-articles/pull/458) Fix expiring token blocking users on page selection state (@diegoquinteiro)
|
234 |
+
- [#403](https://github.com/automattic/fb-instant-articles/pull/403) fix travis.ci build (@sakatam)
|
235 |
+
- [#425](https://github.com/automattic/fb-instant-articles/pull/425) Final release of v3.1 (@Automattic)
|
236 |
+
- [#385](https://github.com/automattic/fb-instant-articles/pull/385) Implemented compat for the get-the-image plugin (@everton-rosario)
|
237 |
+
- [#392](https://github.com/automattic/fb-instant-articles/pull/392) Load functions which rely on `plugins_loaded` action hook in wp.com e… (@nprasath002)
|
238 |
+
- [#402](https://github.com/automattic/fb-instant-articles/pull/402) Properly implemented the get_cover_media function. (@menzow)
|
239 |
+
- [#420](https://github.com/automattic/fb-instant-articles/pull/420) Article with password protection (@everton-rosario)
|
240 |
+
- [#409](https://github.com/automattic/fb-instant-articles/pull/409) Check for undefined index (@gemedet)
|
241 |
+
|
242 |
+
### 3.1 - 2016-08-17
|
243 |
+
- [#413](https://github.com/automattic/fb-instant-articles/pull/413) Fix lingering reference to the old settings page on meta-box (@diegoquinteiro)
|
244 |
+
- [#412](https://github.com/automattic/fb-instant-articles/pull/412) Content update (@diegoquinteiro)
|
245 |
+
- [#400](https://github.com/automattic/fb-instant-articles/pull/400) New flow (@diegoquinteiro, @everton-rosario)
|
246 |
+
- [#399](https://github.com/automattic/fb-instant-articles/pull/399) Revert "Redirect settings" (@philipjohn)
|
247 |
+
- [#394](https://github.com/automattic/fb-instant-articles/pull/394) Apply "the_title" filter (@everton-rosario)
|
248 |
+
- [#389](https://github.com/automattic/fb-instant-articles/pull/389) Redirect settings (@everton-rosario)
|
249 |
+
- [#387](https://github.com/automattic/fb-instant-articles/pull/387) Fix loadHTML warning (@gemedet)
|
250 |
+
- [#378](https://github.com/automattic/fb-instant-articles/pull/378) Added rules for jetpack carousel component (@everton-rosario)
|
251 |
+
- [#379](https://github.com/automattic/fb-instant-articles/pull/379) Don't call wpautop directly when trying to prepare content for transformation. (@rinatkhaziev)
|
252 |
+
- [#383](https://github.com/automattic/fb-instant-articles/pull/383) Fix updating published posts result in error (@chrisadas)
|
253 |
+
- [#375](https://github.com/automattic/fb-instant-articles/pull/375) Commit blocker option - No warnings in transformer to publish (@everton-rosario)
|
254 |
+
- [#374](https://github.com/automattic/fb-instant-articles/pull/374) Jetpack plugin compatibility - Transformation rules (@everton-rosario)
|
255 |
+
- [#371](https://github.com/automattic/fb-instant-articles/pull/371) Migrated take_live parameter to the published (@everton-rosario)
|
256 |
+
- [#366](https://github.com/automattic/fb-instant-articles/pull/366) InteractiveInsideParagraphRule support and configuration (@everton-rosario)
|
257 |
+
- [#367](https://github.com/automattic/fb-instant-articles/pull/367) Add subtitle to $header when rendering post to IA (@jacobarriola)
|
258 |
+
- [#360](https://github.com/automattic/fb-instant-articles/pull/360) Improve rules for Images inside Paragraphs and Interactive elements (@everton-rosario)
|
259 |
+
- [#356](https://github.com/automattic/fb-instant-articles/pull/356) Ensure that relative URL checking has a host and a path. (@srtfisher)
|
260 |
+
|
261 |
+
### 3.0.1 - 2016-07-13
|
262 |
+
- [#359](https://github.com/automattic/fb-instant-articles/pull/359) Release 3.0.1 (@Automattic)
|
263 |
+
- [#358](https://github.com/automattic/fb-instant-articles/pull/358) Revert "escaping and sanitization fixes" (@diegoquinteiro)
|
264 |
+
|
265 |
+
### 3.0 - 2016-07-12
|
266 |
+
- [#355](https://github.com/automattic/fb-instant-articles/pull/355) Release v3.0 (@Automattic)
|
267 |
+
- [#354](https://github.com/automattic/fb-instant-articles/pull/354) Remove to avoid breaking elements. See #331 (@Automattic)
|
268 |
+
- [#353](https://github.com/automattic/fb-instant-articles/pull/353) Store and use submission ID when available to fetch the status (@diegoquinteiro)
|
269 |
+
- [#329](https://github.com/automattic/fb-instant-articles/pull/329) always use HTTPS to load JavaScript SDK; update to 2.6 (@paulschreiber)
|
270 |
+
- [#327](https://github.com/automattic/fb-instant-articles/pull/327) use v2.6 of Facebook API (@paulschreiber)
|
271 |
+
- [#263](https://github.com/automattic/fb-instant-articles/pull/263) Escape ampersands before displaying on settings page (@gemedet)
|
272 |
+
- [#301](https://github.com/automattic/fb-instant-articles/pull/301) Check if the global $post object has been set (@srtfisher)
|
273 |
+
- [#290](https://github.com/automattic/fb-instant-articles/pull/290) Fix relative URL issue with oembeds not using absolute URLs (@stuartshields)
|
274 |
+
- [#255](https://github.com/automattic/fb-instant-articles/pull/255) Support <mark> tag (@demoive)
|
275 |
+
- [#313](https://github.com/automattic/fb-instant-articles/pull/313) Fixed statically-called loadHTML() (@gemedet)
|
276 |
+
- [#258](https://github.com/automattic/fb-instant-articles/pull/258) Width and Height for Interactive in default rules (@gemedet)
|
277 |
+
- [#343](https://github.com/automattic/fb-instant-articles/pull/343) Only publish posts (ignores pages and other post types) (@diegoquinteiro)
|
278 |
+
- [#342](https://github.com/automattic/fb-instant-articles/pull/342) Replace SocialEmbed rules with Interactive rules (@diegoquinteiro)
|
279 |
+
- [#330](https://github.com/automattic/fb-instant-articles/pull/330) fix whitespace in select/optgroup tags (@paulschreiber)
|
280 |
+
- [#331](https://github.com/automattic/fb-instant-articles/pull/331) WordPress coding standards fixes (@paulschreiber)
|
281 |
+
- [#328](https://github.com/automattic/fb-instant-articles/pull/328) Fix whitespace to match WordPress coding standards (@paulschreiber)
|
282 |
+
- [#285](https://github.com/automattic/fb-instant-articles/pull/285) Remove hyperlinks beginning with a # (@markbarnes)
|
283 |
+
- [#341](https://github.com/automattic/fb-instant-articles/pull/341) Avoid crawler to cache a 404 (@diegoquinteiro)
|
284 |
+
- [#305](https://github.com/automattic/fb-instant-articles/pull/305) Allow filtering of the post types used in the feed (@Automattic)
|
285 |
+
- [#308](https://github.com/automattic/fb-instant-articles/pull/308) Fixed error message: Deprecated: Non-static method DOMDocument::loadH… (@everton-rosario)
|
286 |
+
- [#286](https://github.com/automattic/fb-instant-articles/pull/286) Add GitHub Issue and PR templates (@simonengelhardt)
|
287 |
+
- [#177](https://github.com/automattic/fb-instant-articles/pull/177) Use H1 for header title and cover image caption (@gemedet)
|
288 |
+
|
289 |
+
### 2.11 - 2016-05-17
|
290 |
+
- [#257](https://github.com/automattic/fb-instant-articles/pull/257) Fix scheduled posts with empty IA content (@Aioros)
|
291 |
+
- [#273](https://github.com/automattic/fb-instant-articles/pull/273) Copy updated to align better with scheduled posts (@demoive)
|
292 |
+
- [#271](https://github.com/automattic/fb-instant-articles/pull/271) Checks if it have the node to be shown as warning body (@everton-rosario)
|
293 |
+
- [#264](https://github.com/automattic/fb-instant-articles/pull/264) Add new application header (@diegoquinteiro)
|
294 |
+
|
295 |
+
### 2.10 - 2016-04-29
|
296 |
+
- [#179](https://github.com/automattic/fb-instant-articles/pull/179) Graphics for banner and icon (@demoive)
|
297 |
+
- [#183](https://github.com/automattic/fb-instant-articles/pull/183) Wordpress -> WordPress (@lesterchan)
|
298 |
+
- [#213](https://github.com/automattic/fb-instant-articles/pull/213) Labels and documentation changes re: custom transformer rules (@demoive)
|
299 |
+
|
300 |
+
### 2.9 - 2016-04-19
|
301 |
+
- [#174](https://github.com/automattic/fb-instant-articles/pull/174) Prevents <figcaptions> from being added to images that were not saved with captions (@bobderrico80)
|
302 |
+
- [#176](https://github.com/automattic/fb-instant-articles/pull/176) Remove unused image.caption property from ImageRule (@demoive)
|
303 |
+
- [#180](https://github.com/automattic/fb-instant-articles/pull/180) Fix empty articles being uploaded on bulk update (@diegoquinteiro)
|
304 |
+
- [#167](https://github.com/automattic/fb-instant-articles/pull/167) Fixes #116 encoding problem (@everton-rosario)
|
305 |
+
- [#173](https://github.com/automattic/fb-instant-articles/pull/173) Fixed empty link to Instant Articles signup (@demoive)
|
306 |
+
|
307 |
+
### 2.8 - 2016-04-14
|
308 |
+
- [#151](https://github.com/automattic/fb-instant-articles/pull/151) Stop publishing drafts (@diegoquinteiro)
|
309 |
+
|
310 |
+
### 2.6 - 2016-04-13
|
311 |
+
- [#115](https://github.com/automattic/fb-instant-articles/pull/115) Added information about initial publishing (@msurguy)
|
312 |
+
- [#105](https://github.com/automattic/fb-instant-articles/pull/105) Update template-settings-info.php (@piscis)
|
313 |
+
|
314 |
+
### 2.1 - 2016-04-11
|
315 |
+
- [#98](https://github.com/automattic/fb-instant-articles/pull/98) Fixes #72 (@diegoquinteiro)
|
316 |
+
- [#90](https://github.com/automattic/fb-instant-articles/pull/90) Change readme.txt to reflect changes in 2.0 (@diegoquinteiro)
|
317 |
+
- [#87](https://github.com/automattic/fb-instant-articles/pull/87) Clean unused files + fixes for 5.4 compatibility (@diegoquinteiro)
|
318 |
+
|
319 |
+
### 2.0 - 2016-04-06
|
320 |
+
- [#70](https://github.com/automattic/fb-instant-articles/pull/70) Use SDK engine (@diegoquinteiro)
|
321 |
+
|
322 |
+
### 0.2 - 2016-03-09
|
323 |
+
- [#41](https://github.com/automattic/fb-instant-articles/pull/41) Add support for subtitles through the filter instant_articles_subtitle (@bjornjohansen)
|
324 |
+
- [#39](https://github.com/automattic/fb-instant-articles/pull/39) Jetpack compat: YouTube and Facebook embeds (@bjornjohansen)
|
325 |
+
- [#22](https://github.com/automattic/fb-instant-articles/pull/22) Migrate the wpcom-helper.php from WordPress.com. (@Automattic)
|
326 |
+
|
327 |
+
== Upgrade Notice ==
|
328 |
+
|
329 |
+
### 5.0.0
|
330 |
+
- Minimum PHP requirement is increased from PHP 5.4 to PHP 7.1.
|
331 |
+
- Minimum WordPress requirement is increased from WP 4.3.0 to WP 4.7.0.
|
release.sh
DELETED
@@ -1,494 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
red=`tput setaf 1`
|
3 |
-
green=`tput setaf 2`
|
4 |
-
yellow=`tput setaf 3`
|
5 |
-
blue=`tput setaf 4`
|
6 |
-
reset=`tput sgr0`
|
7 |
-
me='./'`basename "$0"`
|
8 |
-
|
9 |
-
#--------------------------------
|
10 |
-
# Functions
|
11 |
-
#--------------------------------
|
12 |
-
function show_help {
|
13 |
-
cat <<EOF
|
14 |
-
|
15 |
-
${green}Usage:${reset}
|
16 |
-
${blue}${me} [-hvs] [-c <command>] [version]${reset}
|
17 |
-
|
18 |
-
${green}Arguments:${reset}
|
19 |
-
version - The target version (ex: 3.2.1)
|
20 |
-
|
21 |
-
${green}Options:${reset}
|
22 |
-
-h Display this help message
|
23 |
-
-v Verbose mode
|
24 |
-
-s Simulate only (do not release)
|
25 |
-
-c <command> Runs only a single command. Possible commands are:
|
26 |
-
- bump_version: generate a new version tag on the repository
|
27 |
-
- release: release a new version on GitHub
|
28 |
-
- publish: publishes the target version to the WordPress
|
29 |
-
plugin repository
|
30 |
-
|
31 |
-
|
32 |
-
${green}Examples:${reset}
|
33 |
-
|
34 |
-
${blue}${me} 3.3.0${reset}
|
35 |
-
Runs bump_version then release for 3.3.0. This is the default use case.
|
36 |
-
|
37 |
-
${blue}${me} -c bump_version 3.3.0${reset}
|
38 |
-
Generates a new commit on master changing the version to 3.3.0 in
|
39 |
-
all relevant files, tags the commit and pushes to remote.
|
40 |
-
|
41 |
-
${blue}${me} -c release 3.3.0${reset}
|
42 |
-
Creates a new Release on GitHub based on the tag 3.3.0 and uploads
|
43 |
-
the binary package based on master.
|
44 |
-
${red}IMPORTANT: this will create a new tag if tag 3.3.0 doesn't exist,
|
45 |
-
so make sure to bump_version beforehand.${reset}
|
46 |
-
|
47 |
-
${blue}${me} -v 3.3.0${reset}
|
48 |
-
Releases 3.3.0 in verbose mode.
|
49 |
-
|
50 |
-
${blue}${me} -s 3.3.0${reset}
|
51 |
-
Simulates a 3.3.0 release: prints the commands instead of running them.
|
52 |
-
|
53 |
-
EOF
|
54 |
-
}
|
55 |
-
|
56 |
-
function invalid_usage {
|
57 |
-
printf $red
|
58 |
-
echo $@
|
59 |
-
echo "Aborted"
|
60 |
-
printf $reset
|
61 |
-
show_help
|
62 |
-
exit -1;
|
63 |
-
}
|
64 |
-
function error_message {
|
65 |
-
printf $red
|
66 |
-
echo $@
|
67 |
-
echo "Aborted"
|
68 |
-
printf $reset
|
69 |
-
exit -1
|
70 |
-
}
|
71 |
-
function message {
|
72 |
-
if [[ $verbose == 1 ]]; then
|
73 |
-
printf $green
|
74 |
-
echo $@
|
75 |
-
printf $reset
|
76 |
-
fi
|
77 |
-
}
|
78 |
-
function run_message {
|
79 |
-
if [[ $simulate == 1 ]]; then
|
80 |
-
printf $yellow
|
81 |
-
echo $@
|
82 |
-
printf $reset
|
83 |
-
fi
|
84 |
-
}
|
85 |
-
|
86 |
-
#----------------
|
87 |
-
# Read parameters
|
88 |
-
#----------------
|
89 |
-
|
90 |
-
# A POSIX variable
|
91 |
-
# Reset in case getopts has been used previously in the shell.
|
92 |
-
OPTIND=1
|
93 |
-
|
94 |
-
# Read options:
|
95 |
-
verbose=0
|
96 |
-
simulate=0
|
97 |
-
selected_cmd='all'
|
98 |
-
|
99 |
-
while getopts "hvc:s" opt; do
|
100 |
-
case "$opt" in
|
101 |
-
h|\?)
|
102 |
-
show_help
|
103 |
-
exit 0
|
104 |
-
;;
|
105 |
-
v) verbose=1
|
106 |
-
;;
|
107 |
-
s) simulate=1
|
108 |
-
;;
|
109 |
-
c) selected_cmd="${OPTARG}"
|
110 |
-
;;
|
111 |
-
esac
|
112 |
-
done
|
113 |
-
|
114 |
-
shift $((OPTIND-1))
|
115 |
-
|
116 |
-
# Read argument
|
117 |
-
version=$1
|
118 |
-
|
119 |
-
# Validates arguments
|
120 |
-
if [[ $2 ]]; then
|
121 |
-
invalid_usage "Invalid parameters"
|
122 |
-
fi
|
123 |
-
|
124 |
-
if [[ ! $( echo $version | grep -Ee '^[0-9]+\.[0-9]+(\.[0-9]+)?$' ) ]]; then
|
125 |
-
invalid_usage "Invalid version provided"
|
126 |
-
fi
|
127 |
-
|
128 |
-
message "Releasing version: $version"
|
129 |
-
message "Running in verbose mode"
|
130 |
-
if [[ $simulate == 1 ]]; then
|
131 |
-
message "Running in simulation mode"
|
132 |
-
fi
|
133 |
-
|
134 |
-
#---------------------------------
|
135 |
-
# Check if we have the right tools
|
136 |
-
#---------------------------------
|
137 |
-
|
138 |
-
if ! type "git" > /dev/null; then
|
139 |
-
error_message "git not found, please install git before continuing: http://git.org"
|
140 |
-
else
|
141 |
-
message "Found git: $(git --version)"
|
142 |
-
fi
|
143 |
-
|
144 |
-
if ! type "js" > /dev/null; then
|
145 |
-
error_message "SpiderMonkey interpreter not found, please install SpiderMonkey before continuing: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey (or with Homebrew)"
|
146 |
-
else
|
147 |
-
message "Found SpiderMonkey"
|
148 |
-
fi
|
149 |
-
|
150 |
-
|
151 |
-
if ! type "github-changes" > /dev/null; then
|
152 |
-
error_message "github-changes tool not found. Please run: npm install -g github-changes"
|
153 |
-
else
|
154 |
-
message "Found github-changes"
|
155 |
-
fi
|
156 |
-
|
157 |
-
#------------------------------------
|
158 |
-
# Check if we are in the right folder
|
159 |
-
#------------------------------------
|
160 |
-
if [[ ! -e '.git/config' ]]; then
|
161 |
-
error_message "You should run this command from the root directory of your repository."
|
162 |
-
fi
|
163 |
-
if [[ ! $( cat .git/config | grep -i 'automattic/facebook-instant-articles-wp') ]]; then
|
164 |
-
error_message "You should run this command from the root directory of the facebook-instant-articles-wp repository."
|
165 |
-
fi
|
166 |
-
|
167 |
-
repo_dir=$(pwd)
|
168 |
-
|
169 |
-
#-------------------
|
170 |
-
# Manages simulation
|
171 |
-
#-------------------
|
172 |
-
function run {
|
173 |
-
if [[ $simulate == 1 ]]; then
|
174 |
-
run_message $@
|
175 |
-
else
|
176 |
-
"$@"
|
177 |
-
fi
|
178 |
-
}
|
179 |
-
|
180 |
-
function revert_repo {
|
181 |
-
run cd $repo_dir
|
182 |
-
if [[ $branch_name != 'master' ]]; then
|
183 |
-
message "Going back to $branch_name"
|
184 |
-
# stashes anything possibly left from the script execution
|
185 |
-
run git stash
|
186 |
-
run git checkout $branch_name
|
187 |
-
fi
|
188 |
-
if [[ $stash_ref ]]; then
|
189 |
-
message "Applying stashed changes"
|
190 |
-
run git stash apply $stash_ref
|
191 |
-
fi
|
192 |
-
}
|
193 |
-
|
194 |
-
function confirm {
|
195 |
-
confirm=''
|
196 |
-
while [[ $confirm != 'a' && $confirm != 'y' ]]; do
|
197 |
-
printf $blue
|
198 |
-
printf "%b" "$*"
|
199 |
-
printf ' (y)es/(a)bort: '
|
200 |
-
printf $red
|
201 |
-
read -n 1 confirm
|
202 |
-
printf "\n"
|
203 |
-
done
|
204 |
-
if [[ $confirm != 'y' ]]; then
|
205 |
-
revert_repo
|
206 |
-
error_message 'Execution aborted by the user'
|
207 |
-
exit -1
|
208 |
-
fi
|
209 |
-
printf $reset
|
210 |
-
}
|
211 |
-
|
212 |
-
function ask {
|
213 |
-
user_response=''
|
214 |
-
while [[ $user_response != 'n' && $user_response != 'y' ]]; do
|
215 |
-
printf $blue
|
216 |
-
printf "%b" "$*"
|
217 |
-
printf ' (y)es/(n)o: '
|
218 |
-
printf $red
|
219 |
-
read -n 1 user_response
|
220 |
-
printf "\n"
|
221 |
-
done
|
222 |
-
printf $reset
|
223 |
-
}
|
224 |
-
|
225 |
-
function prompt {
|
226 |
-
user_response=''
|
227 |
-
printf $blue
|
228 |
-
printf "%b" "$*"
|
229 |
-
printf $red
|
230 |
-
read user_response
|
231 |
-
printf $reset
|
232 |
-
}
|
233 |
-
|
234 |
-
function prompt_password {
|
235 |
-
user_response=''
|
236 |
-
printf $blue
|
237 |
-
printf "%b" "$*"
|
238 |
-
printf $red
|
239 |
-
read -s user_response
|
240 |
-
printf $reset
|
241 |
-
}
|
242 |
-
|
243 |
-
#----------------------
|
244 |
-
# Commands
|
245 |
-
#----------------------
|
246 |
-
function bump_version {
|
247 |
-
|
248 |
-
message "Stashing current work..."
|
249 |
-
|
250 |
-
stash_ref=$(git stash create)
|
251 |
-
run_message git stash create
|
252 |
-
|
253 |
-
if [[ $stash_ref ]]; then
|
254 |
-
run git reset --hard
|
255 |
-
message "Stashed current work to: $stash_ref"
|
256 |
-
else
|
257 |
-
message "Nothing to stash"
|
258 |
-
fi
|
259 |
-
|
260 |
-
branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
|
261 |
-
branch_name=${branch_name##refs/heads/}
|
262 |
-
message "Current branch: $branch_name"
|
263 |
-
|
264 |
-
if [[ $branch_name != 'master' ]]; then
|
265 |
-
message "Switching to master..."
|
266 |
-
run git checkout master
|
267 |
-
fi
|
268 |
-
|
269 |
-
message "Pulling latest version from GitHub"
|
270 |
-
run git pull --rebase
|
271 |
-
|
272 |
-
confirm "Replace stable tag on readme.txt with $version?"
|
273 |
-
message "Replacing stable tag on readme.txt"
|
274 |
-
run sed -i -e "s/Stable tag: .*/Stable tag: $version/" ./readme.txt
|
275 |
-
run git diff
|
276 |
-
confirm "Add changes to commit?"
|
277 |
-
run git add readme.txt
|
278 |
-
run rm readme.txt-e
|
279 |
-
|
280 |
-
confirm "Replace version on facebook-instant-articles-wp.php with $version?"
|
281 |
-
message "Replacing version on facebook-instant-articles-wp.php"
|
282 |
-
run sed -i -e "s/^ \* Version: .*/ * Version: $version/" facebook-instant-articles.php
|
283 |
-
run sed -i -e "s/define( 'IA_PLUGIN_VERSION', '[0-9.]*' );/define( 'IA_PLUGIN_VERSION', '$version' );/" facebook-instant-articles.php
|
284 |
-
run git diff
|
285 |
-
confirm "Add changes to commit?"
|
286 |
-
run git add facebook-instant-articles.php
|
287 |
-
run rm facebook-instant-articles.php-e
|
288 |
-
|
289 |
-
confirm "Update CHANGELOG.md for $version?"
|
290 |
-
message "Updating CHANGELOG.md for $version"
|
291 |
-
run github-changes -o automattic -r facebook-instant-articles-wp -a --only-pulls --use-commit-body --tag-name $version
|
292 |
-
run git diff
|
293 |
-
confirm "Add changes to commit?"
|
294 |
-
run git add CHANGELOG.md
|
295 |
-
|
296 |
-
confirm "Update changelog on readme.txt?"
|
297 |
-
message "Updating changelog on readme.txt"
|
298 |
-
run sed '/== Changelog ==/q' ./readme.txt >> ./readme2.txt
|
299 |
-
run cat ./CHANGELOG.md >> ./readme2.txt
|
300 |
-
run rm ./readme.txt
|
301 |
-
run mv ./readme2.txt ./readme.txt
|
302 |
-
run git diff
|
303 |
-
confirm "Add changes to commit?"
|
304 |
-
run git add readme.txt
|
305 |
-
|
306 |
-
confirm "Commit version bump on master with message 'Bump version to $version'?"
|
307 |
-
run git commit -m "Bump version to $version"
|
308 |
-
|
309 |
-
confirm "Create tag $version?"
|
310 |
-
run git tag $version
|
311 |
-
|
312 |
-
confirm "Push tag and commit to GitHub?"
|
313 |
-
run git push
|
314 |
-
run git push --tags
|
315 |
-
|
316 |
-
revert_repo
|
317 |
-
|
318 |
-
echo "🍺 Tag $version created!"
|
319 |
-
}
|
320 |
-
|
321 |
-
function release {
|
322 |
-
|
323 |
-
confirm "Create a new release for $version?"
|
324 |
-
|
325 |
-
message "Stashing current work..."
|
326 |
-
|
327 |
-
stash_ref=$(git stash create)
|
328 |
-
run_message git stash create
|
329 |
-
|
330 |
-
if [[ $stash_ref ]]; then
|
331 |
-
run git reset --hard
|
332 |
-
message "Stashed current work to: $stash_ref"
|
333 |
-
else
|
334 |
-
message "Nothing to stash"
|
335 |
-
fi
|
336 |
-
|
337 |
-
branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
|
338 |
-
branch_name=${branch_name##refs/heads/}
|
339 |
-
message "Current branch: $branch_name"
|
340 |
-
|
341 |
-
if [[ $branch_name != 'master' ]]; then
|
342 |
-
message "Switching to master..."
|
343 |
-
run git checkout master
|
344 |
-
fi
|
345 |
-
|
346 |
-
message "Pulling latest version from GitHub"
|
347 |
-
run git pull --rebase
|
348 |
-
|
349 |
-
if [[ ! -e resty ]]; then
|
350 |
-
message "Downloading resty to connect to GitHub API"
|
351 |
-
run curl -L http://github.com/micha/resty/raw/2.2/resty > resty
|
352 |
-
fi
|
353 |
-
if [[ ! -e jsawk ]]; then
|
354 |
-
message "Downloading jsawk to parse info from GitHub API"
|
355 |
-
run curl -L http://github.com/micha/jsawk/raw/1.4/jsawk > jsawk
|
356 |
-
fi
|
357 |
-
|
358 |
-
prompt "GitHub access-token (required only for 2fac):"
|
359 |
-
github_access_token=$user_response
|
360 |
-
|
361 |
-
if [[ github_access_token ]]; then
|
362 |
-
run . resty -W 'https://api.github.com' -H "Authorization: token $github_access_token"
|
363 |
-
else
|
364 |
-
prompt "GitHub username:"
|
365 |
-
github_username=$user_response
|
366 |
-
|
367 |
-
prompt_password "GitHub password:"
|
368 |
-
github_password=$user_response
|
369 |
-
|
370 |
-
run . resty -W 'https://api.github.com' -u $github_username:$github_password
|
371 |
-
fi
|
372 |
-
|
373 |
-
response=$(run POST /repos/Automattic/facebook-instant-articles-wp/releases "
|
374 |
-
{
|
375 |
-
\"tag_name\": \"$version\",
|
376 |
-
\"target_commitish\": \"master\",
|
377 |
-
\"name\": \"$version\",
|
378 |
-
\"body\": \"Version $version\",
|
379 |
-
\"draft\": false,
|
380 |
-
\"prerelease\": false
|
381 |
-
}
|
382 |
-
");
|
383 |
-
|
384 |
-
if [[ $response ]]; then
|
385 |
-
message "Release $version created!"
|
386 |
-
else
|
387 |
-
error_message "Couldn't create release"
|
388 |
-
fi
|
389 |
-
|
390 |
-
upload_url=$( echo $response | . jsawk -n 'out(this.upload_url)' | sed -e "s/{[^}]*}//g" )
|
391 |
-
release_id=$( echo $response | . jsawk -n 'out(this.id)' )
|
392 |
-
|
393 |
-
message "Upload URL: $upload_url"
|
394 |
-
|
395 |
-
message "Creating binary file"
|
396 |
-
run composer install
|
397 |
-
run zip -qr facebook-instant-articles-wp.zip .
|
398 |
-
|
399 |
-
message "Uploading binary for release..."
|
400 |
-
|
401 |
-
if [[ github_access_token ]]; then
|
402 |
-
response=$(run curl -H "Authorization: token $github_access_token" -H "Content-Type: application/zip" --data-binary @facebook-instant-articles-wp.zip $upload_url\?name=facebook-instant-articles-wp-$version.zip )
|
403 |
-
else
|
404 |
-
response=$(run curl -u $github_username:$github_password -H "Content-Type: application/zip" --data-binary @facebook-instant-articles-wp.zip $upload_url\?name=facebook-instant-articles-wp-$version.zip )
|
405 |
-
fi
|
406 |
-
|
407 |
-
run rm facebook-instant-articles-wp.zip
|
408 |
-
revert_repo
|
409 |
-
|
410 |
-
if [[ $response ]]; then
|
411 |
-
echo "🍺 Release $version successfully created"
|
412 |
-
else
|
413 |
-
error_message "Couldn't upload file"
|
414 |
-
fi
|
415 |
-
|
416 |
-
|
417 |
-
}
|
418 |
-
|
419 |
-
function publish {
|
420 |
-
confirm "Publish $version to WordPress plugin repository?"
|
421 |
-
|
422 |
-
message "Stashing current work..."
|
423 |
-
|
424 |
-
stash_ref=$(git stash create)
|
425 |
-
run_message git stash create
|
426 |
-
|
427 |
-
if [[ $stash_ref ]]; then
|
428 |
-
run git reset --hard
|
429 |
-
message "Stashed current work to: $stash_ref"
|
430 |
-
else
|
431 |
-
message "Nothing to stash"
|
432 |
-
fi
|
433 |
-
|
434 |
-
branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
|
435 |
-
branch_name=${branch_name##refs/heads/}
|
436 |
-
message "Current branch: $branch_name"
|
437 |
-
|
438 |
-
if [[ $branch_name != 'master' ]]; then
|
439 |
-
message "Switching to master..."
|
440 |
-
run git checkout master
|
441 |
-
fi
|
442 |
-
|
443 |
-
message "Pulling latest version from GitHub"
|
444 |
-
run git pull --rebase
|
445 |
-
|
446 |
-
tmp_dir=$(mktemp -d)
|
447 |
-
|
448 |
-
message "Updating composer dependencies"
|
449 |
-
run composer install
|
450 |
-
|
451 |
-
message "Checking out SVN repository..."
|
452 |
-
run cd $tmp_dir
|
453 |
-
run svn checkout -q https://plugins.svn.wordpress.org/fb-instant-articles/
|
454 |
-
run cd fb-instant-articles/trunk/
|
455 |
-
|
456 |
-
confirm "Copy new version to trunk?"
|
457 |
-
run cp -rf $repo_dir/* ./
|
458 |
-
|
459 |
-
# Removes development files we know shouldn't make to the SVN repo
|
460 |
-
run rm -rf .[!.]* # this will remove all hidden files
|
461 |
-
run rm -rf bin
|
462 |
-
run rm -rf tests
|
463 |
-
run rm -rf composer*
|
464 |
-
run rm -rf phpunit*
|
465 |
-
run rm -rf vendor/apache/log4php/src/test
|
466 |
-
run rm -rf facebook-instant-articles-wp.zip
|
467 |
-
run rm -rf jsawk
|
468 |
-
run rm -rf resty
|
469 |
-
run rm -rf vendor/apache/log4php/.git
|
470 |
-
|
471 |
-
run svn st | grep '^\?' | sed 's/^\? *//' | xargs -I% svn add %
|
472 |
-
run svn status
|
473 |
-
ask "Review changes?"
|
474 |
-
if [[ $user_response == 'y' ]]; then
|
475 |
-
run svn diff
|
476 |
-
fi
|
477 |
-
confirm "Commit changes to trunk?"
|
478 |
-
run svn commit -m "Release $version"
|
479 |
-
confirm "Tag version $version?"
|
480 |
-
run svn cp ../trunk ../tags/$version
|
481 |
-
run cd ..
|
482 |
-
run svn commit -m "Tag $version"
|
483 |
-
|
484 |
-
revert_repo
|
485 |
-
|
486 |
-
echo "🍺 Published $version successfully"
|
487 |
-
}
|
488 |
-
|
489 |
-
# Run right command
|
490 |
-
if [[ $selected_cmd == 'bump_version' ]]; then bump_version; exit 0; fi
|
491 |
-
if [[ $selected_cmd == 'release' ]]; then release; exit 0; fi
|
492 |
-
if [[ $selected_cmd == 'publish' ]]; then publish; exit 0; fi
|
493 |
-
if [[ $selected_cmd == 'all' ]]; then bump_version; release; publish; exit 0; fi
|
494 |
-
error_message "Invalid command $selected_cmd"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-option-ads.php
DELETED
@@ -1,245 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Configuration class for Ads.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_Ads extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-ads';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => 'Ads',
|
21 |
-
'description' => '<p>Choose your preferred method for displaying ads in your Instant Articles and input the code in the boxes below. Learn more about your options for <a href="https://developers.facebook.com/docs/instant-articles/ads-analytics" target="_blank">advertising in Instant Articles</a>.</p>',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'ad_source' => array(
|
27 |
-
'label' => 'Ad Type',
|
28 |
-
'description' => 'This plugin will automatically place the ads within your articles.',
|
29 |
-
'render' => array( 'Instant_Articles_Option_Ads', 'custom_render_ad_source' ),
|
30 |
-
'select_options' => array(
|
31 |
-
'none' => 'None',
|
32 |
-
'fan' => 'Facebook Audience Network',
|
33 |
-
'iframe' => 'Custom iframe URL',
|
34 |
-
'embed' => 'Custom Embed Code',
|
35 |
-
),
|
36 |
-
'default' => 'none',
|
37 |
-
),
|
38 |
-
|
39 |
-
'fan_placement_id' => array(
|
40 |
-
'label' => 'Audience Network Placement ID',
|
41 |
-
'description' => 'Find your <a href="https://developers.facebook.com/docs/audience-network/instantarticles/banner" target="_blank">Placement ID</a> for Facebook Audience Network on your app\'s Audience Network Portal',
|
42 |
-
'default' => null,
|
43 |
-
),
|
44 |
-
|
45 |
-
'iframe_url' => array(
|
46 |
-
'label' => 'Source URL',
|
47 |
-
'placeholder' => '//ad-server.com/my-ad',
|
48 |
-
'description' => 'Note: Instant Articles only supports Direct Sold ads. No programmatic ad networks, other than Facebook\'s Audience Network, are permitted.',
|
49 |
-
'default' => '',
|
50 |
-
),
|
51 |
-
|
52 |
-
'embed_code' => array(
|
53 |
-
'label' => 'Embed Code',
|
54 |
-
'render' => 'textarea',
|
55 |
-
'description' => 'Add code to be used for displayed ads in your Instant Articles.',
|
56 |
-
'default' => '',
|
57 |
-
'placeholder' => '<script>...</script>',
|
58 |
-
'double_encode' => true,
|
59 |
-
),
|
60 |
-
|
61 |
-
'dimensions' => array(
|
62 |
-
'label' => 'Ad Dimensions',
|
63 |
-
'render' => 'select',
|
64 |
-
'select_options' => array(
|
65 |
-
'300x250' => 'Large (300 x 250)',
|
66 |
-
'320x50' => 'Small (320 x 50)',
|
67 |
-
),
|
68 |
-
'default' => '300x250',
|
69 |
-
),
|
70 |
-
|
71 |
-
);
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Constructor.
|
75 |
-
*
|
76 |
-
* @since 0.4
|
77 |
-
*/
|
78 |
-
public function __construct() {
|
79 |
-
parent::__construct(
|
80 |
-
self::OPTION_KEY,
|
81 |
-
self::$sections,
|
82 |
-
self::$fields
|
83 |
-
);
|
84 |
-
wp_localize_script( 'instant-articles-option-ads', 'INSTANT_ARTICLES_OPTION_ADS', array(
|
85 |
-
'option_field_id_source' => self::OPTION_KEY . '-ad_source',
|
86 |
-
'option_field_id_fan' => self::OPTION_KEY . '-fan_placement_id',
|
87 |
-
'option_field_id_iframe' => self::OPTION_KEY . '-iframe_url',
|
88 |
-
'option_field_id_embed' => self::OPTION_KEY . '-embed_code',
|
89 |
-
'option_field_id_dimensions' => self::OPTION_KEY . '-dimensions',
|
90 |
-
) );
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Renders the ad source.
|
95 |
-
*
|
96 |
-
* @param array $args configuration fields for the ad.
|
97 |
-
* @since 0.4
|
98 |
-
*/
|
99 |
-
public static function custom_render_ad_source( $args ) {
|
100 |
-
$id = $args['label_for'];
|
101 |
-
$name = $args['serialized_with_group'] . '[ad_source]';
|
102 |
-
|
103 |
-
$description = isset( $args['description'] )
|
104 |
-
? '<p class="description">' . esc_html( $args['description'] ) . '</p>'
|
105 |
-
: '';
|
106 |
-
|
107 |
-
?>
|
108 |
-
<select id="<?php echo esc_attr( $id ); ?>" name="<?php echo esc_attr( $name ); ?>" >
|
109 |
-
<?php foreach ( $args['select_options'] as $ad_source_key => $ad_source_name ) : ?>
|
110 |
-
<option
|
111 |
-
value="<?php echo esc_attr( $ad_source_key ); ?>"
|
112 |
-
<?php echo selected( self::$settings['ad_source'], $ad_source_key ) ?>
|
113 |
-
>
|
114 |
-
<?php echo esc_html( $ad_source_name ); ?>
|
115 |
-
</option>
|
116 |
-
<?php endforeach; ?>
|
117 |
-
|
118 |
-
<?php
|
119 |
-
$compat_plugins = parent::get_registered_compat( 'instant_articles_compat_registry_ads' );
|
120 |
-
asort( $compat_plugins );
|
121 |
-
if ( count( $compat_plugins ) > 0 ) :
|
122 |
-
?>
|
123 |
-
<optgroup label="From Supported Plugins">
|
124 |
-
<?php foreach ( $compat_plugins as $ad_source_key => $ad_source_info ) : ?>
|
125 |
-
<option
|
126 |
-
value="<?php echo esc_attr( $ad_source_key ); ?>"
|
127 |
-
<?php echo selected( self::$settings['ad_source'], $ad_source_key ) ?>
|
128 |
-
>
|
129 |
-
<?php echo esc_html( $ad_source_info['name'] ); ?>
|
130 |
-
</option>
|
131 |
-
<?php endforeach; ?>
|
132 |
-
</optgroup>
|
133 |
-
<?php endif; ?>
|
134 |
-
|
135 |
-
?>
|
136 |
-
</select>
|
137 |
-
<?php echo wp_kses_post( $description ); ?>
|
138 |
-
<?php
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Sanitize and return all the field values.
|
143 |
-
*
|
144 |
-
* This method receives a payload containing all value for its fields and
|
145 |
-
* should return the same payload after having been sanitized.
|
146 |
-
*
|
147 |
-
* Do not, encode the payload as this is performed by the
|
148 |
-
* universal_sanitize_and_encode_handler() of the parent class.
|
149 |
-
*
|
150 |
-
* @param array $field_values The array map with field values.
|
151 |
-
* @since 0.5
|
152 |
-
*/
|
153 |
-
public function sanitize_option_fields( $field_values ) {
|
154 |
-
foreach ( $field_values as $field_id => $field_value ) {
|
155 |
-
$field = self::$fields[ $field_id ];
|
156 |
-
|
157 |
-
switch ( $field_id ) {
|
158 |
-
case 'ad_source':
|
159 |
-
$all_options = array();
|
160 |
-
|
161 |
-
$registered_compat_ads = Instant_Articles_Option::get_registered_compat(
|
162 |
-
'instant_articles_compat_registry_ads'
|
163 |
-
);
|
164 |
-
|
165 |
-
foreach ( $field['select_options'] as $option_id => $option_info ) {
|
166 |
-
$all_options[] = $option_id;
|
167 |
-
}
|
168 |
-
foreach ( $registered_compat_ads as $compat_id => $compat_info ) {
|
169 |
-
$all_options[] = $compat_id;
|
170 |
-
}
|
171 |
-
|
172 |
-
if ( ! in_array( $field_value, $all_options, true ) ) {
|
173 |
-
$field_values[ $field_id ] = $field['default'];
|
174 |
-
add_settings_error(
|
175 |
-
$field_id,
|
176 |
-
'invalid_option',
|
177 |
-
'Invalid Ad Source'
|
178 |
-
);
|
179 |
-
}
|
180 |
-
break;
|
181 |
-
|
182 |
-
case 'fan_placement_id':
|
183 |
-
if ( isset( $field_values['ad_source'] ) && 'fan' === $field_values['ad_source'] ) {
|
184 |
-
if ( preg_match( '/^[0-9_]+$/', $field_values[ $field_id ] ) !== 1 ) {
|
185 |
-
add_settings_error(
|
186 |
-
$field_id,
|
187 |
-
'invalid_placement_id',
|
188 |
-
'Invalid Audience Network Placement ID provided'
|
189 |
-
);
|
190 |
-
$field_values[ $field_id ] = $field['default'];
|
191 |
-
}
|
192 |
-
}
|
193 |
-
break;
|
194 |
-
|
195 |
-
case 'iframe_url':
|
196 |
-
if ( isset( $field_values['ad_source'] ) && 'iframe' === $field_values['ad_source'] ) {
|
197 |
-
$url = $field_values[ $field_id ];
|
198 |
-
if ( substr( $url, 0, 2 ) === '//' ) {
|
199 |
-
// Allow URLs without protocol prefix
|
200 |
-
$url = 'http:' . $url;
|
201 |
-
}
|
202 |
-
$url = filter_var( $url , FILTER_VALIDATE_URL );
|
203 |
-
if ( ! $url ) {
|
204 |
-
$field_values[ $field_id ] = $field['default'];
|
205 |
-
add_settings_error(
|
206 |
-
$field_id,
|
207 |
-
'invalid_url',
|
208 |
-
'Invalid URL provided for Ad iframe'
|
209 |
-
);
|
210 |
-
}
|
211 |
-
}
|
212 |
-
break;
|
213 |
-
|
214 |
-
case 'embed_code':
|
215 |
-
if ( isset( $field_values['ad_source'] ) && 'embed' === $field_values['ad_source'] ) {
|
216 |
-
$document = new DOMDocument();
|
217 |
-
$fragment = $document->createDocumentFragment();
|
218 |
-
if ( ! @$fragment->appendXML( $field_values[ $field_id ] ) ) {
|
219 |
-
add_settings_error(
|
220 |
-
'embed_code',
|
221 |
-
'invalid_markup',
|
222 |
-
'Invalid HTML markup provided for ad custom embed code'
|
223 |
-
);
|
224 |
-
}
|
225 |
-
}
|
226 |
-
break;
|
227 |
-
|
228 |
-
case 'dimensions':
|
229 |
-
if ( isset( $field_values['ad_source'] ) && 'none' !== $field_values['ad_source'] ) {
|
230 |
-
if ( ! array_key_exists( $field_value, $field['select_options'] ) ) {
|
231 |
-
$field_values[ $field_id ] = $field['default'];
|
232 |
-
add_settings_error(
|
233 |
-
'embed_code',
|
234 |
-
'invalid_dimensions',
|
235 |
-
'Invalid dimensions provided for Ad'
|
236 |
-
);
|
237 |
-
}
|
238 |
-
}
|
239 |
-
break;
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
return $field_values;
|
244 |
-
}
|
245 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-option-analytics.php
DELETED
@@ -1,144 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Analytics configuration class.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_Analytics extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-analytics';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => 'Analytics',
|
21 |
-
'description' => '<p>Enable 3rd-party analytics to be used with Instant Articles.</p><p>If you already use a WordPress plugin to manage analytics, you can enable it below. You can also embed code to insert your own trackers and analytics. <a href="https://developers.facebook.com/docs/instant-articles/ads-analytics#analytics" target="_blank">Learn more about Analytics in Instant Articles</a>.</p>',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'integrations' => array(
|
27 |
-
'label' => '3rd party integrations',
|
28 |
-
'render' => array( 'Instant_Articles_Option_Analytics', 'custom_render_integrations' ),
|
29 |
-
'default' => array(),
|
30 |
-
),
|
31 |
-
|
32 |
-
'embed_code_enabled' => array(
|
33 |
-
'label' => 'Embed code',
|
34 |
-
'render' => 'checkbox',
|
35 |
-
'default' => false,
|
36 |
-
'description' => 'Add code for any other analytics services you wish to use.',
|
37 |
-
'checkbox_label' => 'Enable custom embed code',
|
38 |
-
),
|
39 |
-
|
40 |
-
'embed_code' => array(
|
41 |
-
'label' => '',
|
42 |
-
'render' => 'textarea',
|
43 |
-
'placeholder' => '<script>...</script>',
|
44 |
-
'description' => 'Note: You do not need to include any <op-tracker> tags. The plugin will automatically include them in the article markup.',
|
45 |
-
'default' => '',
|
46 |
-
'double_encode' => true,
|
47 |
-
),
|
48 |
-
);
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Constructor.
|
52 |
-
*
|
53 |
-
* @since 0.4
|
54 |
-
*/
|
55 |
-
public function __construct() {
|
56 |
-
parent::__construct(
|
57 |
-
self::OPTION_KEY,
|
58 |
-
self::$sections,
|
59 |
-
self::$fields
|
60 |
-
);
|
61 |
-
wp_localize_script( 'instant-articles-option-analytics', 'INSTANT_ARTICLES_OPTION_ANALYTICS', array(
|
62 |
-
'option_field_id_embed_code_enabled' => self::OPTION_KEY . '-embed_code_enabled',
|
63 |
-
'option_field_id_embed_code' => self::OPTION_KEY . '-embed_code',
|
64 |
-
) );
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Renders the markup for the `integrations` field.
|
69 |
-
*
|
70 |
-
* @param array $args The array with configuration of fields.
|
71 |
-
* @since 0.4
|
72 |
-
*/
|
73 |
-
public static function custom_render_integrations( $args ) {
|
74 |
-
$name = $args['serialized_with_group'] . '[integrations][]';
|
75 |
-
|
76 |
-
$compat_plugins = parent::get_registered_compat( 'instant_articles_compat_registry_analytics' );
|
77 |
-
|
78 |
-
if ( empty( $compat_plugins ) ) {
|
79 |
-
?>
|
80 |
-
<em>
|
81 |
-
<?php echo esc_html( 'No supported analytics plugins are installed nor activated' ); ?>
|
82 |
-
</em>
|
83 |
-
<?php
|
84 |
-
|
85 |
-
return;
|
86 |
-
}
|
87 |
-
|
88 |
-
asort( $compat_plugins );
|
89 |
-
foreach ( $compat_plugins as $plugin_id => $plugin_info ) {
|
90 |
-
?>
|
91 |
-
<label>
|
92 |
-
<input
|
93 |
-
type="checkbox"
|
94 |
-
name="<?php echo esc_attr( $name ); ?>"
|
95 |
-
value="<?php echo esc_attr( $plugin_id ); ?>"
|
96 |
-
<?php echo checked( in_array( $plugin_id, self::$settings['integrations'], true ) ) ?>
|
97 |
-
>
|
98 |
-
<?php echo esc_html( $plugin_info['name'] ); ?>
|
99 |
-
</label>
|
100 |
-
<br />
|
101 |
-
<?php
|
102 |
-
}
|
103 |
-
?>
|
104 |
-
<p class="description">Select which analytics services you'd like to use with Instant Articles.</p>
|
105 |
-
<?php
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Sanitize and return all the field values.
|
110 |
-
*
|
111 |
-
* This method receives a payload containing all value for its fields and
|
112 |
-
* should return the same payload after having been sanitized.
|
113 |
-
*
|
114 |
-
* Do not encode the payload as this is performed by the
|
115 |
-
* universal_sanitize_and_encode_handler() of the parent class.
|
116 |
-
*
|
117 |
-
* @param array $field_values The values in an array mapped keys.
|
118 |
-
* @since 0.5
|
119 |
-
*/
|
120 |
-
public function sanitize_option_fields( $field_values ) {
|
121 |
-
foreach ( $field_values as $field_id => $field_value ) {
|
122 |
-
$field = self::$fields[ $field_id ];
|
123 |
-
|
124 |
-
switch ( $field_id ) {
|
125 |
-
case 'embed_code':
|
126 |
-
if ( isset( $field_values['embed_code_enabled'] ) && $field_values['embed_code_enabled'] ) {
|
127 |
-
$document = new DOMDocument();
|
128 |
-
$fragment = $document->createDocumentFragment();
|
129 |
-
if ( ! @$fragment->appendXML( $field_values[ $field_id ] ) ) {
|
130 |
-
add_settings_error(
|
131 |
-
'embed_code',
|
132 |
-
'invalid_markup',
|
133 |
-
'Invalid HTML markup provided for custom analytics tracker code'
|
134 |
-
);
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
-
break;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
return $field_values;
|
143 |
-
}
|
144 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-option-fb-app.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* The Instant Articles FB app configuration.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_FB_App extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-fb-app';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => '',
|
21 |
-
'description' => '',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'app_id' => array(
|
27 |
-
'label' => 'App ID',
|
28 |
-
'default' => '',
|
29 |
-
),
|
30 |
-
|
31 |
-
'app_secret' => array(
|
32 |
-
'label' => 'App Secret',
|
33 |
-
'render' => 'password',
|
34 |
-
'default' => '',
|
35 |
-
),
|
36 |
-
|
37 |
-
);
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Consturctor.
|
41 |
-
*
|
42 |
-
* @since 0.4
|
43 |
-
*/
|
44 |
-
public function __construct() {
|
45 |
-
$this->options_manager = new parent(
|
46 |
-
self::OPTION_KEY,
|
47 |
-
self::$sections,
|
48 |
-
self::$fields,
|
49 |
-
/**
|
50 |
-
* Register this Option on a specific page group (used as the first
|
51 |
-
* argument of `register_setting()` and called by `settings_fields()`).
|
52 |
-
*
|
53 |
-
* @since 0.5
|
54 |
-
*/
|
55 |
-
Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD
|
56 |
-
);
|
57 |
-
}
|
58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-option-fb-page.php
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* FB Page configuration.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_FB_Page extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-fb-page';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => '',
|
21 |
-
'description' => '',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'page_id' => array(
|
27 |
-
'visible' => false,
|
28 |
-
'label' => 'Page ID',
|
29 |
-
'default' => '',
|
30 |
-
),
|
31 |
-
|
32 |
-
'page_name' => array(
|
33 |
-
'visible' => false,
|
34 |
-
'label' => 'Page Name',
|
35 |
-
'default' => '',
|
36 |
-
),
|
37 |
-
|
38 |
-
'page_access_token' => array(
|
39 |
-
'visible' => false,
|
40 |
-
'label' => 'Page Access Token',
|
41 |
-
'default' => '',
|
42 |
-
),
|
43 |
-
|
44 |
-
'page_access_token_expiration' => array(
|
45 |
-
'visible' => false,
|
46 |
-
'label' => 'Page Token Expiration',
|
47 |
-
'default' => '',
|
48 |
-
),
|
49 |
-
|
50 |
-
);
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Constructor.
|
54 |
-
*
|
55 |
-
* @since 0.4
|
56 |
-
*/
|
57 |
-
public function __construct() {
|
58 |
-
$this->options_manager = new parent(
|
59 |
-
self::OPTION_KEY,
|
60 |
-
self::$sections,
|
61 |
-
self::$fields,
|
62 |
-
/**
|
63 |
-
* Register this Option on a specific page group (used as the first
|
64 |
-
* argument of `register_setting()` and called by `settings_fields()`).
|
65 |
-
*
|
66 |
-
* @since 0.5
|
67 |
-
*/
|
68 |
-
Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD
|
69 |
-
);
|
70 |
-
}
|
71 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-option-publishing.php
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class for publishing configuration.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_Publishing extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-publishing';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => 'Publishing Settings',
|
21 |
-
);
|
22 |
-
|
23 |
-
public static $fields = array(
|
24 |
-
|
25 |
-
'dev_mode' => array(
|
26 |
-
'label' => 'Development Mode',
|
27 |
-
'description' => 'Articles published while in Development Mode are saved as "drafts" within Facebook and will not be made live. Note: Since articles in "draft" are not reviewed, Development Mode should be disabled when publishing articles to Facebook which you intend to use in your <a href="https://developers.facebook.com/docs/instant-articles/publishing#review" target="_blank">one-time review</a>.',
|
28 |
-
'render' => 'checkbox',
|
29 |
-
'default' => false,
|
30 |
-
'checkbox_label' => 'Enable development mode',
|
31 |
-
),
|
32 |
-
|
33 |
-
'custom_rules_enabled' => array(
|
34 |
-
'label' => 'Custom transformer rules',
|
35 |
-
'render' => 'checkbox',
|
36 |
-
'default' => '',
|
37 |
-
'checkbox_label' => 'Enable custom transformer rules',
|
38 |
-
'description' => 'Define your own rules to customize the transformation of your content into Instant Articles',
|
39 |
-
'default' => '',
|
40 |
-
),
|
41 |
-
|
42 |
-
'custom_rules' => array(
|
43 |
-
'label' => '',
|
44 |
-
'render' => 'textarea',
|
45 |
-
'placeholder' => '{ "rules": [{ "class": "BoldRule", "selector": "span.bold" }, ... ] }',
|
46 |
-
'description' => 'Read more about <a href="https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/docs/QuickStart.md#custom-transformer-rules" target="_blank">defining your own custom rules</a> to extend/override the <a href="https://github.com/Automattic/facebook-instant-articles-wp/blob/master/rules-configuration.json" target="_blank">built-in ruleset</a>. If you\'ve defined a common rule which you think this plugin should include by default, <a href="https://github.com/Automattic/facebook-instant-articles-wp/issues/new" target="_blank">tell us about it</a>!',
|
47 |
-
'default' => '',
|
48 |
-
),
|
49 |
-
|
50 |
-
);
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Constructor.
|
54 |
-
*
|
55 |
-
* @since 0.4
|
56 |
-
*/
|
57 |
-
public function __construct() {
|
58 |
-
parent::__construct(
|
59 |
-
self::OPTION_KEY,
|
60 |
-
self::$sections,
|
61 |
-
self::$fields
|
62 |
-
);
|
63 |
-
wp_localize_script( 'instant-articles-option-publishing', 'INSTANT_ARTICLES_OPTION_PUBLISHING', array(
|
64 |
-
'option_field_id_custom_rules_enabled' => self::OPTION_KEY . '-custom_rules_enabled',
|
65 |
-
'option_field_id_custom_rules' => self::OPTION_KEY . '-custom_rules',
|
66 |
-
) );
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Sanitize and return all the field values.
|
71 |
-
*
|
72 |
-
* This method receives a payload containing all value for its fields and
|
73 |
-
* should return the same payload after having been sanitized.
|
74 |
-
*
|
75 |
-
* Do not encode the payload as this is performed by the
|
76 |
-
* universal_sanitize_and_encode_handler() of the parent class.
|
77 |
-
*
|
78 |
-
* @param array $field_values array map with key field_id => value.
|
79 |
-
* @since 0.5
|
80 |
-
*/
|
81 |
-
public function sanitize_option_fields( $field_values ) {
|
82 |
-
foreach ( $field_values as $field_id => $field_value ) {
|
83 |
-
$field = self::$fields[ $field_id ];
|
84 |
-
|
85 |
-
switch ( $field_id ) {
|
86 |
-
case 'dev_mode':
|
87 |
-
$field_values[ $field_id ] = (bool) $field_value
|
88 |
-
? (string) true
|
89 |
-
: (string) $field['default'];
|
90 |
-
break;
|
91 |
-
|
92 |
-
case 'custom_rules':
|
93 |
-
if ( isset( $field_values['custom_rules_enabled'] ) && $field_values['custom_rules_enabled'] ) {
|
94 |
-
$custom_rules_json = json_decode( $field_values['custom_rules'] );
|
95 |
-
if ( null === $custom_rules_json ) {
|
96 |
-
$field_values['custom_rules'] = $field['default'];
|
97 |
-
add_settings_error(
|
98 |
-
'custom_embed',
|
99 |
-
'invalid_json',
|
100 |
-
'Invalid JSON provided for custom rules code'
|
101 |
-
);
|
102 |
-
}
|
103 |
-
}
|
104 |
-
break;
|
105 |
-
|
106 |
-
default:
|
107 |
-
// Should never happen.
|
108 |
-
break;
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
return $field_values;
|
113 |
-
}
|
114 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-option-styles.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Configuration class for Ads.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_Styles extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-styles';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => 'Styles',
|
21 |
-
'description' => '<p>Assign your Instant Articles a custom style. To begin, customize a template using the Style Editor. Next, input the name of the style below.</p><p><strong>Note:</strong> If this field is left blank, the plugin will enable the “Default” style. Learn more about Instant Articles style options in the <a href="https://developers.facebook.com/docs/instant-articles/guides/design" target="_blank">Design Guide</a>.</p>',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'article_style' => array(
|
27 |
-
'label' => 'Article Style',
|
28 |
-
'default' => 'default',
|
29 |
-
),
|
30 |
-
|
31 |
-
);
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Constructor.
|
35 |
-
*
|
36 |
-
* @since 0.4
|
37 |
-
*/
|
38 |
-
public function __construct() {
|
39 |
-
parent::__construct(
|
40 |
-
self::OPTION_KEY,
|
41 |
-
self::$sections,
|
42 |
-
self::$fields
|
43 |
-
);
|
44 |
-
}
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-option.php
DELETED
@@ -1,457 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Base class for configurations.
|
12 |
-
*/
|
13 |
-
class Instant_Articles_Option {
|
14 |
-
|
15 |
-
const PAGE_OPTION_GROUP = 'instant-articles-settings';
|
16 |
-
const PAGE_OPTION_GROUP_WIZARD = 'instant-articles-settings-wizard';
|
17 |
-
public static $fields = array();
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Settings for options.
|
21 |
-
*
|
22 |
-
* @var array $settings The settings for each option.
|
23 |
-
*/
|
24 |
-
public static $settings = array();
|
25 |
-
|
26 |
-
/**
|
27 |
-
* The key for field.
|
28 |
-
*
|
29 |
-
* @var string $key The key for field.
|
30 |
-
*/
|
31 |
-
private $key;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Each section.
|
35 |
-
*
|
36 |
-
* @var array $sections The sections where fields will be stored/showed.
|
37 |
-
*/
|
38 |
-
private $sections;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Page options.
|
42 |
-
*
|
43 |
-
* @var array $page_option_group
|
44 |
-
*/
|
45 |
-
private $page_option_group;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Contains all the fields for the option. Supported field properties:
|
49 |
-
*
|
50 |
-
* Id - String. COMING SOON (to avoid using the key as the identifier)
|
51 |
-
* visible - Boolean. Use this to hide the entire row of the rendered field in the UI. Defaults to true.
|
52 |
-
* disable - Boolean|Array. Use to place the `disabled` attribute on the field. For fields with multiple options (<select>) an Array containing keys of all disabled `select_options` can be defined. Defaults to false.
|
53 |
-
* serialized_with_group - String|false/null. Controls whether a particular field of a setting is serialized with the group or saved as its own independant option. Defaults to true.
|
54 |
-
* label - String|null. The label for the field.
|
55 |
-
* description - String. The description for the field, rendered as additional information below the field.
|
56 |
-
* render - String|Function. How the field should be rendered as. Non-strings are assumed to be a function for rendering the field (third parameter of `add_settings_field()`). If a String, it is meant to be any of the standard <form> input types (checkbox, radio, textarea, hidden, select, textarea, password etc.') and the rendering will be handled by self::universal_render_handler(); if not defined, "text" is assumed
|
57 |
-
* select_options - Array. Defines the <options> for a checkbox (key of this Array is used as its `value` attribute). Only used if the `render` is "select".
|
58 |
-
* radio_options - Array. TO BE IMPLEMENTED (should mimic the "select_options" functionality)
|
59 |
-
* placeholder - String. Used as the `placeholder` attribute for the <form> field.
|
60 |
-
* default - String|null. Used as a default value for the field when there is no value yet saved in the db.
|
61 |
-
*
|
62 |
-
* @var array $fields The fields for option and its properties.
|
63 |
-
* @since 0.4
|
64 |
-
*/
|
65 |
-
private $field_definitions;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* If $option_group is not specified, the Option will be registered with a
|
69 |
-
* "default" page group (the first argument of `register_setting()` and called
|
70 |
-
* by `settings_fields()`).
|
71 |
-
*
|
72 |
-
* @param string $option_key The ID for the field.
|
73 |
-
* @param array $sections The sections for each field.
|
74 |
-
* @param array $option_fields All the fields.
|
75 |
-
* @param array $option_group Optional, if not informed will use self::PAGE_OPTION_GROUP.
|
76 |
-
* @since 0.4
|
77 |
-
*/
|
78 |
-
public function __construct( $option_key, $sections, $option_fields, $option_group = null ) {
|
79 |
-
$this->key = $option_key;
|
80 |
-
$this->sections = $sections;
|
81 |
-
$this->field_definitions = $option_fields;
|
82 |
-
$this->page_option_group = null === $option_group
|
83 |
-
? self::PAGE_OPTION_GROUP
|
84 |
-
: $option_group;
|
85 |
-
|
86 |
-
$this->init();
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Option initiator.
|
91 |
-
*
|
92 |
-
* @since 0.4
|
93 |
-
*/
|
94 |
-
private function init() {
|
95 |
-
$saved_options = self::get_option_decoded( $this->key );
|
96 |
-
|
97 |
-
foreach ( $this->field_definitions as $field_key => $field ) {
|
98 |
-
self::$settings[ $field_key ] = isset( $saved_options[ $field_key ] )
|
99 |
-
? $saved_options[ $field_key ]
|
100 |
-
: $field['default'];
|
101 |
-
}
|
102 |
-
|
103 |
-
$this->wp_bootstrap_register_option();
|
104 |
-
$this->wp_bootstrap_create_sections();
|
105 |
-
$this->wp_bootstrap_add_fields_to_section();
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Decodes the option.
|
110 |
-
*
|
111 |
-
* @param string $option_key to be returned.
|
112 |
-
* @return array from a json decoded content.
|
113 |
-
* @since 0.4
|
114 |
-
*/
|
115 |
-
public static function get_option_decoded( $option_key = null ) {
|
116 |
-
if ( ! isset( $option_key ) ) {
|
117 |
-
// Late Static Binding to use the const OPTION_KEY from the child class which called this function.
|
118 |
-
$option_key = static::OPTION_KEY;
|
119 |
-
}
|
120 |
-
|
121 |
-
$raw_data = get_option( $option_key );
|
122 |
-
|
123 |
-
// Hack which creates an empty setting if it doesn't yet exist.
|
124 |
-
// Temporary solution to an unknown oddity which is double-escaping the JSON
|
125 |
-
// data as a string when attempting to access a setting that doesn't exist.
|
126 |
-
if ( false === $raw_data ) {
|
127 |
-
add_option( $option_key );
|
128 |
-
$raw_data = get_option( $option_key );
|
129 |
-
}
|
130 |
-
|
131 |
-
return json_decode( $raw_data, true );
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Obtains the compat related to $action_tag.
|
136 |
-
*
|
137 |
-
* @param string $action_tag The tag registered compat will be retrieved.
|
138 |
-
* @since 0.4
|
139 |
-
*/
|
140 |
-
public static function get_registered_compat( $action_tag ) {
|
141 |
-
$registered_compat_integrations = array();
|
142 |
-
|
143 |
-
do_action_ref_array(
|
144 |
-
$action_tag,
|
145 |
-
array( &$registered_compat_integrations )
|
146 |
-
);
|
147 |
-
return $registered_compat_integrations;
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Registers the sanitization and encoding handler.
|
152 |
-
*
|
153 |
-
* @since 0.4
|
154 |
-
*/
|
155 |
-
private function wp_bootstrap_register_option() {
|
156 |
-
register_setting(
|
157 |
-
$this->page_option_group,
|
158 |
-
$this->key,
|
159 |
-
array( $this, 'universal_sanitize_and_encode_handler' )
|
160 |
-
);
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Create title and description sections.
|
165 |
-
*
|
166 |
-
* @since 0.4
|
167 |
-
*/
|
168 |
-
private function wp_bootstrap_create_sections() {
|
169 |
-
$title = isset( $this->sections['title'] )
|
170 |
-
? $this->sections['title']
|
171 |
-
: '';
|
172 |
-
|
173 |
-
$description = isset( $this->sections['description'] )
|
174 |
-
? wp_kses(
|
175 |
-
$this->sections['description'],
|
176 |
-
array(
|
177 |
-
'a' => array(
|
178 |
-
'href' => array(),
|
179 |
-
'target' => array(),
|
180 |
-
),
|
181 |
-
'em' => array(),
|
182 |
-
'p' => array(),
|
183 |
-
'strong' => array(),
|
184 |
-
)
|
185 |
-
)
|
186 |
-
: '';
|
187 |
-
|
188 |
-
add_settings_section(
|
189 |
-
$this->key,
|
190 |
-
esc_html( $title ),
|
191 |
-
function () use ( $description ) {
|
192 |
-
echo wp_kses_post( $description );
|
193 |
-
},
|
194 |
-
$this->key
|
195 |
-
);
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Add fields to defined section.
|
200 |
-
*
|
201 |
-
* @since 0.4
|
202 |
-
*/
|
203 |
-
private function wp_bootstrap_add_fields_to_section() {
|
204 |
-
foreach ( $this->field_definitions as $field_key => $field ) {
|
205 |
-
$standalone_id = $this->key . '-' . $field_key;
|
206 |
-
|
207 |
-
// Default values of arguments for renderer.
|
208 |
-
$renderer_args = array(
|
209 |
-
// The "label_for" arg causes WordPress to wrap the label of the field with a <label> tag.
|
210 |
-
'label_for' => $standalone_id,
|
211 |
-
'serialized_with_group' => $this->key,
|
212 |
-
'render' => 'text',
|
213 |
-
'value' => self::$settings[ $field_key ],
|
214 |
-
);
|
215 |
-
|
216 |
-
// Override default arguments for renderer.
|
217 |
-
foreach ( $field as $key => $val ) {
|
218 |
-
$renderer_args[ $key ] = $val;
|
219 |
-
|
220 |
-
// The WordPress do_settings_fields() will add a `class` attribute to
|
221 |
-
// the <tr> tag of the rendered output with value of anything defined in
|
222 |
-
// a "class" key of the args for the renderer.
|
223 |
-
// We force it to include a value of "hidden" since this class is
|
224 |
-
// defined in WordPress's global CSS with `display: none;`.
|
225 |
-
if ( 'visible' === $key && false === $val ) {
|
226 |
-
$renderer_args['class'] = ( ! empty( $renderer_args['class'] )
|
227 |
-
? $renderer_args['class'] . ' '
|
228 |
-
: '') . 'hidden';
|
229 |
-
}
|
230 |
-
}
|
231 |
-
|
232 |
-
$renderer_handle = 'string' === gettype( $renderer_args['render'] )
|
233 |
-
? array( 'Instant_Articles_Option', 'universal_render_handler' )
|
234 |
-
: $renderer_args['render'];
|
235 |
-
|
236 |
-
add_settings_field(
|
237 |
-
$standalone_id,
|
238 |
-
$field['label'],
|
239 |
-
$renderer_handle,
|
240 |
-
$this->key,
|
241 |
-
$this->key,
|
242 |
-
$renderer_args
|
243 |
-
);
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Function to render all fields with its labels and inputs.
|
249 |
-
*
|
250 |
-
* @param array $args array map with its field names and values.
|
251 |
-
* @since 0.4
|
252 |
-
*/
|
253 |
-
public static function universal_render_handler( $args = null ) {
|
254 |
-
$id = isset( $args['label_for'] )
|
255 |
-
? $args['label_for']
|
256 |
-
: '';
|
257 |
-
|
258 |
-
$type = isset( $args['render'] ) && gettype( 'string' === $args['render'] )
|
259 |
-
? $args['render']
|
260 |
-
: 'text';
|
261 |
-
|
262 |
-
if ( ! empty( $args['value'] ) ) {
|
263 |
-
$option_value = $args['value'];
|
264 |
-
} elseif ( ! empty( $args['default'] ) ) {
|
265 |
-
$option_value = $args['default'];
|
266 |
-
} else {
|
267 |
-
$option_value = '';
|
268 |
-
}
|
269 |
-
|
270 |
-
// Determines correct values based on whether the settings option
|
271 |
-
// is intended to be serialized as a field of a parent option name.
|
272 |
-
if ( gettype( 'string' === $args['serialized_with_group'] ) ) {
|
273 |
-
$group = $args['serialized_with_group'];
|
274 |
-
$group_key = substr( $id, strlen( $group . '-' ) );
|
275 |
-
$name = $group . '[' . $group_key . ']';
|
276 |
-
} else {
|
277 |
-
$name = $id;
|
278 |
-
}
|
279 |
-
|
280 |
-
$placeholder = isset( $args['placeholder'] )
|
281 |
-
? $args['placeholder']
|
282 |
-
: '';
|
283 |
-
|
284 |
-
$attr_disabled = isset( $args['disable'] ) && true === $args['disable']
|
285 |
-
? disabled()
|
286 |
-
: '';
|
287 |
-
|
288 |
-
$field_description = isset( $args['description'] )
|
289 |
-
? wp_kses(
|
290 |
-
$args['description'],
|
291 |
-
array(
|
292 |
-
'a' => array(
|
293 |
-
'href' => array(),
|
294 |
-
'target' => array(),
|
295 |
-
),
|
296 |
-
'em' => array(),
|
297 |
-
'strong' => array(),
|
298 |
-
)
|
299 |
-
)
|
300 |
-
: '';
|
301 |
-
|
302 |
-
$field_checkbox_label = isset( $args['checkbox_label'] )
|
303 |
-
? $args['checkbox_label']
|
304 |
-
: '';
|
305 |
-
|
306 |
-
switch ( $type ) {
|
307 |
-
case 'hidden':
|
308 |
-
?>
|
309 |
-
<input
|
310 |
-
type="hidden"
|
311 |
-
name="<?php echo esc_attr( $name ) ?>"
|
312 |
-
id="<?php echo esc_attr( $id ) ?>"
|
313 |
-
value="<?php echo esc_attr( $option_value ); ?>"
|
314 |
-
/>
|
315 |
-
<?php if ( $field_description ) : ?>
|
316 |
-
<p class="description">
|
317 |
-
<?php echo wp_kses_post( $field_description ); ?>
|
318 |
-
</p>
|
319 |
-
<?php endif; ?>
|
320 |
-
<?php
|
321 |
-
break;
|
322 |
-
|
323 |
-
case 'checkbox':
|
324 |
-
$attr_checked = checked( 1, $option_value, false );
|
325 |
-
?>
|
326 |
-
<label>
|
327 |
-
<input
|
328 |
-
type="checkbox"
|
329 |
-
value="1"
|
330 |
-
name="<?php echo esc_attr( $name ) ?>"
|
331 |
-
id="<?php echo esc_attr( $id ) ?>"
|
332 |
-
<?php echo esc_attr( $attr_checked ); ?>
|
333 |
-
<?php echo esc_attr( $attr_disabled ); ?>
|
334 |
-
/>
|
335 |
-
<?php echo esc_html( $field_checkbox_label ); ?>
|
336 |
-
</label>
|
337 |
-
<?php if ( $field_description ) : ?>
|
338 |
-
<p class="description">
|
339 |
-
<?php echo wp_kses_post( $field_description ); ?>
|
340 |
-
</p>
|
341 |
-
<?php endif; ?>
|
342 |
-
<?php
|
343 |
-
break;
|
344 |
-
|
345 |
-
case 'select':
|
346 |
-
?>
|
347 |
-
<select
|
348 |
-
id="<?php echo esc_attr( $id ) ?>"
|
349 |
-
name="<?php echo esc_attr( $name ) ?>"
|
350 |
-
<?php echo esc_html( $attr_disabled ) ?>
|
351 |
-
>
|
352 |
-
<?php foreach ( $args['select_options'] as $option_key => $option_name ) : ?>
|
353 |
-
<option
|
354 |
-
value="<?php echo esc_attr( $option_key ) ?>"
|
355 |
-
<?php echo selected( $option_key, $option_value ) ?>
|
356 |
-
<?php echo isset( $args['disable'] )
|
357 |
-
&& gettype( $args['disable'] ) === 'array'
|
358 |
-
&& in_array( $option_key, $args['disable'], true )
|
359 |
-
? disabled()
|
360 |
-
: '';
|
361 |
-
?>
|
362 |
-
>
|
363 |
-
<?php echo esc_html( $option_name ); ?>
|
364 |
-
</option>
|
365 |
-
<?php endforeach; ?>
|
366 |
-
</select>
|
367 |
-
<?php if ( $field_description ) : ?>
|
368 |
-
<p class="description">
|
369 |
-
<?php echo wp_kses_post( $field_description ); ?>
|
370 |
-
</p>
|
371 |
-
<?php endif; ?>
|
372 |
-
<?php
|
373 |
-
break;
|
374 |
-
|
375 |
-
case 'textarea':
|
376 |
-
?>
|
377 |
-
<textarea
|
378 |
-
name="<?php echo esc_attr( $name ) ?>"
|
379 |
-
id="<?php echo esc_attr( $id ) ?>"
|
380 |
-
<?php if ( $placeholder ) : ?>
|
381 |
-
placeholder="<?php echo esc_attr( $placeholder ); ?>"
|
382 |
-
<?php endif; ?>
|
383 |
-
<?php echo esc_attr( $attr_disabled ); ?>
|
384 |
-
class="large-text code"
|
385 |
-
rows="8"
|
386 |
-
><?php echo $args[ 'double_encode' ] ? htmlspecialchars( $option_value ) : esc_html( $option_value ); ?></textarea>
|
387 |
-
<?php if ( $field_description ) : ?>
|
388 |
-
<p class="description">
|
389 |
-
<?php echo wp_kses_post( $field_description); ?>
|
390 |
-
</p>
|
391 |
-
<?php endif; ?>
|
392 |
-
<?php
|
393 |
-
break;
|
394 |
-
|
395 |
-
case 'text':
|
396 |
-
case 'password':
|
397 |
-
default:
|
398 |
-
?>
|
399 |
-
<input
|
400 |
-
type="<?php echo esc_attr( $type ) ?>"
|
401 |
-
name="<?php echo esc_attr( $name ) ?>"
|
402 |
-
id="<?php echo esc_attr( $id ) ?>"
|
403 |
-
<?php if ( $placeholder ) : ?>
|
404 |
-
placeholder="<?php echo esc_attr( $placeholder ) ?>"
|
405 |
-
<?php endif; ?>
|
406 |
-
<?php echo esc_attr( $attr_disabled ) ?>
|
407 |
-
value="<?php echo esc_attr( $option_value ) ?>"
|
408 |
-
class="regular-text"
|
409 |
-
/>
|
410 |
-
<?php if ( $field_description ) : ?>
|
411 |
-
<p class="description">
|
412 |
-
<?php echo wp_kses_post( $field_description ); ?>
|
413 |
-
</p>
|
414 |
-
<?php endif; ?>
|
415 |
-
<?php
|
416 |
-
break;
|
417 |
-
}
|
418 |
-
}
|
419 |
-
|
420 |
-
/**
|
421 |
-
* Intercepts the form data for an individual option on its way to the server.
|
422 |
-
* Receives one argument containing the payload data and passes it along to
|
423 |
-
* the child's own sanitation method. Returns an encoded payload for it
|
424 |
-
* to continue its way to the server.
|
425 |
-
*
|
426 |
-
* @param array $payload map of fields and their values.
|
427 |
-
* @return string encoded json with fields.
|
428 |
-
* @since 0.5
|
429 |
-
*/
|
430 |
-
public function universal_sanitize_and_encode_handler( $payload ) {
|
431 |
-
// Handle empty payload.
|
432 |
-
if ( ! is_array( $payload ) ) {
|
433 |
-
$payload = array();
|
434 |
-
}
|
435 |
-
|
436 |
-
// Remove any fields which could have been injected into the payload client-side.
|
437 |
-
$allowed_payload = array_intersect_key( $payload, static::$fields );
|
438 |
-
$allowed_payload = $payload;
|
439 |
-
|
440 |
-
// Pass the value along to the Child class's method to perform sanitation on its fields.
|
441 |
-
$sanitized_payload = static::sanitize_option_fields( $allowed_payload );
|
442 |
-
|
443 |
-
// Encode the payload into JSON before it's sent off to be saved.
|
444 |
-
return wp_json_encode( $sanitized_payload );
|
445 |
-
}
|
446 |
-
|
447 |
-
/**
|
448 |
-
* "Pass through" function. This should be overridden in child classes which
|
449 |
-
* are responsible for sanitizing its own $field_values.
|
450 |
-
*
|
451 |
-
* @param array $field_values array of values for fields.
|
452 |
-
* @since 0.5
|
453 |
-
*/
|
454 |
-
public function sanitize_option_fields( $field_values ) {
|
455 |
-
return $field_values;
|
456 |
-
}
|
457 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-settings-fb-page.php
DELETED
@@ -1,181 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
use Facebook\PersistentData\PersistentDataInterface;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class responsible for functionality and rendering of the settings
|
14 |
-
*
|
15 |
-
* @since 0.4
|
16 |
-
*/
|
17 |
-
class Instant_Articles_Settings_FB_Page implements PersistentDataInterface {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var string Prefix to use for session options.
|
21 |
-
*/
|
22 |
-
protected $session_prefix = 'instant_articles_fbrlh_';
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @inheritdoc
|
26 |
-
*/
|
27 |
-
public function get( $key ) {
|
28 |
-
|
29 |
-
return get_option( $this->session_prefix . $key );
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @inheritdoc
|
34 |
-
*/
|
35 |
-
public function set( $key, $value ) {
|
36 |
-
|
37 |
-
update_option( $this->session_prefix . $key, $value );
|
38 |
-
}
|
39 |
-
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Facebook Permissions.
|
43 |
-
*
|
44 |
-
* @var array $fb_app_permissions The permissions asked for FB user to list pages he manages.
|
45 |
-
*/
|
46 |
-
public static $fb_app_permissions = array( 'pages_manage_instant_articles', 'pages_show_list' );
|
47 |
-
|
48 |
-
/**
|
49 |
-
* SDK instance.
|
50 |
-
*
|
51 |
-
* @var Facebook $fb_sdk the instance reference to FB sdk
|
52 |
-
*/
|
53 |
-
public $fb_sdk;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Settings structure.
|
57 |
-
*
|
58 |
-
* @var array $fb_app_settings The map data structure to store settings.
|
59 |
-
*/
|
60 |
-
protected $fb_app_settings;
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Constructor for Settings page.
|
64 |
-
*
|
65 |
-
* @since 0.4
|
66 |
-
*/
|
67 |
-
public function __construct() {
|
68 |
-
$this->fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
69 |
-
|
70 |
-
if ( isset( $this->fb_app_settings['app_id'] ) && isset( $this->fb_app_settings['app_secret'] ) ) {
|
71 |
-
$app_id = $this->fb_app_settings['app_id'];
|
72 |
-
$app_secret = $this->fb_app_settings['app_secret'];
|
73 |
-
}
|
74 |
-
|
75 |
-
if ( ! empty( $app_id ) && ! empty( $app_secret ) ) {
|
76 |
-
$this->fb_sdk = new Facebook\Facebook(array(
|
77 |
-
'app_id' => $app_id,
|
78 |
-
'app_secret' => $app_secret,
|
79 |
-
'default_graph_version' => 'v2.6',
|
80 |
-
'persistent_data_handler' => $this
|
81 |
-
));
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Gets the login url.
|
87 |
-
*
|
88 |
-
* @since 0.4
|
89 |
-
*/
|
90 |
-
public function get_login_url() {
|
91 |
-
if ( isset( $this->fb_sdk ) ) {
|
92 |
-
$helper = $this->fb_sdk->getRedirectLoginHelper();
|
93 |
-
|
94 |
-
$login_url = $helper->getLoginUrl(
|
95 |
-
Instant_Articles_Settings::get_href_to_settings_page(),
|
96 |
-
self::$fb_app_permissions
|
97 |
-
);
|
98 |
-
|
99 |
-
return $login_url;
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Retrieves granted permissions.
|
105 |
-
*
|
106 |
-
* @param string $access_token The user access token.
|
107 |
-
* @since 0.5
|
108 |
-
*/
|
109 |
-
public function get_fb_permissions( $access_token ) {
|
110 |
-
|
111 |
-
$permissions = array();
|
112 |
-
|
113 |
-
if ( isset( $this->fb_sdk ) && $access_token ) {
|
114 |
-
|
115 |
-
try {
|
116 |
-
$permissions_query = $this->fb_sdk->get( '/me/permissions', $access_token );
|
117 |
-
$decoded_permissions = $permissions_query->getDecodedBody();
|
118 |
-
if ( isset( $decoded_permissions['data'] ) ) {
|
119 |
-
foreach ( $decoded_permissions['data'] as $permission ) {
|
120 |
-
if ( 'granted' === $permission['status'] ) {
|
121 |
-
$permissions[ $permission['permission'] ] = 'granted';
|
122 |
-
}
|
123 |
-
}
|
124 |
-
}
|
125 |
-
} catch (Facebook\Exceptions\FacebookResponseException $e) {
|
126 |
-
// When Graph returns an error.
|
127 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
128 |
-
'Graph returned an error: '.$e->getMessage(),
|
129 |
-
$e->getTraceAsString()
|
130 |
-
);
|
131 |
-
|
132 |
-
} catch (Facebook\Exceptions\FacebookSDKException $e) {
|
133 |
-
// When validation fails or other local issues.
|
134 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
135 |
-
'Facebook SDK returned an error: '.$e->getMessage(),
|
136 |
-
$e->getTraceAsString()
|
137 |
-
);
|
138 |
-
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
if ( isset( $permissions ) ) {
|
143 |
-
// Logged in.
|
144 |
-
return $permissions;
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Retrieves Facebook access token.
|
150 |
-
*
|
151 |
-
* @since 0.4
|
152 |
-
*/
|
153 |
-
public function get_fb_access_token() {
|
154 |
-
$access_token = null;
|
155 |
-
|
156 |
-
if ( isset( $this->fb_sdk ) ) {
|
157 |
-
try {
|
158 |
-
$helper = $this->fb_sdk->getRedirectLoginHelper();
|
159 |
-
$access_token = $helper->getAccessToken();
|
160 |
-
} catch (Facebook\Exceptions\FacebookResponseException $e) {
|
161 |
-
// When Graph returns an error.
|
162 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
163 |
-
'Graph returned an error: '.$e->getMessage(),
|
164 |
-
$e->getTraceAsString()
|
165 |
-
);
|
166 |
-
|
167 |
-
} catch (Facebook\Exceptions\FacebookSDKException $e) {
|
168 |
-
// When validation fails or other local issues.
|
169 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
170 |
-
'Facebook SDK returned an error: '.$e->getMessage(),
|
171 |
-
$e->getTraceAsString()
|
172 |
-
);
|
173 |
-
}
|
174 |
-
}
|
175 |
-
|
176 |
-
if ( null !== $access_token ) {
|
177 |
-
// Logged in.
|
178 |
-
return $access_token;
|
179 |
-
}
|
180 |
-
}
|
181 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-settings-wizard.php
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Class responsible for functionality and rendering of the Setup Wizard
|
12 |
-
*
|
13 |
-
* @since 0.5
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Settings_Wizard {
|
16 |
-
|
17 |
-
const STEP_ID_APP_SETUP = 'app-setup';
|
18 |
-
const STEP_ID_PAGE_SELECTION = 'page-selection';
|
19 |
-
const STEP_ID_DONE = 'done';
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Wizard steps.
|
23 |
-
*
|
24 |
-
* @var array $steps The steps for wizard
|
25 |
-
*/
|
26 |
-
private static $steps = array(
|
27 |
-
1 => self::STEP_ID_APP_SETUP,
|
28 |
-
2 => self::STEP_ID_PAGE_SELECTION,
|
29 |
-
2 => self::STEP_ID_DONE,
|
30 |
-
);
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Returns the current step for the wizard.
|
34 |
-
*
|
35 |
-
* @since 0.5
|
36 |
-
*/
|
37 |
-
public static function get_current_step_id() {
|
38 |
-
|
39 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
40 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
41 |
-
|
42 |
-
if ( empty( $fb_app_settings['app_id'] ) || empty( $fb_app_settings['app_secret'] ) ) {
|
43 |
-
return self::STEP_ID_APP_SETUP;
|
44 |
-
} elseif ( empty( $fb_page_settings['page_id'] ) || empty( $fb_page_settings['page_name'] ) ) {
|
45 |
-
return self::STEP_ID_PAGE_SELECTION;
|
46 |
-
} else {
|
47 |
-
return self::STEP_ID_DONE;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/class-instant-articles-settings.php
DELETED
@@ -1,146 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-page.php' );
|
11 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-app.php' );
|
12 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-ads.php' );
|
13 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-styles.php' );
|
14 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-analytics.php' );
|
15 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-publishing.php' );
|
16 |
-
|
17 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-settings-wizard.php' );
|
18 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-settings-fb-page.php' );
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Class responsible for functionality and rendering of the settings.
|
22 |
-
*
|
23 |
-
* @since 0.4
|
24 |
-
*/
|
25 |
-
class Instant_Articles_Settings {
|
26 |
-
|
27 |
-
const IA_PLUGIN_SETTINGS_SLUG = 'instant-articles-settings';
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Initiator.
|
31 |
-
*
|
32 |
-
* @since 0.4
|
33 |
-
*/
|
34 |
-
public static function init() {
|
35 |
-
add_action( 'admin_menu', array( 'Instant_Articles_Settings', 'menu_items' ) );
|
36 |
-
|
37 |
-
add_filter( 'plugin_action_links_' . IA_PLUGIN_PATH, array( 'Instant_Articles_Settings', 'add_settings_link_to_plugin_actions' ) );
|
38 |
-
|
39 |
-
add_action( 'admin_init', function () {
|
40 |
-
new Instant_Articles_Option_FB_App();
|
41 |
-
new Instant_Articles_Option_FB_Page();
|
42 |
-
new Instant_Articles_Option_Styles();
|
43 |
-
new Instant_Articles_Option_Ads();
|
44 |
-
new Instant_Articles_Option_Analytics();
|
45 |
-
new Instant_Articles_Option_Publishing();
|
46 |
-
});
|
47 |
-
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Gets the URL/path for this page.
|
52 |
-
*
|
53 |
-
* @since 0.4
|
54 |
-
*/
|
55 |
-
public static function get_href_to_settings_page() {
|
56 |
-
return menu_page_url( self::IA_PLUGIN_SETTINGS_SLUG, false );
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Creates an anchor element.
|
61 |
-
*
|
62 |
-
* @param array $links The links will be added to anchor.
|
63 |
-
* @since 0.4
|
64 |
-
*/
|
65 |
-
public static function add_settings_link_to_plugin_actions( $links ) {
|
66 |
-
$link_text = __( 'Settings' );
|
67 |
-
$settings_href = self::get_href_to_settings_page();
|
68 |
-
$settings_link = '<a href="' . esc_url( $settings_href ) . '">' . $link_text . '</a>';
|
69 |
-
array_push( $links, $settings_link );
|
70 |
-
return $links;
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Creates the menu items for FB Instant Article in WordPress side menu.
|
75 |
-
*
|
76 |
-
* @since 0.4
|
77 |
-
*/
|
78 |
-
public static function menu_items() {
|
79 |
-
add_menu_page(
|
80 |
-
'Instant Articles Settings',
|
81 |
-
'Instant Articles',
|
82 |
-
'manage_options',
|
83 |
-
self::IA_PLUGIN_SETTINGS_SLUG,
|
84 |
-
array( 'Instant_Articles_Settings', 'render_settings_page' )
|
85 |
-
,'dashicons-facebook'
|
86 |
-
);
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Optains the state for current step from state-machine.
|
91 |
-
*
|
92 |
-
* @param int $step_id The step identifier.
|
93 |
-
* @since 0.4
|
94 |
-
*/
|
95 |
-
public static function get_state_for_wizard_step( $step_id ) {
|
96 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
97 |
-
|
98 |
-
switch ( $step_id ) {
|
99 |
-
case 'app-id':
|
100 |
-
if ( isset( $fb_page_settings['app_id'] ) && isset( $fb_page_settings['app_secret'] ) ) {
|
101 |
-
return '';
|
102 |
-
} else {
|
103 |
-
return 'current';
|
104 |
-
}
|
105 |
-
break;
|
106 |
-
|
107 |
-
case 'page-id':
|
108 |
-
if ( isset( $fb_page_settings['page_id'] ) && isset( $fb_page_settings['page_access_token'] ) ) {
|
109 |
-
return '';
|
110 |
-
} else {
|
111 |
-
return 'current';
|
112 |
-
}
|
113 |
-
break;
|
114 |
-
|
115 |
-
default:
|
116 |
-
# code...
|
117 |
-
break;
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
*
|
123 |
-
*
|
124 |
-
* @since 0.4
|
125 |
-
*/
|
126 |
-
public static function render_settings_page() {
|
127 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
128 |
-
wp_die( esc_html( 'You do not have sufficient permissions to access this page.' ) );
|
129 |
-
}
|
130 |
-
|
131 |
-
settings_errors();
|
132 |
-
|
133 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
134 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
135 |
-
|
136 |
-
if ( filter_input( INPUT_GET, 'current_tab' ) ) {
|
137 |
-
$tab = filter_input( INPUT_GET, 'current_tab' );
|
138 |
-
} else {
|
139 |
-
$tab = 'basic';
|
140 |
-
}
|
141 |
-
|
142 |
-
$settings_page_href = self::get_href_to_settings_page();
|
143 |
-
|
144 |
-
include( dirname( __FILE__ ) . '/template-settings.php' );
|
145 |
-
}
|
146 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/template-settings-advanced.php
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
?>
|
11 |
-
<form method="post" action="options.php">
|
12 |
-
<?php settings_fields( Instant_Articles_Option::PAGE_OPTION_GROUP ); ?>
|
13 |
-
|
14 |
-
<p>Configure settings for your styles, ads, analytics and publishing in Instant Articles. Review our <a href="https://developers.facebook.com/docs/instant-articles" target="_blank">developer documentation</a> to learn more.</p>
|
15 |
-
<hr />
|
16 |
-
<?php do_settings_sections( Instant_Articles_Option_Styles::OPTION_KEY ); ?>
|
17 |
-
<hr />
|
18 |
-
<?php do_settings_sections( Instant_Articles_Option_Ads::OPTION_KEY ); ?>
|
19 |
-
<hr />
|
20 |
-
<?php do_settings_sections( Instant_Articles_Option_Analytics::OPTION_KEY ); ?>
|
21 |
-
<hr />
|
22 |
-
<?php do_settings_sections( Instant_Articles_Option_Publishing::OPTION_KEY ); ?>
|
23 |
-
<hr />
|
24 |
-
<?php submit_button( __( 'Save changes' ) ); ?>
|
25 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/template-settings-info.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<p>
|
11 |
-
Once you've activated this WordPress plugin, set up your Instant Articles and submit them to Facebook for a one-time review. The review is required before you can begin publishing. Follow these steps to get started:
|
12 |
-
</p>
|
13 |
-
<ol>
|
14 |
-
<li><a href="https://www.facebook.com/instant_articles/signup" target="_blank">Sign up</a> for Instant Articles, if you haven't already, and come back to activate the plugin using the page you enabled.
|
15 |
-
<li>Claim the URL you will use to publish articles. Right now, we think the URL you will use to publish to this Page is: <code><?php echo esc_url( home_url() ); ?></code>.
|
16 |
-
<?php if ( isset( $fb_page_settings['page_id'] ) && ! empty( $fb_page_settings['page_id'] ) ) : ?>
|
17 |
-
Claim your URL
|
18 |
-
<a
|
19 |
-
href="https://www.facebook.com/<?php echo esc_attr( $fb_page_settings['page_id'] ); ?>/settings/?tab=instant_articles#URL" target="_blank">here</a>.
|
20 |
-
<?php endif; ?>
|
21 |
-
<li>Install the Pages Manager app to preview your articles and styles on <a href="http://itunes.apple.com/app/facebook-pages-manager/id514643583?ls=1&mt=8&ign-mscache=1" target="_blank">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.facebook.pages.app" target="_blank">Android</a>.
|
22 |
-
<li>Create a style template for your articles, using the Style Editor. Be sure to provide the name of the template you want to use in the Plugin Configuration settings below.
|
23 |
-
<li>[Optional] Enable Audience Network, if you choose. Learn more about <a href="https://fbinstantarticles.files.wordpress.com/2016/03/audience-network_wp_instant-articles-2-2-web_self-serve.pdf" target="_blank">Audience Network</a> for Instant Articles.
|
24 |
-
<?php if ( isset( $fb_page_settings['page_id'] ) && ! empty( $fb_page_settings['page_id'] ) ) : ?>
|
25 |
-
Sign up for Audience Network
|
26 |
-
<a
|
27 |
-
href="https://www.facebook.com/<?php echo esc_attr( $fb_page_settings['page_id'] ); ?>/settings/?tab=instant_articles#Audience-Network" target="_blank">here</a>.
|
28 |
-
<?php endif; ?>
|
29 |
-
<li>[Optional] Set up your ads and analytics, including Audience Network, in the Configuration area, below.
|
30 |
-
<?php if ( isset( $fb_page_settings['page_id'] ) && ! empty( $fb_page_settings['page_id'] ) ) : ?>
|
31 |
-
<li>
|
32 |
-
<a
|
33 |
-
href="https://www.facebook.com/<?php echo esc_attr( $fb_page_settings['page_id'] ); ?>/settings/?tab=instant_articles#Setup-Step2" target="_blank">Submit your articles for review</a>.
|
34 |
-
</li>
|
35 |
-
<?php else : ?>
|
36 |
-
<li>Submit your articles for review.</li>
|
37 |
-
<?php endif; ?>
|
38 |
-
|
39 |
-
</ol>
|
40 |
-
|
41 |
-
<p>Other Resources:</p>
|
42 |
-
<ol>
|
43 |
-
<li>See the Instant Articles <a href="https://developers.facebook.com/docs/instant-articles" target="_blank">documentation</a> to answer any questions you might have about Instant Articles.
|
44 |
-
<li>Check out the Instant Articles <a href="https://developers.facebook.com/ia/blog/" target="_blank">blog</a> and sign up to receive notifications of important updates.
|
45 |
-
<?php if ( isset( $fb_page_settings['page_id'] ) && ! empty( $fb_page_settings['page_id'] ) ) : ?>
|
46 |
-
<li>
|
47 |
-
To give other members of your team access to your Instant Articles
|
48 |
-
<a
|
49 |
-
href="https://www.facebook.com/<?php echo esc_attr( $fb_page_settings['page_id'] ); ?>/settings/?tab=instant_articles" target="_blank">tools</a>
|
50 |
-
on your Facebook Page, assign them Page roles
|
51 |
-
<a
|
52 |
-
href="https://www.facebook.com/<?php echo esc_attr( $fb_page_settings['page_id'] ); ?>/settings/?tab=admin_roles" target="_blank">here</a>.
|
53 |
-
</li>
|
54 |
-
<?php else : ?>
|
55 |
-
<li>To give other members of your team access to your Instant Articles tools on your Facebook Page, assign them Page roles.
|
56 |
-
<?php endif; ?>
|
57 |
-
|
58 |
-
</ol>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/template-settings-wizard.php
DELETED
@@ -1,174 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( Instant_Articles_Settings_Wizard::get_current_step_id() === 'done' ) : ?>
|
11 |
-
|
12 |
-
<p><strong>Success! Your Instant Articles plugin has been activated.</strong></p>
|
13 |
-
|
14 |
-
<form class="instant-articles-inline-form" method="post" action="options.php">
|
15 |
-
<p>
|
16 |
-
Your App is
|
17 |
-
<a
|
18 |
-
href="http://developers.facebook.com/apps/<?php echo esc_attr( $fb_app_settings['app_id'] ); ?>"
|
19 |
-
target="_blank"><?php
|
20 |
-
echo esc_html( $fb_app_settings['app_id'] );
|
21 |
-
?></a>.
|
22 |
-
|
23 |
-
<?php settings_fields( Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD ); ?>
|
24 |
-
<?php submit_button( __( 'Update' ), 'default', 'submit', false ); ?>
|
25 |
-
</p>
|
26 |
-
</form>
|
27 |
-
|
28 |
-
<form class="instant-articles-inline-form" method="post" action="options.php">
|
29 |
-
<p>
|
30 |
-
Your page is
|
31 |
-
<a
|
32 |
-
href="http://facebook.com/<?php echo esc_attr( $fb_page_settings['page_id'] ); ?>"
|
33 |
-
target="_blank"><?php
|
34 |
-
echo esc_html( $fb_page_settings['page_name'] );
|
35 |
-
?></a>.
|
36 |
-
<?php settings_fields( Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD ); ?>
|
37 |
-
<?php submit_button( __( 'Update' ), 'default', 'submit', false ); ?>
|
38 |
-
<div style="display: none">
|
39 |
-
<?php do_settings_sections( Instant_Articles_Option_FB_App::OPTION_KEY ); ?>
|
40 |
-
</div>
|
41 |
-
</p>
|
42 |
-
</form>
|
43 |
-
|
44 |
-
<?php elseif ( Instant_Articles_Settings_Wizard::get_current_step_id() === 'app-setup' ) : ?>
|
45 |
-
|
46 |
-
<form method="post" action="options.php">
|
47 |
-
<?php settings_fields( Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD ); ?>
|
48 |
-
|
49 |
-
<p>
|
50 |
-
You need a Facebook App to publish Instant Articles using this plugin. If you already have one, input the App ID and App Secret below, which you can find by clicking on your app <a href="https://developers.facebook.com/apps" target="_blank">here</a>. If you don't, create one <a href="https://developers.facebook.com/apps" target="_blank">here</a> before continuing.
|
51 |
-
</p>
|
52 |
-
|
53 |
-
<?php do_settings_sections( Instant_Articles_Option_FB_App::OPTION_KEY ); ?>
|
54 |
-
|
55 |
-
<?php submit_button( __( 'Next' ) ); ?>
|
56 |
-
</form>
|
57 |
-
|
58 |
-
<?php elseif ( Instant_Articles_Settings_Wizard::get_current_step_id() === 'page-selection' ) : ?>
|
59 |
-
|
60 |
-
<form class="instant-articles-inline-form" method="post" action="options.php">
|
61 |
-
<p>
|
62 |
-
Your App is
|
63 |
-
<a
|
64 |
-
href="http://developers.facebook.com/apps/<?php echo esc_attr( $fb_app_settings['app_id'] ); ?>"
|
65 |
-
target="_blank"><?php
|
66 |
-
echo esc_html( $fb_app_settings['app_id'] );
|
67 |
-
?></a>.
|
68 |
-
|
69 |
-
<?php settings_fields( Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD ); ?>
|
70 |
-
<?php submit_button( __( 'Update' ), 'default', 'submit', false ); ?>
|
71 |
-
</p>
|
72 |
-
</form>
|
73 |
-
|
74 |
-
<hr>
|
75 |
-
|
76 |
-
<form method="post" action="options.php">
|
77 |
-
<?php settings_fields( Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD ); ?>
|
78 |
-
<?php do_settings_sections( Instant_Articles_Option_FB_Page::OPTION_KEY ); ?>
|
79 |
-
<div style="display: none">
|
80 |
-
<?php do_settings_sections( Instant_Articles_Option_FB_App::OPTION_KEY ); ?>
|
81 |
-
</div>
|
82 |
-
|
83 |
-
<?php
|
84 |
-
$fb_helper = new Instant_Articles_Settings_FB_Page();
|
85 |
-
$access_token = $fb_helper->get_fb_access_token();
|
86 |
-
$permissions = $fb_helper->get_fb_permissions( $access_token );
|
87 |
-
?>
|
88 |
-
|
89 |
-
<?php if ( ! $access_token ) : ?>
|
90 |
-
|
91 |
-
<p>Login to Facebook and select the Facebook Page where you will publish Instant Articles.</p>
|
92 |
-
|
93 |
-
<div>
|
94 |
-
<a href="<?php echo esc_attr( $fb_helper->get_login_url() ) ?>">
|
95 |
-
<img src="https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xtf1/t39.2178-6/11405239_920140564714397_256329502_n.png">
|
96 |
-
</a>
|
97 |
-
</div>
|
98 |
-
|
99 |
-
<?php
|
100 |
-
elseif (
|
101 |
-
( ! isset( $permissions['pages_manage_instant_articles'] ) ) ||
|
102 |
-
( ! isset( $permissions['pages_show_list'] ) )
|
103 |
-
) :
|
104 |
-
?>
|
105 |
-
|
106 |
-
<p>In order to finish the activation, you need to grant all the requested permissions:</p>
|
107 |
-
<ul>
|
108 |
-
<?php if ( ! isset( $permissions['pages_show_list'] ) ) : ?>
|
109 |
-
<li>
|
110 |
-
<b>Show a list of the Pages you manage</b>: allows the plugin to show the list of your
|
111 |
-
pages for you to select one.
|
112 |
-
</li>
|
113 |
-
<?php endif; ?>
|
114 |
-
<?php if ( ! isset( $permissions['pages_manage_instant_articles'] ) ) : ?>
|
115 |
-
<li>
|
116 |
-
<b>Manage Instant Articles for your Pages</b>: allows us to publish
|
117 |
-
Instant Articles to your selected page.
|
118 |
-
</li>
|
119 |
-
<?php endif; ?>
|
120 |
-
</p>
|
121 |
-
|
122 |
-
<p>Please grant the needed permissions to continue:</p>
|
123 |
-
|
124 |
-
<div>
|
125 |
-
<a href="<?php echo esc_attr( $fb_helper->get_login_url() ) ?>">
|
126 |
-
<img src="https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xtf1/t39.2178-6/11405239_920140564714397_256329502_n.png">
|
127 |
-
</a>
|
128 |
-
</div>
|
129 |
-
|
130 |
-
<?php else : ?>
|
131 |
-
|
132 |
-
<?php
|
133 |
-
$helper = new Facebook\InstantArticles\Client\Helper(
|
134 |
-
$fb_helper->fb_sdk
|
135 |
-
);
|
136 |
-
|
137 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
138 |
-
|
139 |
-
// Map GraphNode objects to simple value objects that are smaller when serialized.
|
140 |
-
$pages_and_tokens = array_map(function( $page_node ) {
|
141 |
-
return (object) array(
|
142 |
-
'page_id' => $page_node->getField( 'id' ),
|
143 |
-
'page_name' => $page_node->getField( 'name' ),
|
144 |
-
'page_access_token' => $page_node->getField( 'access_token' ),
|
145 |
-
'supports_instant_articles' => $page_node->getField( 'supports_instant_articles' ),
|
146 |
-
);
|
147 |
-
}, $helper->getPagesAndTokens( $access_token )->all() );
|
148 |
-
|
149 |
-
$pages_and_tokens = array_filter( $pages_and_tokens, function ( $page ) {
|
150 |
-
return $page->supports_instant_articles;
|
151 |
-
} );
|
152 |
-
?>
|
153 |
-
|
154 |
-
<?php if ( ! empty( $pages_and_tokens ) ) : ?>
|
155 |
-
<p>Select the Facebook Pages where you will publish Instant Articles:</p>
|
156 |
-
|
157 |
-
<select id="<?php echo esc_attr( 'instant-articles-fb-page-selector' ) ?>">
|
158 |
-
<option value="" disabled selected>Select Page</option>
|
159 |
-
<?php foreach ( $pages_and_tokens as $page ) : ?>
|
160 |
-
<option value="<?php echo esc_attr( wp_json_encode( $page ) ) ?>">
|
161 |
-
<?php echo esc_html( $page->page_name ) ?>
|
162 |
-
</option>
|
163 |
-
<?php endforeach; ?>
|
164 |
-
</select>
|
165 |
-
<?php submit_button( 'Next', 'primary', 'instant-articles-select-page', true ); ?>
|
166 |
-
<?php else : ?>
|
167 |
-
<p>Sorry, you have no Pages signed up for Instant Articles.</p>
|
168 |
-
<p><a href="https://www.facebook.com/instant_articles/signup" target="_blank">Sign up</a> for Instant Articles and refresh this page to continue.</p>
|
169 |
-
<?php endif; ?>
|
170 |
-
|
171 |
-
<?php endif; ?>
|
172 |
-
</form>
|
173 |
-
|
174 |
-
<?php endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings/template-settings.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
?>
|
11 |
-
<div class="wrap">
|
12 |
-
<h1>Facebook Instant Articles Settings</h1>
|
13 |
-
<div id="instant-articles-settings-basic" class="instant-articles-settings-box">
|
14 |
-
<h2 class="dashicons-before dashicons-arrow-down"> Plugin Activation</h2>
|
15 |
-
<div class="inside">
|
16 |
-
<?php include( dirname( __FILE__ ) . '/template-settings-wizard.php' ); ?>
|
17 |
-
</div>
|
18 |
-
</div>
|
19 |
-
|
20 |
-
<div id="instant-articles-settings-info" class="instant-articles-settings-box">
|
21 |
-
<h2 class="dashicons-before dashicons-arrow-down"> Instant Articles Configuration</h2>
|
22 |
-
<div class="inside">
|
23 |
-
<?php include( dirname( __FILE__ ) . '/template-settings-info.php' ); ?>
|
24 |
-
</div>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<div id="instant-articles-settings-advanced" class="instant-articles-settings-box">
|
28 |
-
<h2 class="dashicons-before dashicons-arrow-down"> Plugin Configuration</h2>
|
29 |
-
<div class="inside">
|
30 |
-
<?php include( dirname( __FILE__ ) . '/template-settings-advanced.php' ); ?>
|
31 |
-
</div>
|
32 |
-
</div>
|
33 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/apache/log4php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit cac428b6f67d2035af39784da1d1a299ef42fcf2
|
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit6eba24516d4931b3ebc92cc334e50d01::getLoader();
|
vendor/bin/phpcbf
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
#!/usr/bin/env php
|
2 |
-
<?php
|
3 |
-
/**
|
4 |
-
* PHP Code Beautifier and Fixer fixes violations of a defined coding standard.
|
5 |
-
*
|
6 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
7 |
-
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
8 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
9 |
-
*/
|
10 |
-
|
11 |
-
if (is_file(__DIR__.'/../autoload.php') === true) {
|
12 |
-
include_once __DIR__.'/../autoload.php';
|
13 |
-
} else {
|
14 |
-
include_once 'PHP/CodeSniffer/autoload.php';
|
15 |
-
}
|
16 |
-
|
17 |
-
$runner = new PHP_CodeSniffer\Runner();
|
18 |
-
$exitCode = $runner->runPHPCBF();
|
19 |
-
exit($exitCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/bin/phpcs
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
#!/usr/bin/env php
|
2 |
-
<?php
|
3 |
-
/**
|
4 |
-
* PHP_CodeSniffer detects violations of a defined coding standard.
|
5 |
-
*
|
6 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
7 |
-
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
|
8 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
9 |
-
*/
|
10 |
-
|
11 |
-
if (is_file(__DIR__.'/../autoload.php') === true) {
|
12 |
-
include_once __DIR__.'/../autoload.php';
|
13 |
-
} else {
|
14 |
-
include_once 'PHP/CodeSniffer/autoload.php';
|
15 |
-
}
|
16 |
-
|
17 |
-
$runner = new PHP_CodeSniffer\Runner();
|
18 |
-
$exitCode = $runner->runPHPCS();
|
19 |
-
exit($exitCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/composer/ClassLoader.php
CHANGED
@@ -37,11 +37,13 @@ namespace Composer\Autoload;
|
|
37 |
*
|
38 |
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
-
* @see
|
41 |
-
* @see
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
|
|
|
|
45 |
// PSR-4
|
46 |
private $prefixLengthsPsr4 = array();
|
47 |
private $prefixDirsPsr4 = array();
|
@@ -57,10 +59,17 @@ class ClassLoader
|
|
57 |
private $missingClasses = array();
|
58 |
private $apcuPrefix;
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
63 |
-
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
}
|
65 |
|
66 |
return array();
|
@@ -300,6 +309,17 @@ class ClassLoader
|
|
300 |
public function register($prepend = false)
|
301 |
{
|
302 |
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
}
|
304 |
|
305 |
/**
|
@@ -308,13 +328,17 @@ class ClassLoader
|
|
308 |
public function unregister()
|
309 |
{
|
310 |
spl_autoload_unregister(array($this, 'loadClass'));
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
|
313 |
/**
|
314 |
* Loads the given class or interface.
|
315 |
*
|
316 |
* @param string $class The name of the class
|
317 |
-
* @return
|
318 |
*/
|
319 |
public function loadClass($class)
|
320 |
{
|
@@ -323,6 +347,8 @@ class ClassLoader
|
|
323 |
|
324 |
return true;
|
325 |
}
|
|
|
|
|
326 |
}
|
327 |
|
328 |
/**
|
@@ -367,6 +393,16 @@ class ClassLoader
|
|
367 |
return $file;
|
368 |
}
|
369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
private function findFileWithExtension($class, $ext)
|
371 |
{
|
372 |
// PSR-4 lookup
|
37 |
*
|
38 |
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see https://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see https://www.php-fig.org/psr/psr-4/
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
45 |
+
private $vendorDir;
|
46 |
+
|
47 |
// PSR-4
|
48 |
private $prefixLengthsPsr4 = array();
|
49 |
private $prefixDirsPsr4 = array();
|
59 |
private $missingClasses = array();
|
60 |
private $apcuPrefix;
|
61 |
|
62 |
+
private static $registeredLoaders = array();
|
63 |
+
|
64 |
+
public function __construct($vendorDir = null)
|
65 |
+
{
|
66 |
+
$this->vendorDir = $vendorDir;
|
67 |
+
}
|
68 |
+
|
69 |
public function getPrefixes()
|
70 |
{
|
71 |
if (!empty($this->prefixesPsr0)) {
|
72 |
+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
73 |
}
|
74 |
|
75 |
return array();
|
309 |
public function register($prepend = false)
|
310 |
{
|
311 |
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
312 |
+
|
313 |
+
if (null === $this->vendorDir) {
|
314 |
+
return;
|
315 |
+
}
|
316 |
+
|
317 |
+
if ($prepend) {
|
318 |
+
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
319 |
+
} else {
|
320 |
+
unset(self::$registeredLoaders[$this->vendorDir]);
|
321 |
+
self::$registeredLoaders[$this->vendorDir] = $this;
|
322 |
+
}
|
323 |
}
|
324 |
|
325 |
/**
|
328 |
public function unregister()
|
329 |
{
|
330 |
spl_autoload_unregister(array($this, 'loadClass'));
|
331 |
+
|
332 |
+
if (null !== $this->vendorDir) {
|
333 |
+
unset(self::$registeredLoaders[$this->vendorDir]);
|
334 |
+
}
|
335 |
}
|
336 |
|
337 |
/**
|
338 |
* Loads the given class or interface.
|
339 |
*
|
340 |
* @param string $class The name of the class
|
341 |
+
* @return true|null True if loaded, null otherwise
|
342 |
*/
|
343 |
public function loadClass($class)
|
344 |
{
|
347 |
|
348 |
return true;
|
349 |
}
|
350 |
+
|
351 |
+
return null;
|
352 |
}
|
353 |
|
354 |
/**
|
393 |
return $file;
|
394 |
}
|
395 |
|
396 |
+
/**
|
397 |
+
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
398 |
+
*
|
399 |
+
* @return self[]
|
400 |
+
*/
|
401 |
+
public static function getRegisteredLoaders()
|
402 |
+
{
|
403 |
+
return self::$registeredLoaders;
|
404 |
+
}
|
405 |
+
|
406 |
private function findFileWithExtension($class, $ext)
|
407 |
{
|
408 |
// PSR-4 lookup
|
vendor/composer/InstalledVersions.php
ADDED
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer;
|
14 |
+
|
15 |
+
use Composer\Autoload\ClassLoader;
|
16 |
+
use Composer\Semver\VersionParser;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* This class is copied in every Composer installed project and available to all
|
20 |
+
*
|
21 |
+
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
22 |
+
*
|
23 |
+
* To require it's presence, you can require `composer-runtime-api ^2.0`
|
24 |
+
*/
|
25 |
+
class InstalledVersions
|
26 |
+
{
|
27 |
+
private static $installed;
|
28 |
+
private static $canGetVendors;
|
29 |
+
private static $installedByVendor = array();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
33 |
+
*
|
34 |
+
* @return string[]
|
35 |
+
* @psalm-return list<string>
|
36 |
+
*/
|
37 |
+
public static function getInstalledPackages()
|
38 |
+
{
|
39 |
+
$packages = array();
|
40 |
+
foreach (self::getInstalled() as $installed) {
|
41 |
+
$packages[] = array_keys($installed['versions']);
|
42 |
+
}
|
43 |
+
|
44 |
+
if (1 === \count($packages)) {
|
45 |
+
return $packages[0];
|
46 |
+
}
|
47 |
+
|
48 |
+
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns a list of all package names with a specific type e.g. 'library'
|
53 |
+
*
|
54 |
+
* @param string $type
|
55 |
+
* @return string[]
|
56 |
+
* @psalm-return list<string>
|
57 |
+
*/
|
58 |
+
public static function getInstalledPackagesByType($type)
|
59 |
+
{
|
60 |
+
$packagesByType = array();
|
61 |
+
|
62 |
+
foreach (self::getInstalled() as $installed) {
|
63 |
+
foreach ($installed['versions'] as $name => $package) {
|
64 |
+
if (isset($package['type']) && $package['type'] === $type) {
|
65 |
+
$packagesByType[] = $name;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
return $packagesByType;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Checks whether the given package is installed
|
75 |
+
*
|
76 |
+
* This also returns true if the package name is provided or replaced by another package
|
77 |
+
*
|
78 |
+
* @param string $packageName
|
79 |
+
* @param bool $includeDevRequirements
|
80 |
+
* @return bool
|
81 |
+
*/
|
82 |
+
public static function isInstalled($packageName, $includeDevRequirements = true)
|
83 |
+
{
|
84 |
+
foreach (self::getInstalled() as $installed) {
|
85 |
+
if (isset($installed['versions'][$packageName])) {
|
86 |
+
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Checks whether the given package satisfies a version constraint
|
95 |
+
*
|
96 |
+
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
97 |
+
*
|
98 |
+
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
99 |
+
*
|
100 |
+
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
101 |
+
* @param string $packageName
|
102 |
+
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
+
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
106 |
+
{
|
107 |
+
$constraint = $parser->parseConstraints($constraint);
|
108 |
+
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
109 |
+
|
110 |
+
return $provided->matches($constraint);
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Returns a version constraint representing all the range(s) which are installed for a given package
|
115 |
+
*
|
116 |
+
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
117 |
+
* whether a given version of a package is installed, and not just whether it exists
|
118 |
+
*
|
119 |
+
* @param string $packageName
|
120 |
+
* @return string Version constraint usable with composer/semver
|
121 |
+
*/
|
122 |
+
public static function getVersionRanges($packageName)
|
123 |
+
{
|
124 |
+
foreach (self::getInstalled() as $installed) {
|
125 |
+
if (!isset($installed['versions'][$packageName])) {
|
126 |
+
continue;
|
127 |
+
}
|
128 |
+
|
129 |
+
$ranges = array();
|
130 |
+
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
131 |
+
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
132 |
+
}
|
133 |
+
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
134 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
135 |
+
}
|
136 |
+
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
137 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
138 |
+
}
|
139 |
+
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
140 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
141 |
+
}
|
142 |
+
|
143 |
+
return implode(' || ', $ranges);
|
144 |
+
}
|
145 |
+
|
146 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @param string $packageName
|
151 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
152 |
+
*/
|
153 |
+
public static function getVersion($packageName)
|
154 |
+
{
|
155 |
+
foreach (self::getInstalled() as $installed) {
|
156 |
+
if (!isset($installed['versions'][$packageName])) {
|
157 |
+
continue;
|
158 |
+
}
|
159 |
+
|
160 |
+
if (!isset($installed['versions'][$packageName]['version'])) {
|
161 |
+
return null;
|
162 |
+
}
|
163 |
+
|
164 |
+
return $installed['versions'][$packageName]['version'];
|
165 |
+
}
|
166 |
+
|
167 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* @param string $packageName
|
172 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
173 |
+
*/
|
174 |
+
public static function getPrettyVersion($packageName)
|
175 |
+
{
|
176 |
+
foreach (self::getInstalled() as $installed) {
|
177 |
+
if (!isset($installed['versions'][$packageName])) {
|
178 |
+
continue;
|
179 |
+
}
|
180 |
+
|
181 |
+
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
182 |
+
return null;
|
183 |
+
}
|
184 |
+
|
185 |
+
return $installed['versions'][$packageName]['pretty_version'];
|
186 |
+
}
|
187 |
+
|
188 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* @param string $packageName
|
193 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
194 |
+
*/
|
195 |
+
public static function getReference($packageName)
|
196 |
+
{
|
197 |
+
foreach (self::getInstalled() as $installed) {
|
198 |
+
if (!isset($installed['versions'][$packageName])) {
|
199 |
+
continue;
|
200 |
+
}
|
201 |
+
|
202 |
+
if (!isset($installed['versions'][$packageName]['reference'])) {
|
203 |
+
return null;
|
204 |
+
}
|
205 |
+
|
206 |
+
return $installed['versions'][$packageName]['reference'];
|
207 |
+
}
|
208 |
+
|
209 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* @param string $packageName
|
214 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
215 |
+
*/
|
216 |
+
public static function getInstallPath($packageName)
|
217 |
+
{
|
218 |
+
foreach (self::getInstalled() as $installed) {
|
219 |
+
if (!isset($installed['versions'][$packageName])) {
|
220 |
+
continue;
|
221 |
+
}
|
222 |
+
|
223 |
+
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
224 |
+
}
|
225 |
+
|
226 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* @return array
|
231 |
+
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
|
232 |
+
*/
|
233 |
+
public static function getRootPackage()
|
234 |
+
{
|
235 |
+
$installed = self::getInstalled();
|
236 |
+
|
237 |
+
return $installed[0]['root'];
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Returns the raw installed.php data for custom implementations
|
242 |
+
*
|
243 |
+
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
244 |
+
* @return array[]
|
245 |
+
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}
|
246 |
+
*/
|
247 |
+
public static function getRawData()
|
248 |
+
{
|
249 |
+
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
250 |
+
|
251 |
+
if (null === self::$installed) {
|
252 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
253 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
254 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
255 |
+
self::$installed = include __DIR__ . '/installed.php';
|
256 |
+
} else {
|
257 |
+
self::$installed = array();
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
return self::$installed;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
266 |
+
*
|
267 |
+
* @return array[]
|
268 |
+
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
|
269 |
+
*/
|
270 |
+
public static function getAllRawData()
|
271 |
+
{
|
272 |
+
return self::getInstalled();
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Lets you reload the static array from another file
|
277 |
+
*
|
278 |
+
* This is only useful for complex integrations in which a project needs to use
|
279 |
+
* this class but then also needs to execute another project's autoloader in process,
|
280 |
+
* and wants to ensure both projects have access to their version of installed.php.
|
281 |
+
*
|
282 |
+
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
283 |
+
* the data it needs from this class, then call reload() with
|
284 |
+
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
285 |
+
* the project in which it runs can then also use this class safely, without
|
286 |
+
* interference between PHPUnit's dependencies and the project's dependencies.
|
287 |
+
*
|
288 |
+
* @param array[] $data A vendor/composer/installed.php data set
|
289 |
+
* @return void
|
290 |
+
*
|
291 |
+
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data
|
292 |
+
*/
|
293 |
+
public static function reload($data)
|
294 |
+
{
|
295 |
+
self::$installed = $data;
|
296 |
+
self::$installedByVendor = array();
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* @return array[]
|
301 |
+
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
|
302 |
+
*/
|
303 |
+
private static function getInstalled()
|
304 |
+
{
|
305 |
+
if (null === self::$canGetVendors) {
|
306 |
+
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
307 |
+
}
|
308 |
+
|
309 |
+
$installed = array();
|
310 |
+
|
311 |
+
if (self::$canGetVendors) {
|
312 |
+
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
313 |
+
if (isset(self::$installedByVendor[$vendorDir])) {
|
314 |
+
$installed[] = self::$installedByVendor[$vendorDir];
|
315 |
+
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
316 |
+
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
317 |
+
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
318 |
+
self::$installed = $installed[count($installed) - 1];
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
if (null === self::$installed) {
|
325 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
326 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
327 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
328 |
+
self::$installed = require __DIR__ . '/installed.php';
|
329 |
+
} else {
|
330 |
+
self::$installed = array();
|
331 |
+
}
|
332 |
+
}
|
333 |
+
$installed[] = self::$installed;
|
334 |
+
|
335 |
+
return $installed;
|
336 |
+
}
|
337 |
+
}
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -6,4 +6,273 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
+
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
10 |
+
'Doctrine\\Instantiator\\Exception\\ExceptionInterface' => $vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php',
|
11 |
+
'Doctrine\\Instantiator\\Exception\\InvalidArgumentException' => $vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php',
|
12 |
+
'Doctrine\\Instantiator\\Exception\\UnexpectedValueException' => $vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php',
|
13 |
+
'Doctrine\\Instantiator\\Instantiator' => $vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php',
|
14 |
+
'Doctrine\\Instantiator\\InstantiatorInterface' => $vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php',
|
15 |
+
'Facebook\\Authentication\\AccessToken' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Authentication/AccessToken.php',
|
16 |
+
'Facebook\\Authentication\\AccessTokenMetadata' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Authentication/AccessTokenMetadata.php',
|
17 |
+
'Facebook\\Authentication\\OAuth2Client' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Authentication/OAuth2Client.php',
|
18 |
+
'Facebook\\Exceptions\\FacebookAuthenticationException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthenticationException.php',
|
19 |
+
'Facebook\\Exceptions\\FacebookAuthorizationException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthorizationException.php',
|
20 |
+
'Facebook\\Exceptions\\FacebookClientException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookClientException.php',
|
21 |
+
'Facebook\\Exceptions\\FacebookOtherException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookOtherException.php',
|
22 |
+
'Facebook\\Exceptions\\FacebookResponseException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResponseException.php',
|
23 |
+
'Facebook\\Exceptions\\FacebookResumableUploadException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php',
|
24 |
+
'Facebook\\Exceptions\\FacebookSDKException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookSDKException.php',
|
25 |
+
'Facebook\\Exceptions\\FacebookServerException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookServerException.php',
|
26 |
+
'Facebook\\Exceptions\\FacebookThrottleException' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookThrottleException.php',
|
27 |
+
'Facebook\\Facebook' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Facebook.php',
|
28 |
+
'Facebook\\FacebookApp' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FacebookApp.php',
|
29 |
+
'Facebook\\FacebookBatchRequest' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FacebookBatchRequest.php',
|
30 |
+
'Facebook\\FacebookBatchResponse' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FacebookBatchResponse.php',
|
31 |
+
'Facebook\\FacebookClient' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FacebookClient.php',
|
32 |
+
'Facebook\\FacebookRequest' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FacebookRequest.php',
|
33 |
+
'Facebook\\FacebookResponse' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FacebookResponse.php',
|
34 |
+
'Facebook\\FileUpload\\FacebookFile' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FileUpload/FacebookFile.php',
|
35 |
+
'Facebook\\FileUpload\\FacebookResumableUploader' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php',
|
36 |
+
'Facebook\\FileUpload\\FacebookTransferChunk' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php',
|
37 |
+
'Facebook\\FileUpload\\FacebookVideo' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FileUpload/FacebookVideo.php',
|
38 |
+
'Facebook\\FileUpload\\Mimetypes' => $vendorDir . '/facebook/graph-sdk/src/Facebook/FileUpload/Mimetypes.php',
|
39 |
+
'Facebook\\GraphNodes\\Birthday' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/Birthday.php',
|
40 |
+
'Facebook\\GraphNodes\\Collection' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/Collection.php',
|
41 |
+
'Facebook\\GraphNodes\\GraphAchievement' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php',
|
42 |
+
'Facebook\\GraphNodes\\GraphAlbum' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php',
|
43 |
+
'Facebook\\GraphNodes\\GraphApplication' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphApplication.php',
|
44 |
+
'Facebook\\GraphNodes\\GraphCoverPhoto' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php',
|
45 |
+
'Facebook\\GraphNodes\\GraphEdge' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEdge.php',
|
46 |
+
'Facebook\\GraphNodes\\GraphEvent' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEvent.php',
|
47 |
+
'Facebook\\GraphNodes\\GraphGroup' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphGroup.php',
|
48 |
+
'Facebook\\GraphNodes\\GraphList' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphList.php',
|
49 |
+
'Facebook\\GraphNodes\\GraphLocation' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphLocation.php',
|
50 |
+
'Facebook\\GraphNodes\\GraphNode' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNode.php',
|
51 |
+
'Facebook\\GraphNodes\\GraphNodeFactory' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php',
|
52 |
+
'Facebook\\GraphNodes\\GraphObject' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObject.php',
|
53 |
+
'Facebook\\GraphNodes\\GraphObjectFactory' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php',
|
54 |
+
'Facebook\\GraphNodes\\GraphPage' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPage.php',
|
55 |
+
'Facebook\\GraphNodes\\GraphPicture' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPicture.php',
|
56 |
+
'Facebook\\GraphNodes\\GraphSessionInfo' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php',
|
57 |
+
'Facebook\\GraphNodes\\GraphUser' => $vendorDir . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphUser.php',
|
58 |
+
'Facebook\\Helpers\\FacebookCanvasHelper' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php',
|
59 |
+
'Facebook\\Helpers\\FacebookJavaScriptHelper' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookJavaScriptHelper.php',
|
60 |
+
'Facebook\\Helpers\\FacebookPageTabHelper' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookPageTabHelper.php',
|
61 |
+
'Facebook\\Helpers\\FacebookRedirectLoginHelper' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php',
|
62 |
+
'Facebook\\Helpers\\FacebookSignedRequestFromInputHelper' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php',
|
63 |
+
'Facebook\\HttpClients\\FacebookCurl' => $vendorDir . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurl.php',
|
64 |
+
'Facebook\\HttpClients\\FacebookCurlHttpClient' => $vendorDir . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php',
|
65 |
+
'Facebook\\HttpClients\\FacebookGuzzleHttpClient' => $vendorDir . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php',
|
66 |
+
'Facebook\\HttpClients\\FacebookHttpClientInterface' => $vendorDir . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookHttpClientInterface.php',
|
67 |
+
'Facebook\\HttpClients\\FacebookStream' => $vendorDir . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStream.php',
|
68 |
+
'Facebook\\HttpClients\\FacebookStreamHttpClient' => $vendorDir . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php',
|
69 |
+
'Facebook\\HttpClients\\HttpClientsFactory' => $vendorDir . '/facebook/graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php',
|
70 |
+
'Facebook\\Http\\GraphRawResponse' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Http/GraphRawResponse.php',
|
71 |
+
'Facebook\\Http\\RequestBodyInterface' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Http/RequestBodyInterface.php',
|
72 |
+
'Facebook\\Http\\RequestBodyMultipart' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Http/RequestBodyMultipart.php',
|
73 |
+
'Facebook\\Http\\RequestBodyUrlEncoded' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Http/RequestBodyUrlEncoded.php',
|
74 |
+
'Facebook\\InstantArticles\\AMP\\AMPArticle' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPArticle.php',
|
75 |
+
'Facebook\\InstantArticles\\AMP\\AMPCaption' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPCaption.php',
|
76 |
+
'Facebook\\InstantArticles\\AMP\\AMPContext' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPContext.php',
|
77 |
+
'Facebook\\InstantArticles\\AMP\\AMPCover' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPCover.php',
|
78 |
+
'Facebook\\InstantArticles\\AMP\\AMPCoverImage' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPCoverImage.php',
|
79 |
+
'Facebook\\InstantArticles\\AMP\\AMPHeader' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPHeader.php',
|
80 |
+
'Facebook\\InstantArticles\\AMP\\AMPImage' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPImage.php',
|
81 |
+
'Facebook\\InstantArticles\\Client\\Client' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Client.php',
|
82 |
+
'Facebook\\InstantArticles\\Client\\ClientException' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ClientException.php',
|
83 |
+
'Facebook\\InstantArticles\\Client\\Helper' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Helper.php',
|
84 |
+
'Facebook\\InstantArticles\\Client\\InstantArticleStatus' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/InstantArticleStatus.php',
|
85 |
+
'Facebook\\InstantArticles\\Client\\ServerMessage' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ServerMessage.php',
|
86 |
+
'Facebook\\InstantArticles\\Elements\\Ad' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Ad.php',
|
87 |
+
'Facebook\\InstantArticles\\Elements\\Analytics' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Analytics.php',
|
88 |
+
'Facebook\\InstantArticles\\Elements\\Anchor' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Anchor.php',
|
89 |
+
'Facebook\\InstantArticles\\Elements\\AnimatedGIF' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/AnimatedGIF.php',
|
90 |
+
'Facebook\\InstantArticles\\Elements\\Audible' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audible.php',
|
91 |
+
'Facebook\\InstantArticles\\Elements\\Audio' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audio.php',
|
92 |
+
'Facebook\\InstantArticles\\Elements\\Author' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Author.php',
|
93 |
+
'Facebook\\InstantArticles\\Elements\\Blockquote' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Blockquote.php',
|
94 |
+
'Facebook\\InstantArticles\\Elements\\Bold' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Bold.php',
|
95 |
+
'Facebook\\InstantArticles\\Elements\\Caption' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Caption.php',
|
96 |
+
'Facebook\\InstantArticles\\Elements\\ChildrenContainer' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ChildrenContainer.php',
|
97 |
+
'Facebook\\InstantArticles\\Elements\\Cite' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Cite.php',
|
98 |
+
'Facebook\\InstantArticles\\Elements\\Div' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Div.php',
|
99 |
+
'Facebook\\InstantArticles\\Elements\\Element' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Element.php',
|
100 |
+
'Facebook\\InstantArticles\\Elements\\ElementWithHTML' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ElementWithHTML.php',
|
101 |
+
'Facebook\\InstantArticles\\Elements\\Emphasized' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Emphasized.php',
|
102 |
+
'Facebook\\InstantArticles\\Elements\\Footer' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Footer.php',
|
103 |
+
'Facebook\\InstantArticles\\Elements\\FormattedText' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/FormattedText.php',
|
104 |
+
'Facebook\\InstantArticles\\Elements\\GeoTag' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/GeoTag.php',
|
105 |
+
'Facebook\\InstantArticles\\Elements\\H1' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H1.php',
|
106 |
+
'Facebook\\InstantArticles\\Elements\\H2' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H2.php',
|
107 |
+
'Facebook\\InstantArticles\\Elements\\H3' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H3.php',
|
108 |
+
'Facebook\\InstantArticles\\Elements\\Header' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Header.php',
|
109 |
+
'Facebook\\InstantArticles\\Elements\\Image' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Image.php',
|
110 |
+
'Facebook\\InstantArticles\\Elements\\InstantArticle' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php',
|
111 |
+
'Facebook\\InstantArticles\\Elements\\InstantArticleInterface' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticleInterface.php',
|
112 |
+
'Facebook\\InstantArticles\\Elements\\Interactive' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Interactive.php',
|
113 |
+
'Facebook\\InstantArticles\\Elements\\Italic' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Italic.php',
|
114 |
+
'Facebook\\InstantArticles\\Elements\\LineBreak' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/LineBreak.php',
|
115 |
+
'Facebook\\InstantArticles\\Elements\\ListElement' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListElement.php',
|
116 |
+
'Facebook\\InstantArticles\\Elements\\ListItem' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListItem.php',
|
117 |
+
'Facebook\\InstantArticles\\Elements\\Map' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Map.php',
|
118 |
+
'Facebook\\InstantArticles\\Elements\\Paragraph' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Paragraph.php',
|
119 |
+
'Facebook\\InstantArticles\\Elements\\Pullquote' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Pullquote.php',
|
120 |
+
'Facebook\\InstantArticles\\Elements\\RelatedArticles' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedArticles.php',
|
121 |
+
'Facebook\\InstantArticles\\Elements\\RelatedItem' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedItem.php',
|
122 |
+
'Facebook\\InstantArticles\\Elements\\Slideshow' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Slideshow.php',
|
123 |
+
'Facebook\\InstantArticles\\Elements\\Small' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Small.php',
|
124 |
+
'Facebook\\InstantArticles\\Elements\\SocialEmbed' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/SocialEmbed.php',
|
125 |
+
'Facebook\\InstantArticles\\Elements\\Span' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Span.php',
|
126 |
+
'Facebook\\InstantArticles\\Elements\\Sponsor' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Sponsor.php',
|
127 |
+
'Facebook\\InstantArticles\\Elements\\TextContainer' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/TextContainer.php',
|
128 |
+
'Facebook\\InstantArticles\\Elements\\Time' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Time.php',
|
129 |
+
'Facebook\\InstantArticles\\Elements\\Video' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Video.php',
|
130 |
+
'Facebook\\InstantArticles\\Parser\\Parser' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Parser/Parser.php',
|
131 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\AbstractGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/AbstractGetter.php',
|
132 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\ChildrenGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ChildrenGetter.php',
|
133 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\ConstantGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ConstantGetter.php',
|
134 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\DateGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/DateGetter.php',
|
135 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\ElementGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php',
|
136 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\ExistsGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ExistsGetter.php',
|
137 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\FragmentGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/FragmentGetter.php',
|
138 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\GetterFactory' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/GetterFactory.php',
|
139 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\IntegerGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/IntegerGetter.php',
|
140 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\JSONGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/JSONGetter.php',
|
141 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\MultipleElementsGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php',
|
142 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\NextSiblingElementGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingElementGetter.php',
|
143 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\NextSiblingGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingGetter.php',
|
144 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\StringGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/StringGetter.php',
|
145 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\XpathGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/XpathGetter.php',
|
146 |
+
'Facebook\\InstantArticles\\Transformer\\Logs\\TransformerLog' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Logs/TransformerLog.php',
|
147 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AdRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AdRule.php',
|
148 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AnalyticsRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnalyticsRule.php',
|
149 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AnchorRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnchorRule.php',
|
150 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AudioRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AudioRule.php',
|
151 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AuthorRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AuthorRule.php',
|
152 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\BlockquoteRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BlockquoteRule.php',
|
153 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\BoldRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BoldRule.php',
|
154 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\CaptionCreditRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionCreditRule.php',
|
155 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\CaptionRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionRule.php',
|
156 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\Compat\\JetpackSlideshowRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Compat/JetpackSlideshowRule.php',
|
157 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ConfigurationSelectorRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ConfigurationSelectorRule.php',
|
158 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\EmphasizedRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/EmphasizedRule.php',
|
159 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\FooterRelatedArticlesRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRelatedArticlesRule.php',
|
160 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\FooterRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRule.php',
|
161 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\FooterSmallRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterSmallRule.php',
|
162 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\GeoTagRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/GeoTagRule.php',
|
163 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\GlobalRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/GlobalRule.php',
|
164 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\H1Rule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H1Rule.php',
|
165 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\H2Rule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H2Rule.php',
|
166 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderAdRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderAdRule.php',
|
167 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderImageRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderImageRule.php',
|
168 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderKickerRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderKickerRule.php',
|
169 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderRule.php',
|
170 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderSubTitleRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderSubTitleRule.php',
|
171 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderTitleRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderTitleRule.php',
|
172 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\IgnoreRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/IgnoreRule.php',
|
173 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ImageInsideParagraphRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageInsideParagraphRule.php',
|
174 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ImageRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageRule.php',
|
175 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\InstantArticleRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php',
|
176 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\InteractiveInsideParagraphRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveInsideParagraphRule.php',
|
177 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\InteractiveRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveRule.php',
|
178 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ItalicRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ItalicRule.php',
|
179 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\LineBreakRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/LineBreakRule.php',
|
180 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ListElementRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListElementRule.php',
|
181 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ListItemRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListItemRule.php',
|
182 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\MapRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/MapRule.php',
|
183 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ParagraphFooterRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphFooterRule.php',
|
184 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ParagraphRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphRule.php',
|
185 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\PassThroughRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PassThroughRule.php',
|
186 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\PullquoteCiteRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PullquoteCiteRule.php',
|
187 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\PullquoteRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PullquoteRule.php',
|
188 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\RelatedArticlesRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedArticlesRule.php',
|
189 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\RelatedItemRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedItemRule.php',
|
190 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\Rule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Rule.php',
|
191 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\SlideshowImageRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SlideshowImageRule.php',
|
192 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\SlideshowRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SlideshowRule.php',
|
193 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\SocialEmbedRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SocialEmbedRule.php',
|
194 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\SponsorRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SponsorRule.php',
|
195 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\TextNodeRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TextNodeRule.php',
|
196 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\TimeRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php',
|
197 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\VideoRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/VideoRule.php',
|
198 |
+
'Facebook\\InstantArticles\\Transformer\\Settings\\AdSettings' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Settings/AdSettings.php',
|
199 |
+
'Facebook\\InstantArticles\\Transformer\\Settings\\AnalyticsSettings' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Settings/AnalyticsSettings.php',
|
200 |
+
'Facebook\\InstantArticles\\Transformer\\Transformer' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php',
|
201 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\DeprecatedRuleWarning' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/DeprecatedRuleWarning.php',
|
202 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\InvalidSelector' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php',
|
203 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\NoRootInstantArticleFoundWarning' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/NoRootInstantArticleFoundWarning.php',
|
204 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\UnrecognizedElement' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/UnrecognizedElement.php',
|
205 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\ValidatorWarning' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/ValidatorWarning.php',
|
206 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\Warning' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/Warning.php',
|
207 |
+
'Facebook\\InstantArticles\\Utils\\CSSBuilder' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/CSSBuilder.php',
|
208 |
+
'Facebook\\InstantArticles\\Utils\\CallbackHook' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/CallbackHook.php',
|
209 |
+
'Facebook\\InstantArticles\\Utils\\Hook' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/Hook.php',
|
210 |
+
'Facebook\\InstantArticles\\Utils\\Observer' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/Observer.php',
|
211 |
+
'Facebook\\InstantArticles\\Utils\\Warning' => $vendorDir . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/Warning.php',
|
212 |
+
'Facebook\\InstantArticles\\Validators\\InstantArticleValidator' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/InstantArticleValidator.php',
|
213 |
+
'Facebook\\InstantArticles\\Validators\\Type' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php',
|
214 |
+
'Facebook\\PersistentData\\FacebookMemoryPersistentDataHandler' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php',
|
215 |
+
'Facebook\\PersistentData\\FacebookSessionPersistentDataHandler' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php',
|
216 |
+
'Facebook\\PersistentData\\PersistentDataFactory' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataFactory.php',
|
217 |
+
'Facebook\\PersistentData\\PersistentDataInterface' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataInterface.php',
|
218 |
+
'Facebook\\PseudoRandomString\\McryptPseudoRandomStringGenerator' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php',
|
219 |
+
'Facebook\\PseudoRandomString\\OpenSslPseudoRandomStringGenerator' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php',
|
220 |
+
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorFactory' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php',
|
221 |
+
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorInterface' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php',
|
222 |
+
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorTrait' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php',
|
223 |
+
'Facebook\\PseudoRandomString\\RandomBytesPseudoRandomStringGenerator' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/RandomBytesPseudoRandomStringGenerator.php',
|
224 |
+
'Facebook\\PseudoRandomString\\UrandomPseudoRandomStringGenerator' => $vendorDir . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php',
|
225 |
+
'Facebook\\SignedRequest' => $vendorDir . '/facebook/graph-sdk/src/Facebook/SignedRequest.php',
|
226 |
+
'Facebook\\Url\\FacebookUrlDetectionHandler' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Url/FacebookUrlDetectionHandler.php',
|
227 |
+
'Facebook\\Url\\FacebookUrlManipulator' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php',
|
228 |
+
'Facebook\\Url\\UrlDetectionInterface' => $vendorDir . '/facebook/graph-sdk/src/Facebook/Url/UrlDetectionInterface.php',
|
229 |
+
'Symfony\\Component\\CssSelector\\CssSelector' => $vendorDir . '/symfony/css-selector/CssSelector.php',
|
230 |
+
'Symfony\\Component\\CssSelector\\CssSelectorConverter' => $vendorDir . '/symfony/css-selector/CssSelectorConverter.php',
|
231 |
+
'Symfony\\Component\\CssSelector\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/css-selector/Exception/ExceptionInterface.php',
|
232 |
+
'Symfony\\Component\\CssSelector\\Exception\\ExpressionErrorException' => $vendorDir . '/symfony/css-selector/Exception/ExpressionErrorException.php',
|
233 |
+
'Symfony\\Component\\CssSelector\\Exception\\InternalErrorException' => $vendorDir . '/symfony/css-selector/Exception/InternalErrorException.php',
|
234 |
+
'Symfony\\Component\\CssSelector\\Exception\\ParseException' => $vendorDir . '/symfony/css-selector/Exception/ParseException.php',
|
235 |
+
'Symfony\\Component\\CssSelector\\Exception\\SyntaxErrorException' => $vendorDir . '/symfony/css-selector/Exception/SyntaxErrorException.php',
|
236 |
+
'Symfony\\Component\\CssSelector\\Node\\AbstractNode' => $vendorDir . '/symfony/css-selector/Node/AbstractNode.php',
|
237 |
+
'Symfony\\Component\\CssSelector\\Node\\AttributeNode' => $vendorDir . '/symfony/css-selector/Node/AttributeNode.php',
|
238 |
+
'Symfony\\Component\\CssSelector\\Node\\ClassNode' => $vendorDir . '/symfony/css-selector/Node/ClassNode.php',
|
239 |
+
'Symfony\\Component\\CssSelector\\Node\\CombinedSelectorNode' => $vendorDir . '/symfony/css-selector/Node/CombinedSelectorNode.php',
|
240 |
+
'Symfony\\Component\\CssSelector\\Node\\ElementNode' => $vendorDir . '/symfony/css-selector/Node/ElementNode.php',
|
241 |
+
'Symfony\\Component\\CssSelector\\Node\\FunctionNode' => $vendorDir . '/symfony/css-selector/Node/FunctionNode.php',
|
242 |
+
'Symfony\\Component\\CssSelector\\Node\\HashNode' => $vendorDir . '/symfony/css-selector/Node/HashNode.php',
|
243 |
+
'Symfony\\Component\\CssSelector\\Node\\NegationNode' => $vendorDir . '/symfony/css-selector/Node/NegationNode.php',
|
244 |
+
'Symfony\\Component\\CssSelector\\Node\\NodeInterface' => $vendorDir . '/symfony/css-selector/Node/NodeInterface.php',
|
245 |
+
'Symfony\\Component\\CssSelector\\Node\\PseudoNode' => $vendorDir . '/symfony/css-selector/Node/PseudoNode.php',
|
246 |
+
'Symfony\\Component\\CssSelector\\Node\\SelectorNode' => $vendorDir . '/symfony/css-selector/Node/SelectorNode.php',
|
247 |
+
'Symfony\\Component\\CssSelector\\Node\\Specificity' => $vendorDir . '/symfony/css-selector/Node/Specificity.php',
|
248 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\CommentHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/CommentHandler.php',
|
249 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\HandlerInterface' => $vendorDir . '/symfony/css-selector/Parser/Handler/HandlerInterface.php',
|
250 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\HashHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/HashHandler.php',
|
251 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\IdentifierHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/IdentifierHandler.php',
|
252 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\NumberHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/NumberHandler.php',
|
253 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\StringHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/StringHandler.php',
|
254 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\WhitespaceHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/WhitespaceHandler.php',
|
255 |
+
'Symfony\\Component\\CssSelector\\Parser\\Parser' => $vendorDir . '/symfony/css-selector/Parser/Parser.php',
|
256 |
+
'Symfony\\Component\\CssSelector\\Parser\\ParserInterface' => $vendorDir . '/symfony/css-selector/Parser/ParserInterface.php',
|
257 |
+
'Symfony\\Component\\CssSelector\\Parser\\Reader' => $vendorDir . '/symfony/css-selector/Parser/Reader.php',
|
258 |
+
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ClassParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/ClassParser.php',
|
259 |
+
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ElementParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/ElementParser.php',
|
260 |
+
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\EmptyStringParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php',
|
261 |
+
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\HashParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/HashParser.php',
|
262 |
+
'Symfony\\Component\\CssSelector\\Parser\\Token' => $vendorDir . '/symfony/css-selector/Parser/Token.php',
|
263 |
+
'Symfony\\Component\\CssSelector\\Parser\\TokenStream' => $vendorDir . '/symfony/css-selector/Parser/TokenStream.php',
|
264 |
+
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\Tokenizer' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/Tokenizer.php',
|
265 |
+
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerEscaping' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php',
|
266 |
+
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerPatterns' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php',
|
267 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\AbstractExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/AbstractExtension.php',
|
268 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\AttributeMatchingExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php',
|
269 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\CombinationExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/CombinationExtension.php',
|
270 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\ExtensionInterface' => $vendorDir . '/symfony/css-selector/XPath/Extension/ExtensionInterface.php',
|
271 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\FunctionExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/FunctionExtension.php',
|
272 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\HtmlExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/HtmlExtension.php',
|
273 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\NodeExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/NodeExtension.php',
|
274 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\PseudoClassExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/PseudoClassExtension.php',
|
275 |
+
'Symfony\\Component\\CssSelector\\XPath\\Translator' => $vendorDir . '/symfony/css-selector/XPath/Translator.php',
|
276 |
+
'Symfony\\Component\\CssSelector\\XPath\\TranslatorInterface' => $vendorDir . '/symfony/css-selector/XPath/TranslatorInterface.php',
|
277 |
+
'Symfony\\Component\\CssSelector\\XPath\\XPathExpr' => $vendorDir . '/symfony/css-selector/XPath/XPathExpr.php',
|
278 |
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -13,54 +13,50 @@ class ComposerAutoloaderInit8b1e91281cd41e15c5fb1bef205d265f
|
|
13 |
}
|
14 |
}
|
15 |
|
|
|
|
|
|
|
16 |
public static function getLoader()
|
17 |
{
|
18 |
if (null !== self::$loader) {
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
-
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
-
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
-
foreach ($map as $namespace => $path) {
|
34 |
-
$loader->set($namespace, $path);
|
35 |
-
}
|
36 |
-
|
37 |
-
$map = require __DIR__ . '/autoload_psr4.php';
|
38 |
-
foreach ($map as $namespace => $path) {
|
39 |
-
$loader->setPsr4($namespace, $path);
|
40 |
-
}
|
41 |
-
|
42 |
$classMap = require __DIR__ . '/autoload_classmap.php';
|
43 |
if ($classMap) {
|
44 |
$loader->addClassMap($classMap);
|
45 |
}
|
46 |
}
|
47 |
|
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit6eba24516d4931b3ebc92cc334e50d01
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
13 |
}
|
14 |
}
|
15 |
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
public static function getLoader()
|
20 |
{
|
21 |
if (null !== self::$loader) {
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
require __DIR__ . '/platform_check.php';
|
26 |
+
|
27 |
+
spl_autoload_register(array('ComposerAutoloaderInit6eba24516d4931b3ebc92cc334e50d01', 'loadClassLoader'), true, true);
|
28 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
29 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit6eba24516d4931b3ebc92cc334e50d01', 'loadClassLoader'));
|
30 |
|
31 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
32 |
if ($useStaticLoader) {
|
33 |
+
require __DIR__ . '/autoload_static.php';
|
34 |
|
35 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit6eba24516d4931b3ebc92cc334e50d01::getInitializer($loader));
|
36 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
$classMap = require __DIR__ . '/autoload_classmap.php';
|
38 |
if ($classMap) {
|
39 |
$loader->addClassMap($classMap);
|
40 |
}
|
41 |
}
|
42 |
|
43 |
+
$loader->setClassMapAuthoritative(true);
|
44 |
$loader->register(true);
|
45 |
|
46 |
if ($useStaticLoader) {
|
47 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit6eba24516d4931b3ebc92cc334e50d01::$files;
|
48 |
} else {
|
49 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
50 |
}
|
51 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
52 |
+
composerRequire6eba24516d4931b3ebc92cc334e50d01($fileIdentifier, $file);
|
53 |
}
|
54 |
|
55 |
return $loader;
|
56 |
}
|
57 |
}
|
58 |
|
59 |
+
function composerRequire6eba24516d4931b3ebc92cc334e50d01($fileIdentifier, $file)
|
60 |
{
|
61 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
62 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'c65d09b6820da036953a371c8c73a9b1' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/polyfills.php',
|
@@ -46,11 +46,284 @@ class ComposerStaticInit8b1e91281cd41e15c5fb1bef205d265f
|
|
46 |
),
|
47 |
);
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
public static function getInitializer(ClassLoader $loader)
|
50 |
{
|
51 |
return \Closure::bind(function () use ($loader) {
|
52 |
-
$loader->prefixLengthsPsr4 =
|
53 |
-
$loader->prefixDirsPsr4 =
|
|
|
54 |
|
55 |
}, null, ClassLoader::class);
|
56 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit6eba24516d4931b3ebc92cc334e50d01
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'c65d09b6820da036953a371c8c73a9b1' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/polyfills.php',
|
46 |
),
|
47 |
);
|
48 |
|
49 |
+
public static $classMap = array (
|
50 |
+
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
51 |
+
'Doctrine\\Instantiator\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php',
|
52 |
+
'Doctrine\\Instantiator\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php',
|
53 |
+
'Doctrine\\Instantiator\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php',
|
54 |
+
'Doctrine\\Instantiator\\Instantiator' => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php',
|
55 |
+
'Doctrine\\Instantiator\\InstantiatorInterface' => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php',
|
56 |
+
'Facebook\\Authentication\\AccessToken' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Authentication/AccessToken.php',
|
57 |
+
'Facebook\\Authentication\\AccessTokenMetadata' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Authentication/AccessTokenMetadata.php',
|
58 |
+
'Facebook\\Authentication\\OAuth2Client' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Authentication/OAuth2Client.php',
|
59 |
+
'Facebook\\Exceptions\\FacebookAuthenticationException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthenticationException.php',
|
60 |
+
'Facebook\\Exceptions\\FacebookAuthorizationException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthorizationException.php',
|
61 |
+
'Facebook\\Exceptions\\FacebookClientException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookClientException.php',
|
62 |
+
'Facebook\\Exceptions\\FacebookOtherException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookOtherException.php',
|
63 |
+
'Facebook\\Exceptions\\FacebookResponseException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResponseException.php',
|
64 |
+
'Facebook\\Exceptions\\FacebookResumableUploadException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php',
|
65 |
+
'Facebook\\Exceptions\\FacebookSDKException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookSDKException.php',
|
66 |
+
'Facebook\\Exceptions\\FacebookServerException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookServerException.php',
|
67 |
+
'Facebook\\Exceptions\\FacebookThrottleException' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Exceptions/FacebookThrottleException.php',
|
68 |
+
'Facebook\\Facebook' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Facebook.php',
|
69 |
+
'Facebook\\FacebookApp' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FacebookApp.php',
|
70 |
+
'Facebook\\FacebookBatchRequest' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FacebookBatchRequest.php',
|
71 |
+
'Facebook\\FacebookBatchResponse' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FacebookBatchResponse.php',
|
72 |
+
'Facebook\\FacebookClient' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FacebookClient.php',
|
73 |
+
'Facebook\\FacebookRequest' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FacebookRequest.php',
|
74 |
+
'Facebook\\FacebookResponse' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FacebookResponse.php',
|
75 |
+
'Facebook\\FileUpload\\FacebookFile' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FileUpload/FacebookFile.php',
|
76 |
+
'Facebook\\FileUpload\\FacebookResumableUploader' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php',
|
77 |
+
'Facebook\\FileUpload\\FacebookTransferChunk' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php',
|
78 |
+
'Facebook\\FileUpload\\FacebookVideo' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FileUpload/FacebookVideo.php',
|
79 |
+
'Facebook\\FileUpload\\Mimetypes' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/FileUpload/Mimetypes.php',
|
80 |
+
'Facebook\\GraphNodes\\Birthday' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/Birthday.php',
|
81 |
+
'Facebook\\GraphNodes\\Collection' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/Collection.php',
|
82 |
+
'Facebook\\GraphNodes\\GraphAchievement' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php',
|
83 |
+
'Facebook\\GraphNodes\\GraphAlbum' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php',
|
84 |
+
'Facebook\\GraphNodes\\GraphApplication' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphApplication.php',
|
85 |
+
'Facebook\\GraphNodes\\GraphCoverPhoto' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php',
|
86 |
+
'Facebook\\GraphNodes\\GraphEdge' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEdge.php',
|
87 |
+
'Facebook\\GraphNodes\\GraphEvent' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEvent.php',
|
88 |
+
'Facebook\\GraphNodes\\GraphGroup' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphGroup.php',
|
89 |
+
'Facebook\\GraphNodes\\GraphList' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphList.php',
|
90 |
+
'Facebook\\GraphNodes\\GraphLocation' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphLocation.php',
|
91 |
+
'Facebook\\GraphNodes\\GraphNode' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNode.php',
|
92 |
+
'Facebook\\GraphNodes\\GraphNodeFactory' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php',
|
93 |
+
'Facebook\\GraphNodes\\GraphObject' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObject.php',
|
94 |
+
'Facebook\\GraphNodes\\GraphObjectFactory' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php',
|
95 |
+
'Facebook\\GraphNodes\\GraphPage' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPage.php',
|
96 |
+
'Facebook\\GraphNodes\\GraphPicture' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPicture.php',
|
97 |
+
'Facebook\\GraphNodes\\GraphSessionInfo' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php',
|
98 |
+
'Facebook\\GraphNodes\\GraphUser' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/GraphNodes/GraphUser.php',
|
99 |
+
'Facebook\\Helpers\\FacebookCanvasHelper' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php',
|
100 |
+
'Facebook\\Helpers\\FacebookJavaScriptHelper' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookJavaScriptHelper.php',
|
101 |
+
'Facebook\\Helpers\\FacebookPageTabHelper' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookPageTabHelper.php',
|
102 |
+
'Facebook\\Helpers\\FacebookRedirectLoginHelper' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php',
|
103 |
+
'Facebook\\Helpers\\FacebookSignedRequestFromInputHelper' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php',
|
104 |
+
'Facebook\\HttpClients\\FacebookCurl' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurl.php',
|
105 |
+
'Facebook\\HttpClients\\FacebookCurlHttpClient' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php',
|
106 |
+
'Facebook\\HttpClients\\FacebookGuzzleHttpClient' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php',
|
107 |
+
'Facebook\\HttpClients\\FacebookHttpClientInterface' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookHttpClientInterface.php',
|
108 |
+
'Facebook\\HttpClients\\FacebookStream' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStream.php',
|
109 |
+
'Facebook\\HttpClients\\FacebookStreamHttpClient' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php',
|
110 |
+
'Facebook\\HttpClients\\HttpClientsFactory' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php',
|
111 |
+
'Facebook\\Http\\GraphRawResponse' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Http/GraphRawResponse.php',
|
112 |
+
'Facebook\\Http\\RequestBodyInterface' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Http/RequestBodyInterface.php',
|
113 |
+
'Facebook\\Http\\RequestBodyMultipart' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Http/RequestBodyMultipart.php',
|
114 |
+
'Facebook\\Http\\RequestBodyUrlEncoded' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Http/RequestBodyUrlEncoded.php',
|
115 |
+
'Facebook\\InstantArticles\\AMP\\AMPArticle' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPArticle.php',
|
116 |
+
'Facebook\\InstantArticles\\AMP\\AMPCaption' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPCaption.php',
|
117 |
+
'Facebook\\InstantArticles\\AMP\\AMPContext' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPContext.php',
|
118 |
+
'Facebook\\InstantArticles\\AMP\\AMPCover' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPCover.php',
|
119 |
+
'Facebook\\InstantArticles\\AMP\\AMPCoverImage' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPCoverImage.php',
|
120 |
+
'Facebook\\InstantArticles\\AMP\\AMPHeader' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPHeader.php',
|
121 |
+
'Facebook\\InstantArticles\\AMP\\AMPImage' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPImage.php',
|
122 |
+
'Facebook\\InstantArticles\\Client\\Client' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Client.php',
|
123 |
+
'Facebook\\InstantArticles\\Client\\ClientException' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ClientException.php',
|
124 |
+
'Facebook\\InstantArticles\\Client\\Helper' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Helper.php',
|
125 |
+
'Facebook\\InstantArticles\\Client\\InstantArticleStatus' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/InstantArticleStatus.php',
|
126 |
+
'Facebook\\InstantArticles\\Client\\ServerMessage' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ServerMessage.php',
|
127 |
+
'Facebook\\InstantArticles\\Elements\\Ad' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Ad.php',
|
128 |
+
'Facebook\\InstantArticles\\Elements\\Analytics' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Analytics.php',
|
129 |
+
'Facebook\\InstantArticles\\Elements\\Anchor' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Anchor.php',
|
130 |
+
'Facebook\\InstantArticles\\Elements\\AnimatedGIF' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/AnimatedGIF.php',
|
131 |
+
'Facebook\\InstantArticles\\Elements\\Audible' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audible.php',
|
132 |
+
'Facebook\\InstantArticles\\Elements\\Audio' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audio.php',
|
133 |
+
'Facebook\\InstantArticles\\Elements\\Author' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Author.php',
|
134 |
+
'Facebook\\InstantArticles\\Elements\\Blockquote' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Blockquote.php',
|
135 |
+
'Facebook\\InstantArticles\\Elements\\Bold' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Bold.php',
|
136 |
+
'Facebook\\InstantArticles\\Elements\\Caption' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Caption.php',
|
137 |
+
'Facebook\\InstantArticles\\Elements\\ChildrenContainer' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ChildrenContainer.php',
|
138 |
+
'Facebook\\InstantArticles\\Elements\\Cite' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Cite.php',
|
139 |
+
'Facebook\\InstantArticles\\Elements\\Div' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Div.php',
|
140 |
+
'Facebook\\InstantArticles\\Elements\\Element' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Element.php',
|
141 |
+
'Facebook\\InstantArticles\\Elements\\ElementWithHTML' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ElementWithHTML.php',
|
142 |
+
'Facebook\\InstantArticles\\Elements\\Emphasized' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Emphasized.php',
|
143 |
+
'Facebook\\InstantArticles\\Elements\\Footer' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Footer.php',
|
144 |
+
'Facebook\\InstantArticles\\Elements\\FormattedText' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/FormattedText.php',
|
145 |
+
'Facebook\\InstantArticles\\Elements\\GeoTag' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/GeoTag.php',
|
146 |
+
'Facebook\\InstantArticles\\Elements\\H1' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H1.php',
|
147 |
+
'Facebook\\InstantArticles\\Elements\\H2' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H2.php',
|
148 |
+
'Facebook\\InstantArticles\\Elements\\H3' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H3.php',
|
149 |
+
'Facebook\\InstantArticles\\Elements\\Header' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Header.php',
|
150 |
+
'Facebook\\InstantArticles\\Elements\\Image' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Image.php',
|
151 |
+
'Facebook\\InstantArticles\\Elements\\InstantArticle' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php',
|
152 |
+
'Facebook\\InstantArticles\\Elements\\InstantArticleInterface' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticleInterface.php',
|
153 |
+
'Facebook\\InstantArticles\\Elements\\Interactive' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Interactive.php',
|
154 |
+
'Facebook\\InstantArticles\\Elements\\Italic' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Italic.php',
|
155 |
+
'Facebook\\InstantArticles\\Elements\\LineBreak' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/LineBreak.php',
|
156 |
+
'Facebook\\InstantArticles\\Elements\\ListElement' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListElement.php',
|
157 |
+
'Facebook\\InstantArticles\\Elements\\ListItem' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListItem.php',
|
158 |
+
'Facebook\\InstantArticles\\Elements\\Map' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Map.php',
|
159 |
+
'Facebook\\InstantArticles\\Elements\\Paragraph' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Paragraph.php',
|
160 |
+
'Facebook\\InstantArticles\\Elements\\Pullquote' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Pullquote.php',
|
161 |
+
'Facebook\\InstantArticles\\Elements\\RelatedArticles' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedArticles.php',
|
162 |
+
'Facebook\\InstantArticles\\Elements\\RelatedItem' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedItem.php',
|
163 |
+
'Facebook\\InstantArticles\\Elements\\Slideshow' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Slideshow.php',
|
164 |
+
'Facebook\\InstantArticles\\Elements\\Small' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Small.php',
|
165 |
+
'Facebook\\InstantArticles\\Elements\\SocialEmbed' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/SocialEmbed.php',
|
166 |
+
'Facebook\\InstantArticles\\Elements\\Span' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Span.php',
|
167 |
+
'Facebook\\InstantArticles\\Elements\\Sponsor' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Sponsor.php',
|
168 |
+
'Facebook\\InstantArticles\\Elements\\TextContainer' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/TextContainer.php',
|
169 |
+
'Facebook\\InstantArticles\\Elements\\Time' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Time.php',
|
170 |
+
'Facebook\\InstantArticles\\Elements\\Video' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Video.php',
|
171 |
+
'Facebook\\InstantArticles\\Parser\\Parser' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Parser/Parser.php',
|
172 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\AbstractGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/AbstractGetter.php',
|
173 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\ChildrenGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ChildrenGetter.php',
|
174 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\ConstantGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ConstantGetter.php',
|
175 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\DateGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/DateGetter.php',
|
176 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\ElementGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php',
|
177 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\ExistsGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ExistsGetter.php',
|
178 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\FragmentGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/FragmentGetter.php',
|
179 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\GetterFactory' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/GetterFactory.php',
|
180 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\IntegerGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/IntegerGetter.php',
|
181 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\JSONGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/JSONGetter.php',
|
182 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\MultipleElementsGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php',
|
183 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\NextSiblingElementGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingElementGetter.php',
|
184 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\NextSiblingGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingGetter.php',
|
185 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\StringGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/StringGetter.php',
|
186 |
+
'Facebook\\InstantArticles\\Transformer\\Getters\\XpathGetter' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/XpathGetter.php',
|
187 |
+
'Facebook\\InstantArticles\\Transformer\\Logs\\TransformerLog' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Logs/TransformerLog.php',
|
188 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AdRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AdRule.php',
|
189 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AnalyticsRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnalyticsRule.php',
|
190 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AnchorRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnchorRule.php',
|
191 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AudioRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AudioRule.php',
|
192 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\AuthorRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AuthorRule.php',
|
193 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\BlockquoteRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BlockquoteRule.php',
|
194 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\BoldRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BoldRule.php',
|
195 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\CaptionCreditRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionCreditRule.php',
|
196 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\CaptionRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionRule.php',
|
197 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\Compat\\JetpackSlideshowRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Compat/JetpackSlideshowRule.php',
|
198 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ConfigurationSelectorRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ConfigurationSelectorRule.php',
|
199 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\EmphasizedRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/EmphasizedRule.php',
|
200 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\FooterRelatedArticlesRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRelatedArticlesRule.php',
|
201 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\FooterRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRule.php',
|
202 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\FooterSmallRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterSmallRule.php',
|
203 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\GeoTagRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/GeoTagRule.php',
|
204 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\GlobalRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/GlobalRule.php',
|
205 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\H1Rule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H1Rule.php',
|
206 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\H2Rule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H2Rule.php',
|
207 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderAdRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderAdRule.php',
|
208 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderImageRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderImageRule.php',
|
209 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderKickerRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderKickerRule.php',
|
210 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderRule.php',
|
211 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderSubTitleRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderSubTitleRule.php',
|
212 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderTitleRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderTitleRule.php',
|
213 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\IgnoreRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/IgnoreRule.php',
|
214 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ImageInsideParagraphRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageInsideParagraphRule.php',
|
215 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ImageRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageRule.php',
|
216 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\InstantArticleRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php',
|
217 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\InteractiveInsideParagraphRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveInsideParagraphRule.php',
|
218 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\InteractiveRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveRule.php',
|
219 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ItalicRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ItalicRule.php',
|
220 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\LineBreakRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/LineBreakRule.php',
|
221 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ListElementRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListElementRule.php',
|
222 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ListItemRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListItemRule.php',
|
223 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\MapRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/MapRule.php',
|
224 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ParagraphFooterRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphFooterRule.php',
|
225 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\ParagraphRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphRule.php',
|
226 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\PassThroughRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PassThroughRule.php',
|
227 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\PullquoteCiteRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PullquoteCiteRule.php',
|
228 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\PullquoteRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PullquoteRule.php',
|
229 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\RelatedArticlesRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedArticlesRule.php',
|
230 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\RelatedItemRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedItemRule.php',
|
231 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\Rule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Rule.php',
|
232 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\SlideshowImageRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SlideshowImageRule.php',
|
233 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\SlideshowRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SlideshowRule.php',
|
234 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\SocialEmbedRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SocialEmbedRule.php',
|
235 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\SponsorRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SponsorRule.php',
|
236 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\TextNodeRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TextNodeRule.php',
|
237 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\TimeRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php',
|
238 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\VideoRule' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/VideoRule.php',
|
239 |
+
'Facebook\\InstantArticles\\Transformer\\Settings\\AdSettings' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Settings/AdSettings.php',
|
240 |
+
'Facebook\\InstantArticles\\Transformer\\Settings\\AnalyticsSettings' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Settings/AnalyticsSettings.php',
|
241 |
+
'Facebook\\InstantArticles\\Transformer\\Transformer' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php',
|
242 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\DeprecatedRuleWarning' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/DeprecatedRuleWarning.php',
|
243 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\InvalidSelector' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php',
|
244 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\NoRootInstantArticleFoundWarning' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/NoRootInstantArticleFoundWarning.php',
|
245 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\UnrecognizedElement' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/UnrecognizedElement.php',
|
246 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\ValidatorWarning' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/ValidatorWarning.php',
|
247 |
+
'Facebook\\InstantArticles\\Transformer\\Warnings\\Warning' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/Warning.php',
|
248 |
+
'Facebook\\InstantArticles\\Utils\\CSSBuilder' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/CSSBuilder.php',
|
249 |
+
'Facebook\\InstantArticles\\Utils\\CallbackHook' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/CallbackHook.php',
|
250 |
+
'Facebook\\InstantArticles\\Utils\\Hook' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/Hook.php',
|
251 |
+
'Facebook\\InstantArticles\\Utils\\Observer' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/Observer.php',
|
252 |
+
'Facebook\\InstantArticles\\Utils\\Warning' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/Warning.php',
|
253 |
+
'Facebook\\InstantArticles\\Validators\\InstantArticleValidator' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/InstantArticleValidator.php',
|
254 |
+
'Facebook\\InstantArticles\\Validators\\Type' => __DIR__ . '/..' . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php',
|
255 |
+
'Facebook\\PersistentData\\FacebookMemoryPersistentDataHandler' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php',
|
256 |
+
'Facebook\\PersistentData\\FacebookSessionPersistentDataHandler' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php',
|
257 |
+
'Facebook\\PersistentData\\PersistentDataFactory' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataFactory.php',
|
258 |
+
'Facebook\\PersistentData\\PersistentDataInterface' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataInterface.php',
|
259 |
+
'Facebook\\PseudoRandomString\\McryptPseudoRandomStringGenerator' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php',
|
260 |
+
'Facebook\\PseudoRandomString\\OpenSslPseudoRandomStringGenerator' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php',
|
261 |
+
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorFactory' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php',
|
262 |
+
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorInterface' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php',
|
263 |
+
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorTrait' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php',
|
264 |
+
'Facebook\\PseudoRandomString\\RandomBytesPseudoRandomStringGenerator' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/RandomBytesPseudoRandomStringGenerator.php',
|
265 |
+
'Facebook\\PseudoRandomString\\UrandomPseudoRandomStringGenerator' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php',
|
266 |
+
'Facebook\\SignedRequest' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/SignedRequest.php',
|
267 |
+
'Facebook\\Url\\FacebookUrlDetectionHandler' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Url/FacebookUrlDetectionHandler.php',
|
268 |
+
'Facebook\\Url\\FacebookUrlManipulator' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php',
|
269 |
+
'Facebook\\Url\\UrlDetectionInterface' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/Url/UrlDetectionInterface.php',
|
270 |
+
'Symfony\\Component\\CssSelector\\CssSelector' => __DIR__ . '/..' . '/symfony/css-selector/CssSelector.php',
|
271 |
+
'Symfony\\Component\\CssSelector\\CssSelectorConverter' => __DIR__ . '/..' . '/symfony/css-selector/CssSelectorConverter.php',
|
272 |
+
'Symfony\\Component\\CssSelector\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/css-selector/Exception/ExceptionInterface.php',
|
273 |
+
'Symfony\\Component\\CssSelector\\Exception\\ExpressionErrorException' => __DIR__ . '/..' . '/symfony/css-selector/Exception/ExpressionErrorException.php',
|
274 |
+
'Symfony\\Component\\CssSelector\\Exception\\InternalErrorException' => __DIR__ . '/..' . '/symfony/css-selector/Exception/InternalErrorException.php',
|
275 |
+
'Symfony\\Component\\CssSelector\\Exception\\ParseException' => __DIR__ . '/..' . '/symfony/css-selector/Exception/ParseException.php',
|
276 |
+
'Symfony\\Component\\CssSelector\\Exception\\SyntaxErrorException' => __DIR__ . '/..' . '/symfony/css-selector/Exception/SyntaxErrorException.php',
|
277 |
+
'Symfony\\Component\\CssSelector\\Node\\AbstractNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/AbstractNode.php',
|
278 |
+
'Symfony\\Component\\CssSelector\\Node\\AttributeNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/AttributeNode.php',
|
279 |
+
'Symfony\\Component\\CssSelector\\Node\\ClassNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/ClassNode.php',
|
280 |
+
'Symfony\\Component\\CssSelector\\Node\\CombinedSelectorNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/CombinedSelectorNode.php',
|
281 |
+
'Symfony\\Component\\CssSelector\\Node\\ElementNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/ElementNode.php',
|
282 |
+
'Symfony\\Component\\CssSelector\\Node\\FunctionNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/FunctionNode.php',
|
283 |
+
'Symfony\\Component\\CssSelector\\Node\\HashNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/HashNode.php',
|
284 |
+
'Symfony\\Component\\CssSelector\\Node\\NegationNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/NegationNode.php',
|
285 |
+
'Symfony\\Component\\CssSelector\\Node\\NodeInterface' => __DIR__ . '/..' . '/symfony/css-selector/Node/NodeInterface.php',
|
286 |
+
'Symfony\\Component\\CssSelector\\Node\\PseudoNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/PseudoNode.php',
|
287 |
+
'Symfony\\Component\\CssSelector\\Node\\SelectorNode' => __DIR__ . '/..' . '/symfony/css-selector/Node/SelectorNode.php',
|
288 |
+
'Symfony\\Component\\CssSelector\\Node\\Specificity' => __DIR__ . '/..' . '/symfony/css-selector/Node/Specificity.php',
|
289 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\CommentHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/CommentHandler.php',
|
290 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\HandlerInterface' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/HandlerInterface.php',
|
291 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\HashHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/HashHandler.php',
|
292 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\IdentifierHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/IdentifierHandler.php',
|
293 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\NumberHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/NumberHandler.php',
|
294 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\StringHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/StringHandler.php',
|
295 |
+
'Symfony\\Component\\CssSelector\\Parser\\Handler\\WhitespaceHandler' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Handler/WhitespaceHandler.php',
|
296 |
+
'Symfony\\Component\\CssSelector\\Parser\\Parser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Parser.php',
|
297 |
+
'Symfony\\Component\\CssSelector\\Parser\\ParserInterface' => __DIR__ . '/..' . '/symfony/css-selector/Parser/ParserInterface.php',
|
298 |
+
'Symfony\\Component\\CssSelector\\Parser\\Reader' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Reader.php',
|
299 |
+
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ClassParser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Shortcut/ClassParser.php',
|
300 |
+
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ElementParser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Shortcut/ElementParser.php',
|
301 |
+
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\EmptyStringParser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php',
|
302 |
+
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\HashParser' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Shortcut/HashParser.php',
|
303 |
+
'Symfony\\Component\\CssSelector\\Parser\\Token' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Token.php',
|
304 |
+
'Symfony\\Component\\CssSelector\\Parser\\TokenStream' => __DIR__ . '/..' . '/symfony/css-selector/Parser/TokenStream.php',
|
305 |
+
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\Tokenizer' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Tokenizer/Tokenizer.php',
|
306 |
+
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerEscaping' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php',
|
307 |
+
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerPatterns' => __DIR__ . '/..' . '/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php',
|
308 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\AbstractExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/AbstractExtension.php',
|
309 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\AttributeMatchingExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php',
|
310 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\CombinationExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/CombinationExtension.php',
|
311 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\ExtensionInterface' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/ExtensionInterface.php',
|
312 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\FunctionExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/FunctionExtension.php',
|
313 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\HtmlExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/HtmlExtension.php',
|
314 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\NodeExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/NodeExtension.php',
|
315 |
+
'Symfony\\Component\\CssSelector\\XPath\\Extension\\PseudoClassExtension' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Extension/PseudoClassExtension.php',
|
316 |
+
'Symfony\\Component\\CssSelector\\XPath\\Translator' => __DIR__ . '/..' . '/symfony/css-selector/XPath/Translator.php',
|
317 |
+
'Symfony\\Component\\CssSelector\\XPath\\TranslatorInterface' => __DIR__ . '/..' . '/symfony/css-selector/XPath/TranslatorInterface.php',
|
318 |
+
'Symfony\\Component\\CssSelector\\XPath\\XPathExpr' => __DIR__ . '/..' . '/symfony/css-selector/XPath/XPathExpr.php',
|
319 |
+
);
|
320 |
+
|
321 |
public static function getInitializer(ClassLoader $loader)
|
322 |
{
|
323 |
return \Closure::bind(function () use ($loader) {
|
324 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit6eba24516d4931b3ebc92cc334e50d01::$prefixLengthsPsr4;
|
325 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit6eba24516d4931b3ebc92cc334e50d01::$prefixDirsPsr4;
|
326 |
+
$loader->classMap = ComposerStaticInit6eba24516d4931b3ebc92cc334e50d01::$classMap;
|
327 |
|
328 |
}, null, ClassLoader::class);
|
329 |
}
|
vendor/composer/installed.json
CHANGED
@@ -1,380 +1,362 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
"
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
"
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
"
|
19 |
-
|
20 |
-
|
21 |
-
"
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
}
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
"
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
"
|
80 |
-
"
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
"
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
{
|
97 |
-
"
|
98 |
-
"
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
"
|
105 |
-
"
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
"
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
"
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
"
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
"
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
"
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
"
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
"
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
"
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
"
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
"
|
233 |
-
"
|
234 |
-
"
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
"
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
"
|
247 |
-
|
248 |
-
|
249 |
-
"
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
"
|
291 |
-
"
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
"
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
"/
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
"
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
"
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
"notification-url": "https://packagist.org/downloads/",
|
364 |
-
"license": [
|
365 |
-
"MIT"
|
366 |
-
],
|
367 |
-
"authors": [
|
368 |
-
{
|
369 |
-
"name": "Contributors",
|
370 |
-
"homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
|
371 |
-
}
|
372 |
-
],
|
373 |
-
"description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
|
374 |
-
"keywords": [
|
375 |
-
"phpcs",
|
376 |
-
"standards",
|
377 |
-
"wordpress"
|
378 |
-
]
|
379 |
-
}
|
380 |
-
]
|
1 |
+
{
|
2 |
+
"packages": [
|
3 |
+
{
|
4 |
+
"name": "doctrine/instantiator",
|
5 |
+
"version": "1.4.1",
|
6 |
+
"version_normalized": "1.4.1.0",
|
7 |
+
"source": {
|
8 |
+
"type": "git",
|
9 |
+
"url": "https://github.com/doctrine/instantiator.git",
|
10 |
+
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc"
|
11 |
+
},
|
12 |
+
"dist": {
|
13 |
+
"type": "zip",
|
14 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc",
|
15 |
+
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc",
|
16 |
+
"shasum": ""
|
17 |
+
},
|
18 |
+
"require": {
|
19 |
+
"php": "^7.1 || ^8.0"
|
20 |
+
},
|
21 |
+
"require-dev": {
|
22 |
+
"doctrine/coding-standard": "^9",
|
23 |
+
"ext-pdo": "*",
|
24 |
+
"ext-phar": "*",
|
25 |
+
"phpbench/phpbench": "^0.16 || ^1",
|
26 |
+
"phpstan/phpstan": "^1.4",
|
27 |
+
"phpstan/phpstan-phpunit": "^1",
|
28 |
+
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
29 |
+
"vimeo/psalm": "^4.22"
|
30 |
+
},
|
31 |
+
"time": "2022-03-03T08:28:38+00:00",
|
32 |
+
"type": "library",
|
33 |
+
"installation-source": "dist",
|
34 |
+
"autoload": {
|
35 |
+
"psr-4": {
|
36 |
+
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
37 |
+
}
|
38 |
+
},
|
39 |
+
"notification-url": "https://packagist.org/downloads/",
|
40 |
+
"license": [
|
41 |
+
"MIT"
|
42 |
+
],
|
43 |
+
"authors": [
|
44 |
+
{
|
45 |
+
"name": "Marco Pivetta",
|
46 |
+
"email": "ocramius@gmail.com",
|
47 |
+
"homepage": "https://ocramius.github.io/"
|
48 |
+
}
|
49 |
+
],
|
50 |
+
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
51 |
+
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
|
52 |
+
"keywords": [
|
53 |
+
"constructor",
|
54 |
+
"instantiate"
|
55 |
+
],
|
56 |
+
"support": {
|
57 |
+
"issues": "https://github.com/doctrine/instantiator/issues",
|
58 |
+
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
|
59 |
+
},
|
60 |
+
"funding": [
|
61 |
+
{
|
62 |
+
"url": "https://www.doctrine-project.org/sponsorship.html",
|
63 |
+
"type": "custom"
|
64 |
+
},
|
65 |
+
{
|
66 |
+
"url": "https://www.patreon.com/phpdoctrine",
|
67 |
+
"type": "patreon"
|
68 |
+
},
|
69 |
+
{
|
70 |
+
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
|
71 |
+
"type": "tidelift"
|
72 |
+
}
|
73 |
+
],
|
74 |
+
"install-path": "../doctrine/instantiator"
|
75 |
+
},
|
76 |
+
{
|
77 |
+
"name": "facebook/facebook-instant-articles-sdk-extensions-in-php",
|
78 |
+
"version": "dev-php8",
|
79 |
+
"version_normalized": "dev-php8",
|
80 |
+
"source": {
|
81 |
+
"type": "git",
|
82 |
+
"url": "https://github.com/whyisjake/facebook-instant-articles-sdk-extensions-in-php.git",
|
83 |
+
"reference": "2e9c55f6f84479cefd147656e0d2bada95e0d99a"
|
84 |
+
},
|
85 |
+
"dist": {
|
86 |
+
"type": "zip",
|
87 |
+
"url": "https://api.github.com/repos/whyisjake/facebook-instant-articles-sdk-extensions-in-php/zipball/2e9c55f6f84479cefd147656e0d2bada95e0d99a",
|
88 |
+
"reference": "2e9c55f6f84479cefd147656e0d2bada95e0d99a",
|
89 |
+
"shasum": ""
|
90 |
+
},
|
91 |
+
"require": {
|
92 |
+
"doctrine/instantiator": "1.4.1",
|
93 |
+
"facebook/facebook-instant-articles-sdk-php": "dev-php8",
|
94 |
+
"php": "^5.4 || ^7.0 || ^8.0"
|
95 |
+
},
|
96 |
+
"require-dev": {
|
97 |
+
"phpcompatibility/phpcompatibility-wp": "^2.1",
|
98 |
+
"phpdocumentor/reflection-docblock": "^2.0",
|
99 |
+
"phpunit/phpunit": "^4.8",
|
100 |
+
"squizlabs/php_codesniffer": "^3.0.0"
|
101 |
+
},
|
102 |
+
"time": "2022-10-17T21:35:17+00:00",
|
103 |
+
"type": "library",
|
104 |
+
"installation-source": "dist",
|
105 |
+
"autoload": {
|
106 |
+
"psr-4": {
|
107 |
+
"Facebook\\InstantArticles\\": "src/Facebook/InstantArticles/"
|
108 |
+
}
|
109 |
+
},
|
110 |
+
"autoload-dev": {
|
111 |
+
"psr-4": {
|
112 |
+
"Facebook\\InstantArticles\\": "tests/Facebook/InstantArticles/"
|
113 |
+
}
|
114 |
+
},
|
115 |
+
"scripts": {
|
116 |
+
"all": [
|
117 |
+
"@cs",
|
118 |
+
"@test"
|
119 |
+
],
|
120 |
+
"cs": [
|
121 |
+
"composer install",
|
122 |
+
"phpcbf --standard=phpcs.xml -p || phpcs --standard=phpcs.xml -p"
|
123 |
+
],
|
124 |
+
"test": [
|
125 |
+
"composer install",
|
126 |
+
"phpunit"
|
127 |
+
]
|
128 |
+
},
|
129 |
+
"license": [
|
130 |
+
"proprietary"
|
131 |
+
],
|
132 |
+
"authors": [
|
133 |
+
{
|
134 |
+
"name": "Facebook",
|
135 |
+
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php/contributors"
|
136 |
+
}
|
137 |
+
],
|
138 |
+
"description": "Facebook Instant Articles SDK Extensions in PHP to transform Instant Articles markup file into AMP",
|
139 |
+
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-extensions-in-php",
|
140 |
+
"keywords": [
|
141 |
+
"amp",
|
142 |
+
"articles",
|
143 |
+
"extensions",
|
144 |
+
"facebook",
|
145 |
+
"instant",
|
146 |
+
"instantarticles",
|
147 |
+
"sdk"
|
148 |
+
],
|
149 |
+
"support": {
|
150 |
+
"source": "https://github.com/whyisjake/facebook-instant-articles-sdk-extensions-in-php/tree/php8"
|
151 |
+
},
|
152 |
+
"install-path": "../facebook/facebook-instant-articles-sdk-extensions-in-php"
|
153 |
+
},
|
154 |
+
{
|
155 |
+
"name": "facebook/facebook-instant-articles-sdk-php",
|
156 |
+
"version": "dev-php8",
|
157 |
+
"version_normalized": "dev-php8",
|
158 |
+
"source": {
|
159 |
+
"type": "git",
|
160 |
+
"url": "https://github.com/whyisjake/facebook-instant-articles-sdk-php.git",
|
161 |
+
"reference": "ec12f3cc823249599778ce2be1a88068b2a7e3f6"
|
162 |
+
},
|
163 |
+
"dist": {
|
164 |
+
"type": "zip",
|
165 |
+
"url": "https://api.github.com/repos/whyisjake/facebook-instant-articles-sdk-php/zipball/ec12f3cc823249599778ce2be1a88068b2a7e3f6",
|
166 |
+
"reference": "ec12f3cc823249599778ce2be1a88068b2a7e3f6",
|
167 |
+
"shasum": ""
|
168 |
+
},
|
169 |
+
"require": {
|
170 |
+
"facebook/graph-sdk": "dev-php8",
|
171 |
+
"php": ">=5.4",
|
172 |
+
"symfony/css-selector": "^2.8 || ^3.1 || ^4.1"
|
173 |
+
},
|
174 |
+
"require-dev": {
|
175 |
+
"fzaninotto/faker": "dev-master",
|
176 |
+
"phpcompatibility/phpcompatibility-wp": "^2.1",
|
177 |
+
"phpdocumentor/reflection-docblock": "^2.0 || ^4.0",
|
178 |
+
"phpunit/phpunit": "4.8.*",
|
179 |
+
"squizlabs/php_codesniffer": "^2.6.0 || ^3.0.0",
|
180 |
+
"symfony/yaml": "2.1.* || 3.4.*"
|
181 |
+
},
|
182 |
+
"time": "2022-10-17T21:34:53+00:00",
|
183 |
+
"type": "library",
|
184 |
+
"installation-source": "dist",
|
185 |
+
"autoload": {
|
186 |
+
"psr-4": {
|
187 |
+
"Facebook\\InstantArticles\\": "src/Facebook/InstantArticles/"
|
188 |
+
}
|
189 |
+
},
|
190 |
+
"autoload-dev": {
|
191 |
+
"psr-4": {
|
192 |
+
"Facebook\\": "tests/Facebook/"
|
193 |
+
}
|
194 |
+
},
|
195 |
+
"scripts": {
|
196 |
+
"all": [
|
197 |
+
"@cs",
|
198 |
+
"@test"
|
199 |
+
],
|
200 |
+
"cs": [
|
201 |
+
"composer install",
|
202 |
+
"phpcbf --standard=phpcs.xml -p || phpcs --standard=phpcs.xml -p"
|
203 |
+
],
|
204 |
+
"test": [
|
205 |
+
"composer install",
|
206 |
+
"phpunit"
|
207 |
+
]
|
208 |
+
},
|
209 |
+
"license": [
|
210 |
+
"proprietary"
|
211 |
+
],
|
212 |
+
"authors": [
|
213 |
+
{
|
214 |
+
"name": "Facebook",
|
215 |
+
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php/contributors"
|
216 |
+
}
|
217 |
+
],
|
218 |
+
"description": "Facebook Instant Articles SDK for PHP",
|
219 |
+
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php",
|
220 |
+
"keywords": [
|
221 |
+
"articles",
|
222 |
+
"facebook",
|
223 |
+
"instant",
|
224 |
+
"sdk"
|
225 |
+
],
|
226 |
+
"support": {
|
227 |
+
"source": "https://github.com/whyisjake/facebook-instant-articles-sdk-php/tree/php8"
|
228 |
+
},
|
229 |
+
"install-path": "../facebook/facebook-instant-articles-sdk-php"
|
230 |
+
},
|
231 |
+
{
|
232 |
+
"name": "facebook/graph-sdk",
|
233 |
+
"version": "dev-php8",
|
234 |
+
"version_normalized": "dev-php8",
|
235 |
+
"source": {
|
236 |
+
"type": "git",
|
237 |
+
"url": "https://github.com/whyisjake/php-graph-sdk.git",
|
238 |
+
"reference": "2a225c96b5f8fda6f44aabadd36cbb219d0f736d"
|
239 |
+
},
|
240 |
+
"dist": {
|
241 |
+
"type": "zip",
|
242 |
+
"url": "https://api.github.com/repos/whyisjake/php-graph-sdk/zipball/2a225c96b5f8fda6f44aabadd36cbb219d0f736d",
|
243 |
+
"reference": "2a225c96b5f8fda6f44aabadd36cbb219d0f736d",
|
244 |
+
"shasum": ""
|
245 |
+
},
|
246 |
+
"require": {
|
247 |
+
"php": ">=5.4"
|
248 |
+
},
|
249 |
+
"require-dev": {
|
250 |
+
"guzzlehttp/guzzle": "~5.0",
|
251 |
+
"mockery/mockery": "~0.8",
|
252 |
+
"phpcompatibility/phpcompatibility-wp": "^2.1",
|
253 |
+
"phpunit/phpunit": "~4.0"
|
254 |
+
},
|
255 |
+
"suggest": {
|
256 |
+
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client",
|
257 |
+
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5"
|
258 |
+
},
|
259 |
+
"time": "2022-10-17T21:35:07+00:00",
|
260 |
+
"type": "library",
|
261 |
+
"extra": {
|
262 |
+
"branch-alias": {
|
263 |
+
"dev-master": "5.x-dev"
|
264 |
+
}
|
265 |
+
},
|
266 |
+
"installation-source": "dist",
|
267 |
+
"autoload": {
|
268 |
+
"psr-4": {
|
269 |
+
"Facebook\\": "src/Facebook/"
|
270 |
+
},
|
271 |
+
"files": [
|
272 |
+
"src/Facebook/polyfills.php"
|
273 |
+
]
|
274 |
+
},
|
275 |
+
"autoload-dev": {
|
276 |
+
"psr-4": {
|
277 |
+
"Facebook\\Tests\\": "tests/"
|
278 |
+
}
|
279 |
+
},
|
280 |
+
"license": [
|
281 |
+
"Facebook Platform"
|
282 |
+
],
|
283 |
+
"authors": [
|
284 |
+
{
|
285 |
+
"name": "Facebook",
|
286 |
+
"homepage": "https://github.com/facebook/php-graph-sdk/contributors"
|
287 |
+
}
|
288 |
+
],
|
289 |
+
"description": "Facebook SDK for PHP",
|
290 |
+
"homepage": "https://github.com/facebook/php-graph-sdk",
|
291 |
+
"keywords": [
|
292 |
+
"facebook",
|
293 |
+
"sdk"
|
294 |
+
],
|
295 |
+
"support": {
|
296 |
+
"source": "https://github.com/whyisjake/php-graph-sdk/tree/php8"
|
297 |
+
},
|
298 |
+
"install-path": "../facebook/graph-sdk"
|
299 |
+
},
|
300 |
+
{
|
301 |
+
"name": "symfony/css-selector",
|
302 |
+
"version": "v2.8.52",
|
303 |
+
"version_normalized": "2.8.52.0",
|
304 |
+
"source": {
|
305 |
+
"type": "git",
|
306 |
+
"url": "https://github.com/symfony/css-selector.git",
|
307 |
+
"reference": "7b1692e418d7ccac24c373528453bc90e42797de"
|
308 |
+
},
|
309 |
+
"dist": {
|
310 |
+
"type": "zip",
|
311 |
+
"url": "https://api.github.com/repos/symfony/css-selector/zipball/7b1692e418d7ccac24c373528453bc90e42797de",
|
312 |
+
"reference": "7b1692e418d7ccac24c373528453bc90e42797de",
|
313 |
+
"shasum": ""
|
314 |
+
},
|
315 |
+
"require": {
|
316 |
+
"php": ">=5.3.9"
|
317 |
+
},
|
318 |
+
"time": "2018-11-11T11:18:13+00:00",
|
319 |
+
"type": "library",
|
320 |
+
"extra": {
|
321 |
+
"branch-alias": {
|
322 |
+
"dev-master": "2.8-dev"
|
323 |
+
}
|
324 |
+
},
|
325 |
+
"installation-source": "dist",
|
326 |
+
"autoload": {
|
327 |
+
"psr-4": {
|
328 |
+
"Symfony\\Component\\CssSelector\\": ""
|
329 |
+
},
|
330 |
+
"exclude-from-classmap": [
|
331 |
+
"/Tests/"
|
332 |
+
]
|
333 |
+
},
|
334 |
+
"notification-url": "https://packagist.org/downloads/",
|
335 |
+
"license": [
|
336 |
+
"MIT"
|
337 |
+
],
|
338 |
+
"authors": [
|
339 |
+
{
|
340 |
+
"name": "Fabien Potencier",
|
341 |
+
"email": "fabien@symfony.com"
|
342 |
+
},
|
343 |
+
{
|
344 |
+
"name": "Jean-François Simon",
|
345 |
+
"email": "jeanfrancois.simon@sensiolabs.com"
|
346 |
+
},
|
347 |
+
{
|
348 |
+
"name": "Symfony Community",
|
349 |
+
"homepage": "https://symfony.com/contributors"
|
350 |
+
}
|
351 |
+
],
|
352 |
+
"description": "Symfony CssSelector Component",
|
353 |
+
"homepage": "https://symfony.com",
|
354 |
+
"support": {
|
355 |
+
"source": "https://github.com/symfony/css-selector/tree/v2.8.52"
|
356 |
+
},
|
357 |
+
"install-path": "../symfony/css-selector"
|
358 |
+
}
|
359 |
+
],
|
360 |
+
"dev": false,
|
361 |
+
"dev-package-names": []
|
362 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/composer/installed.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php return array(
|
2 |
+
'root' => array(
|
3 |
+
'pretty_version' => 'dev-develop',
|
4 |
+
'version' => 'dev-develop',
|
5 |
+
'type' => 'wordpress-plugin',
|
6 |
+
'install_path' => __DIR__ . '/../../',
|
7 |
+
'aliases' => array(),
|
8 |
+
'reference' => '930354128773e49bdeaac40ffdbde385ae69fd2b',
|
9 |
+
'name' => 'automattic/facebook-instant-articles-wp',
|
10 |
+
'dev' => false,
|
11 |
+
),
|
12 |
+
'versions' => array(
|
13 |
+
'automattic/facebook-instant-articles-wp' => array(
|
14 |
+
'pretty_version' => 'dev-develop',
|
15 |
+
'version' => 'dev-develop',
|
16 |
+
'type' => 'wordpress-plugin',
|
17 |
+
'install_path' => __DIR__ . '/../../',
|
18 |
+
'aliases' => array(),
|
19 |
+
'reference' => '930354128773e49bdeaac40ffdbde385ae69fd2b',
|
20 |
+
'dev_requirement' => false,
|
21 |
+
),
|
22 |
+
'doctrine/instantiator' => array(
|
23 |
+
'pretty_version' => '1.4.1',
|
24 |
+
'version' => '1.4.1.0',
|
25 |
+
'type' => 'library',
|
26 |
+
'install_path' => __DIR__ . '/../doctrine/instantiator',
|
27 |
+
'aliases' => array(),
|
28 |
+
'reference' => '10dcfce151b967d20fde1b34ae6640712c3891bc',
|
29 |
+
'dev_requirement' => false,
|
30 |
+
),
|
31 |
+
'facebook/facebook-instant-articles-sdk-extensions-in-php' => array(
|
32 |
+
'pretty_version' => 'dev-php8',
|
33 |
+
'version' => 'dev-php8',
|
34 |
+
'type' => 'library',
|
35 |
+
'install_path' => __DIR__ . '/../facebook/facebook-instant-articles-sdk-extensions-in-php',
|
36 |
+
'aliases' => array(),
|
37 |
+
'reference' => '2e9c55f6f84479cefd147656e0d2bada95e0d99a',
|
38 |
+
'dev_requirement' => false,
|
39 |
+
),
|
40 |
+
'facebook/facebook-instant-articles-sdk-php' => array(
|
41 |
+
'pretty_version' => 'dev-php8',
|
42 |
+
'version' => 'dev-php8',
|
43 |
+
'type' => 'library',
|
44 |
+
'install_path' => __DIR__ . '/../facebook/facebook-instant-articles-sdk-php',
|
45 |
+
'aliases' => array(),
|
46 |
+
'reference' => 'ec12f3cc823249599778ce2be1a88068b2a7e3f6',
|
47 |
+
'dev_requirement' => false,
|
48 |
+
),
|
49 |
+
'facebook/graph-sdk' => array(
|
50 |
+
'pretty_version' => 'dev-php8',
|
51 |
+
'version' => 'dev-php8',
|
52 |
+
'type' => 'library',
|
53 |
+
'install_path' => __DIR__ . '/../facebook/graph-sdk',
|
54 |
+
'aliases' => array(),
|
55 |
+
'reference' => '2a225c96b5f8fda6f44aabadd36cbb219d0f736d',
|
56 |
+
'dev_requirement' => false,
|
57 |
+
),
|
58 |
+
'symfony/css-selector' => array(
|
59 |
+
'pretty_version' => 'v2.8.52',
|
60 |
+
'version' => '2.8.52.0',
|
61 |
+
'type' => 'library',
|
62 |
+
'install_path' => __DIR__ . '/../symfony/css-selector',
|
63 |
+
'aliases' => array(),
|
64 |
+
'reference' => '7b1692e418d7ccac24c373528453bc90e42797de',
|
65 |
+
'dev_requirement' => false,
|
66 |
+
),
|
67 |
+
),
|
68 |
+
);
|
vendor/composer/platform_check.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// platform_check.php @generated by Composer
|
4 |
+
|
5 |
+
$issues = array();
|
6 |
+
|
7 |
+
if (!(PHP_VERSION_ID >= 70100)) {
|
8 |
+
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.0". You are running ' . PHP_VERSION . '.';
|
9 |
+
}
|
10 |
+
|
11 |
+
if ($issues) {
|
12 |
+
if (!headers_sent()) {
|
13 |
+
header('HTTP/1.1 500 Internal Server Error');
|
14 |
+
}
|
15 |
+
if (!ini_get('display_errors')) {
|
16 |
+
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
17 |
+
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
18 |
+
} elseif (!headers_sent()) {
|
19 |
+
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
trigger_error(
|
23 |
+
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
24 |
+
E_USER_ERROR
|
25 |
+
);
|
26 |
+
}
|
vendor/doctrine/instantiator/.doctrine-project.json
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"active": true,
|
3 |
+
"name": "Instantiator",
|
4 |
+
"slug": "instantiator",
|
5 |
+
"docsSlug": "doctrine-instantiator",
|
6 |
+
"codePath": "/src",
|
7 |
+
"versions": [
|
8 |
+
{
|
9 |
+
"name": "1.5",
|
10 |
+
"branchName": "1.5.x",
|
11 |
+
"slug": "latest",
|
12 |
+
"upcoming": true
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"name": "1.4",
|
16 |
+
"branchName": "1.4.x",
|
17 |
+
"slug": "1.4",
|
18 |
+
"aliases": [
|
19 |
+
"current",
|
20 |
+
"stable"
|
21 |
+
],
|
22 |
+
"maintained": true,
|
23 |
+
"current": true
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"name": "1.3",
|
27 |
+
"branchName": "1.3.x",
|
28 |
+
"slug": "1.3",
|
29 |
+
"maintained": false
|
30 |
+
},
|
31 |
+
{
|
32 |
+
"name": "1.2",
|
33 |
+
"branchName": "1.2.x",
|
34 |
+
"slug": "1.2"
|
35 |
+
},
|
36 |
+
{
|
37 |
+
"name": "1.1",
|
38 |
+
"branchName": "1.1.x",
|
39 |
+
"slug": "1.1"
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"name": "1.0",
|
43 |
+
"branchName": "1.0.x",
|
44 |
+
"slug": "1.0"
|
45 |
+
}
|
46 |
+
]
|
47 |
+
}
|
vendor/doctrine/instantiator/.gitignore
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
phpunit.xml
|
2 |
-
composer.lock
|
3 |
-
build
|
4 |
-
vendor
|
5 |
-
coverage.clover
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/.scrutinizer.yml
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
before_commands:
|
2 |
-
- "composer install --prefer-source"
|
3 |
-
|
4 |
-
tools:
|
5 |
-
external_code_coverage:
|
6 |
-
timeout: 600
|
7 |
-
php_code_coverage:
|
8 |
-
enabled: true
|
9 |
-
test_command: ./vendor/bin/phpunit
|
10 |
-
php_code_sniffer:
|
11 |
-
enabled: true
|
12 |
-
config:
|
13 |
-
standard: PSR2
|
14 |
-
filter:
|
15 |
-
paths: ["src/*", "tests/*"]
|
16 |
-
php_cpd:
|
17 |
-
enabled: true
|
18 |
-
excluded_dirs: ["build/*", "tests", "vendor"]
|
19 |
-
php_cs_fixer:
|
20 |
-
enabled: true
|
21 |
-
config:
|
22 |
-
level: all
|
23 |
-
filter:
|
24 |
-
paths: ["src/*", "tests/*"]
|
25 |
-
php_loc:
|
26 |
-
enabled: true
|
27 |
-
excluded_dirs: ["build", "tests", "vendor"]
|
28 |
-
php_mess_detector:
|
29 |
-
enabled: true
|
30 |
-
config:
|
31 |
-
ruleset: phpmd.xml.dist
|
32 |
-
design_rules: { eval_expression: false }
|
33 |
-
filter:
|
34 |
-
paths: ["src/*"]
|
35 |
-
php_pdepend:
|
36 |
-
enabled: true
|
37 |
-
excluded_dirs: ["build", "tests", "vendor"]
|
38 |
-
php_analyzer:
|
39 |
-
enabled: true
|
40 |
-
filter:
|
41 |
-
paths: ["src/*", "tests/*"]
|
42 |
-
php_hhvm:
|
43 |
-
enabled: true
|
44 |
-
filter:
|
45 |
-
paths: ["src/*", "tests/*"]
|
46 |
-
sensiolabs_security_checker: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/.travis.install.sh
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
#!/bin/sh
|
2 |
-
set -x
|
3 |
-
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] || [ "$TRAVIS_PHP_VERSION" = 'hhvm-nightly' ] ; then
|
4 |
-
curl -sS https://getcomposer.org/installer > composer-installer.php
|
5 |
-
hhvm composer-installer.php
|
6 |
-
hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 composer.phar update --prefer-source
|
7 |
-
elif [ "$TRAVIS_PHP_VERSION" = '5.3.3' ] ; then
|
8 |
-
composer self-update
|
9 |
-
composer update --prefer-source --no-dev
|
10 |
-
composer dump-autoload
|
11 |
-
else
|
12 |
-
composer self-update
|
13 |
-
composer update --prefer-source
|
14 |
-
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/.travis.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
language: php
|
2 |
-
|
3 |
-
php:
|
4 |
-
- 5.3.3
|
5 |
-
- 5.3
|
6 |
-
- 5.4
|
7 |
-
- 5.5
|
8 |
-
- 5.6
|
9 |
-
- hhvm
|
10 |
-
|
11 |
-
before_script:
|
12 |
-
- ./.travis.install.sh
|
13 |
-
- if [ $TRAVIS_PHP_VERSION = '5.6' ]; then PHPUNIT_FLAGS="--coverage-clover coverage.clover"; else PHPUNIT_FLAGS=""; fi
|
14 |
-
|
15 |
-
script:
|
16 |
-
- if [ $TRAVIS_PHP_VERSION = '5.3.3' ]; then phpunit; fi
|
17 |
-
- if [ $TRAVIS_PHP_VERSION != '5.3.3' ]; then ./vendor/bin/phpunit $PHPUNIT_FLAGS; fi
|
18 |
-
- if [ $TRAVIS_PHP_VERSION != '5.3.3' ]; then ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/; fi
|
19 |
-
- if [[ $TRAVIS_PHP_VERSION != '5.3.3' && $TRAVIS_PHP_VERSION != '5.4.29' && $TRAVIS_PHP_VERSION != '5.5.13' ]]; then php -n ./vendor/bin/athletic -p ./tests/DoctrineTest/InstantiatorPerformance/ -f GroupedFormatter; fi
|
20 |
-
|
21 |
-
after_script:
|
22 |
-
- if [ $TRAVIS_PHP_VERSION = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/CONTRIBUTING.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
# Contributing
|
2 |
|
3 |
-
*
|
4 |
* The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php)
|
5 |
* Any contribution must provide tests for additional introduced conditions
|
6 |
* Any un-confirmed issue needs a failing test case before being accepted
|
1 |
# Contributing
|
2 |
|
3 |
+
* Follow the [Doctrine Coding Standard](https://github.com/doctrine/coding-standard)
|
4 |
* The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php)
|
5 |
* Any contribution must provide tests for additional introduced conditions
|
6 |
* Any un-confirmed issue needs a failing test case before being accepted
|
vendor/doctrine/instantiator/README.md
CHANGED
@@ -3,10 +3,8 @@
|
|
3 |
This library provides a way of avoiding usage of constructors when instantiating PHP classes.
|
4 |
|
5 |
[![Build Status](https://travis-ci.org/doctrine/instantiator.svg?branch=master)](https://travis-ci.org/doctrine/instantiator)
|
6 |
-
[![Code Coverage](https://
|
7 |
-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master)
|
8 |
[![Dependency Status](https://www.versioneye.com/package/php--doctrine--instantiator/badge.svg)](https://www.versioneye.com/package/php--doctrine--instantiator)
|
9 |
-
[![HHVM Status](http://hhvm.h4cc.de/badge/doctrine/instantiator.png)](http://hhvm.h4cc.de/package/doctrine/instantiator)
|
10 |
|
11 |
[![Latest Stable Version](https://poser.pugx.org/doctrine/instantiator/v/stable.png)](https://packagist.org/packages/doctrine/instantiator)
|
12 |
[![Latest Unstable Version](https://poser.pugx.org/doctrine/instantiator/v/unstable.png)](https://packagist.org/packages/doctrine/instantiator)
|
@@ -27,7 +25,7 @@ itself:
|
|
27 |
```php
|
28 |
$instantiator = new \Doctrine\Instantiator\Instantiator();
|
29 |
|
30 |
-
$instance = $instantiator->instantiate(
|
31 |
```
|
32 |
|
33 |
## Contributing
|
3 |
This library provides a way of avoiding usage of constructors when instantiating PHP classes.
|
4 |
|
5 |
[![Build Status](https://travis-ci.org/doctrine/instantiator.svg?branch=master)](https://travis-ci.org/doctrine/instantiator)
|
6 |
+
[![Code Coverage](https://codecov.io/gh/doctrine/instantiator/branch/master/graph/badge.svg)](https://codecov.io/gh/doctrine/instantiator/branch/master)
|
|
|
7 |
[![Dependency Status](https://www.versioneye.com/package/php--doctrine--instantiator/badge.svg)](https://www.versioneye.com/package/php--doctrine--instantiator)
|
|
|
8 |
|
9 |
[![Latest Stable Version](https://poser.pugx.org/doctrine/instantiator/v/stable.png)](https://packagist.org/packages/doctrine/instantiator)
|
10 |
[![Latest Unstable Version](https://poser.pugx.org/doctrine/instantiator/v/unstable.png)](https://packagist.org/packages/doctrine/instantiator)
|
25 |
```php
|
26 |
$instantiator = new \Doctrine\Instantiator\Instantiator();
|
27 |
|
28 |
+
$instance = $instantiator->instantiate(\My\ClassName\Here::class);
|
29 |
```
|
30 |
|
31 |
## Contributing
|
vendor/doctrine/instantiator/composer.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
4 |
"type": "library",
|
5 |
"license": "MIT",
|
6 |
-
"homepage": "https://
|
7 |
"keywords": [
|
8 |
"instantiate",
|
9 |
"constructor"
|
@@ -12,18 +12,21 @@
|
|
12 |
{
|
13 |
"name": "Marco Pivetta",
|
14 |
"email": "ocramius@gmail.com",
|
15 |
-
"homepage": "
|
16 |
}
|
17 |
],
|
18 |
"require": {
|
19 |
-
"php": "
|
20 |
},
|
21 |
"require-dev": {
|
22 |
"ext-phar": "*",
|
23 |
"ext-pdo": "*",
|
24 |
-
"
|
25 |
-
"
|
26 |
-
"
|
|
|
|
|
|
|
27 |
},
|
28 |
"autoload": {
|
29 |
"psr-4": {
|
@@ -37,9 +40,9 @@
|
|
37 |
"DoctrineTest\\InstantiatorTestAsset\\": "tests"
|
38 |
}
|
39 |
},
|
40 |
-
"
|
41 |
-
"
|
42 |
-
"
|
43 |
}
|
44 |
}
|
45 |
}
|
3 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
4 |
"type": "library",
|
5 |
"license": "MIT",
|
6 |
+
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
|
7 |
"keywords": [
|
8 |
"instantiate",
|
9 |
"constructor"
|
12 |
{
|
13 |
"name": "Marco Pivetta",
|
14 |
"email": "ocramius@gmail.com",
|
15 |
+
"homepage": "https://ocramius.github.io/"
|
16 |
}
|
17 |
],
|
18 |
"require": {
|
19 |
+
"php": "^7.1 || ^8.0"
|
20 |
},
|
21 |
"require-dev": {
|
22 |
"ext-phar": "*",
|
23 |
"ext-pdo": "*",
|
24 |
+
"doctrine/coding-standard": "^9",
|
25 |
+
"phpbench/phpbench": "^0.16 || ^1",
|
26 |
+
"phpstan/phpstan": "^1.4",
|
27 |
+
"phpstan/phpstan-phpunit": "^1",
|
28 |
+
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
29 |
+
"vimeo/psalm": "^4.22"
|
30 |
},
|
31 |
"autoload": {
|
32 |
"psr-4": {
|
40 |
"DoctrineTest\\InstantiatorTestAsset\\": "tests"
|
41 |
}
|
42 |
},
|
43 |
+
"config": {
|
44 |
+
"allow-plugins": {
|
45 |
+
"dealerdirect/phpcodesniffer-composer-installer": true
|
46 |
}
|
47 |
}
|
48 |
}
|
vendor/doctrine/instantiator/docs/en/index.rst
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Introduction
|
2 |
+
============
|
3 |
+
|
4 |
+
This library provides a way of avoiding usage of constructors when instantiating PHP classes.
|
5 |
+
|
6 |
+
Installation
|
7 |
+
============
|
8 |
+
|
9 |
+
The suggested installation method is via `composer`_:
|
10 |
+
|
11 |
+
.. code-block:: console
|
12 |
+
|
13 |
+
$ composer require doctrine/instantiator
|
14 |
+
|
15 |
+
Usage
|
16 |
+
=====
|
17 |
+
|
18 |
+
The instantiator is able to create new instances of any class without
|
19 |
+
using the constructor or any API of the class itself:
|
20 |
+
|
21 |
+
.. code-block:: php
|
22 |
+
|
23 |
+
<?php
|
24 |
+
|
25 |
+
use Doctrine\Instantiator\Instantiator;
|
26 |
+
use App\Entities\User;
|
27 |
+
|
28 |
+
$instantiator = new Instantiator();
|
29 |
+
|
30 |
+
$user = $instantiator->instantiate(User::class);
|
31 |
+
|
32 |
+
Contributing
|
33 |
+
============
|
34 |
+
|
35 |
+
- Follow the `Doctrine Coding Standard`_
|
36 |
+
- The project will follow strict `object calisthenics`_
|
37 |
+
- Any contribution must provide tests for additional introduced
|
38 |
+
conditions
|
39 |
+
- Any un-confirmed issue needs a failing test case before being
|
40 |
+
accepted
|
41 |
+
- Pull requests must be sent from a new hotfix/feature branch, not from
|
42 |
+
``master``.
|
43 |
+
|
44 |
+
Testing
|
45 |
+
=======
|
46 |
+
|
47 |
+
The PHPUnit version to be used is the one installed as a dev- dependency
|
48 |
+
via composer:
|
49 |
+
|
50 |
+
.. code-block:: console
|
51 |
+
|
52 |
+
$ ./vendor/bin/phpunit
|
53 |
+
|
54 |
+
Accepted coverage for new contributions is 80%. Any contribution not
|
55 |
+
satisfying this requirement won’t be merged.
|
56 |
+
|
57 |
+
Credits
|
58 |
+
=======
|
59 |
+
|
60 |
+
This library was migrated from `ocramius/instantiator`_, which has been
|
61 |
+
donated to the doctrine organization, and which is now deprecated in
|
62 |
+
favour of this package.
|
63 |
+
|
64 |
+
.. _composer: https://getcomposer.org/
|
65 |
+
.. _CONTRIBUTING.md: CONTRIBUTING.md
|
66 |
+
.. _ocramius/instantiator: https://github.com/Ocramius/Instantiator
|
67 |
+
.. _Doctrine Coding Standard: https://github.com/doctrine/coding-standard
|
68 |
+
.. _object calisthenics: http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php
|
vendor/doctrine/instantiator/docs/en/sidebar.rst
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
.. toctree::
|
2 |
+
:depth: 3
|
3 |
+
|
4 |
+
index
|
vendor/doctrine/instantiator/phpmd.xml.dist
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2 |
-
<ruleset
|
3 |
-
name="Instantiator rules"
|
4 |
-
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
5 |
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
6 |
-
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
7 |
-
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
|
8 |
-
>
|
9 |
-
<rule ref="rulesets/cleancode.xml">
|
10 |
-
<!-- static access is used for caching purposes -->
|
11 |
-
<exclude name="StaticAccess"/>
|
12 |
-
</rule>
|
13 |
-
<rule ref="rulesets/codesize.xml"/>
|
14 |
-
<rule ref="rulesets/controversial.xml"/>
|
15 |
-
<rule ref="rulesets/design.xml"/>
|
16 |
-
<rule ref="rulesets/naming.xml"/>
|
17 |
-
<rule ref="rulesets/unusedcode.xml"/>
|
18 |
-
<rule
|
19 |
-
name="NPathComplexity"
|
20 |
-
message="The {0} {1}() has an NPath complexity of {2}. The configured NPath complexity threshold is {3}."
|
21 |
-
class="PHP_PMD_Rule_Design_NpathComplexity"
|
22 |
-
>
|
23 |
-
<properties>
|
24 |
-
<property name="minimum" description="The npath reporting threshold" value="10"/>
|
25 |
-
</properties>
|
26 |
-
</rule>
|
27 |
-
</ruleset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/phpunit.xml.dist
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<phpunit
|
3 |
-
bootstrap="./vendor/autoload.php"
|
4 |
-
colors="true"
|
5 |
-
convertErrorsToExceptions="true"
|
6 |
-
convertNoticesToExceptions="true"
|
7 |
-
convertWarningsToExceptions="true"
|
8 |
-
verbose="true"
|
9 |
-
stopOnFailure="false"
|
10 |
-
processIsolation="false"
|
11 |
-
backupGlobals="false"
|
12 |
-
syntaxCheck="true"
|
13 |
-
>
|
14 |
-
<testsuite name="Doctrine\Instantiator tests">
|
15 |
-
<directory>./tests/DoctrineTest/InstantiatorTest</directory>
|
16 |
-
</testsuite>
|
17 |
-
<filter>
|
18 |
-
<whitelist addUncoveredFilesFromWhitelist="true">
|
19 |
-
<directory suffix=".php">./src</directory>
|
20 |
-
</whitelist>
|
21 |
-
</filter>
|
22 |
-
</phpunit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/psalm.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<psalm
|
3 |
+
errorLevel="7"
|
4 |
+
phpVersion="8.1"
|
5 |
+
resolveFromConfigFile="true"
|
6 |
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
7 |
+
xmlns="https://getpsalm.org/schema/config"
|
8 |
+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
9 |
+
>
|
10 |
+
<projectFiles>
|
11 |
+
<directory name="src" />
|
12 |
+
<ignoreFiles>
|
13 |
+
<directory name="vendor" />
|
14 |
+
</ignoreFiles>
|
15 |
+
</projectFiles>
|
16 |
+
</psalm>
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php
CHANGED
@@ -1,29 +1,12 @@
|
|
1 |
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
|
20 |
namespace Doctrine\Instantiator\Exception;
|
21 |
|
|
|
|
|
22 |
/**
|
23 |
* Base exception marker interface for the instantiator component
|
24 |
-
*
|
25 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
26 |
*/
|
27 |
-
interface ExceptionInterface
|
28 |
{
|
29 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace Doctrine\Instantiator\Exception;
|
4 |
|
5 |
+
use Throwable;
|
6 |
+
|
7 |
/**
|
8 |
* Base exception marker interface for the instantiator component
|
|
|
|
|
9 |
*/
|
10 |
+
interface ExceptionInterface extends Throwable
|
11 |
{
|
12 |
}
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php
CHANGED
@@ -1,62 +1,50 @@
|
|
1 |
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
|
20 |
namespace Doctrine\Instantiator\Exception;
|
21 |
|
22 |
use InvalidArgumentException as BaseInvalidArgumentException;
|
23 |
use ReflectionClass;
|
24 |
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Exception for invalid arguments provided to the instantiator
|
27 |
-
*
|
28 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
*/
|
30 |
class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface
|
31 |
{
|
32 |
-
|
33 |
-
* @param string $className
|
34 |
-
*
|
35 |
-
* @return self
|
36 |
-
*/
|
37 |
-
public static function fromNonExistingClass($className)
|
38 |
{
|
39 |
if (interface_exists($className)) {
|
40 |
-
return new self(sprintf('The provided type "%s" is an interface, and
|
41 |
}
|
42 |
|
43 |
-
if (
|
44 |
-
return new self(sprintf('The provided type "%s" is a trait, and
|
45 |
}
|
46 |
|
47 |
return new self(sprintf('The provided class "%s" does not exist', $className));
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
-
* @param ReflectionClass $reflectionClass
|
52 |
*
|
53 |
-
* @
|
54 |
*/
|
55 |
-
public static function fromAbstractClass(ReflectionClass $reflectionClass)
|
56 |
{
|
57 |
return new self(sprintf(
|
58 |
-
'The provided class "%s" is abstract, and
|
59 |
$reflectionClass->getName()
|
60 |
));
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace Doctrine\Instantiator\Exception;
|
4 |
|
5 |
use InvalidArgumentException as BaseInvalidArgumentException;
|
6 |
use ReflectionClass;
|
7 |
|
8 |
+
use function interface_exists;
|
9 |
+
use function sprintf;
|
10 |
+
use function trait_exists;
|
11 |
+
|
12 |
/**
|
13 |
* Exception for invalid arguments provided to the instantiator
|
|
|
|
|
14 |
*/
|
15 |
class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface
|
16 |
{
|
17 |
+
public static function fromNonExistingClass(string $className): self
|
|
|
|
|
|
|
|
|
|
|
18 |
{
|
19 |
if (interface_exists($className)) {
|
20 |
+
return new self(sprintf('The provided type "%s" is an interface, and cannot be instantiated', $className));
|
21 |
}
|
22 |
|
23 |
+
if (trait_exists($className)) {
|
24 |
+
return new self(sprintf('The provided type "%s" is a trait, and cannot be instantiated', $className));
|
25 |
}
|
26 |
|
27 |
return new self(sprintf('The provided class "%s" does not exist', $className));
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
+
* @phpstan-param ReflectionClass<T> $reflectionClass
|
32 |
*
|
33 |
+
* @template T of object
|
34 |
*/
|
35 |
+
public static function fromAbstractClass(ReflectionClass $reflectionClass): self
|
36 |
{
|
37 |
return new self(sprintf(
|
38 |
+
'The provided class "%s" is abstract, and cannot be instantiated',
|
39 |
$reflectionClass->getName()
|
40 |
));
|
41 |
}
|
42 |
+
|
43 |
+
public static function fromEnum(string $className): self
|
44 |
+
{
|
45 |
+
return new self(sprintf(
|
46 |
+
'The provided class "%s" is an enum, and cannot be instantiated',
|
47 |
+
$className
|
48 |
+
));
|
49 |
+
}
|
50 |
}
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php
CHANGED
@@ -1,21 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
|
20 |
namespace Doctrine\Instantiator\Exception;
|
21 |
|
@@ -23,21 +6,22 @@ use Exception;
|
|
23 |
use ReflectionClass;
|
24 |
use UnexpectedValueException as BaseUnexpectedValueException;
|
25 |
|
|
|
|
|
26 |
/**
|
27 |
* Exception for given parameters causing invalid/unexpected state on instantiation
|
28 |
-
*
|
29 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
30 |
*/
|
31 |
class UnexpectedValueException extends BaseUnexpectedValueException implements ExceptionInterface
|
32 |
{
|
33 |
/**
|
34 |
-
* @param ReflectionClass $reflectionClass
|
35 |
-
* @param Exception $exception
|
36 |
*
|
37 |
-
* @
|
38 |
*/
|
39 |
-
public static function fromSerializationTriggeredException(
|
40 |
-
|
|
|
|
|
41 |
return new self(
|
42 |
sprintf(
|
43 |
'An exception was raised while trying to instantiate an instance of "%s" via un-serialization',
|
@@ -49,21 +33,17 @@ class UnexpectedValueException extends BaseUnexpectedValueException implements E
|
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
-
* @param ReflectionClass $reflectionClass
|
53 |
-
* @param string $errorString
|
54 |
-
* @param int $errorCode
|
55 |
-
* @param string $errorFile
|
56 |
-
* @param int $errorLine
|
57 |
*
|
58 |
-
* @
|
59 |
*/
|
60 |
public static function fromUncleanUnSerialization(
|
61 |
ReflectionClass $reflectionClass,
|
62 |
-
$errorString,
|
63 |
-
$errorCode,
|
64 |
-
$errorFile,
|
65 |
-
$errorLine
|
66 |
-
) {
|
67 |
return new self(
|
68 |
sprintf(
|
69 |
'Could not produce an instance of "%s" via un-serialization, since an error was triggered '
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace Doctrine\Instantiator\Exception;
|
4 |
|
6 |
use ReflectionClass;
|
7 |
use UnexpectedValueException as BaseUnexpectedValueException;
|
8 |
|
9 |
+
use function sprintf;
|
10 |
+
|
11 |
/**
|
12 |
* Exception for given parameters causing invalid/unexpected state on instantiation
|
|
|
|
|
13 |
*/
|
14 |
class UnexpectedValueException extends BaseUnexpectedValueException implements ExceptionInterface
|
15 |
{
|
16 |
/**
|
17 |
+
* @phpstan-param ReflectionClass<T> $reflectionClass
|
|
|
18 |
*
|
19 |
+
* @template T of object
|
20 |
*/
|
21 |
+
public static function fromSerializationTriggeredException(
|
22 |
+
ReflectionClass $reflectionClass,
|
23 |
+
Exception $exception
|
24 |
+
): self {
|
25 |
return new self(
|
26 |
sprintf(
|
27 |
'An exception was raised while trying to instantiate an instance of "%s" via un-serialization',
|
33 |
}
|
34 |
|
35 |
/**
|
36 |
+
* @phpstan-param ReflectionClass<T> $reflectionClass
|
|
|
|
|
|
|
|
|
37 |
*
|
38 |
+
* @template T of object
|
39 |
*/
|
40 |
public static function fromUncleanUnSerialization(
|
41 |
ReflectionClass $reflectionClass,
|
42 |
+
string $errorString,
|
43 |
+
int $errorCode,
|
44 |
+
string $errorFile,
|
45 |
+
int $errorLine
|
46 |
+
): self {
|
47 |
return new self(
|
48 |
sprintf(
|
49 |
'Could not produce an instance of "%s" via un-serialization, since an error was triggered '
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php
CHANGED
@@ -1,35 +1,27 @@
|
|
1 |
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
|
20 |
namespace Doctrine\Instantiator;
|
21 |
|
22 |
-
use
|
|
|
23 |
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
24 |
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
25 |
use Exception;
|
26 |
use ReflectionClass;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
/**
|
29 |
-
* {@inheritDoc}
|
30 |
-
*
|
31 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
32 |
-
*/
|
33 |
final class Instantiator implements InstantiatorInterface
|
34 |
{
|
35 |
/**
|
@@ -37,26 +29,43 @@ final class Instantiator implements InstantiatorInterface
|
|
37 |
* the method {@see \Serializable::unserialize()} when dealing with classes implementing
|
38 |
* the {@see \Serializable} interface.
|
39 |
*/
|
40 |
-
const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
|
41 |
-
const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O';
|
42 |
|
43 |
/**
|
44 |
-
*
|
|
|
|
|
45 |
*/
|
46 |
-
private static $cachedInstantiators =
|
47 |
|
48 |
/**
|
49 |
-
*
|
|
|
|
|
50 |
*/
|
51 |
-
private static $cachedCloneables =
|
52 |
|
53 |
/**
|
54 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
*/
|
56 |
public function instantiate($className)
|
57 |
{
|
58 |
if (isset(self::$cachedCloneables[$className])) {
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
if (isset(self::$cachedInstantiators[$className])) {
|
@@ -71,11 +80,14 @@ final class Instantiator implements InstantiatorInterface
|
|
71 |
/**
|
72 |
* Builds the requested object and caches it in static properties for performance
|
73 |
*
|
74 |
-
* @param string $className
|
75 |
*
|
76 |
* @return object
|
|
|
|
|
|
|
77 |
*/
|
78 |
-
private function buildAndCacheFromFactory($className)
|
79 |
{
|
80 |
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
|
81 |
$instance = $factory();
|
@@ -88,50 +100,61 @@ final class Instantiator implements InstantiatorInterface
|
|
88 |
}
|
89 |
|
90 |
/**
|
91 |
-
* Builds a
|
92 |
* invoking its constructor.
|
93 |
*
|
94 |
-
* @param string $className
|
95 |
*
|
96 |
-
* @return
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
*/
|
98 |
-
private function buildFactory($className)
|
99 |
{
|
100 |
$reflectionClass = $this->getReflectionClass($className);
|
101 |
|
102 |
if ($this->isInstantiableViaReflection($reflectionClass)) {
|
103 |
-
return
|
104 |
-
return $reflectionClass->newInstanceWithoutConstructor();
|
105 |
-
};
|
106 |
}
|
107 |
|
108 |
$serializedString = sprintf(
|
109 |
'%s:%d:"%s":0:{}',
|
110 |
-
|
111 |
strlen($className),
|
112 |
$className
|
113 |
);
|
114 |
|
115 |
$this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString);
|
116 |
|
117 |
-
return function () use ($serializedString) {
|
118 |
return unserialize($serializedString);
|
119 |
};
|
120 |
}
|
121 |
|
122 |
/**
|
123 |
-
* @param string $className
|
124 |
*
|
125 |
-
* @return ReflectionClass
|
126 |
*
|
127 |
* @throws InvalidArgumentException
|
|
|
|
|
|
|
128 |
*/
|
129 |
-
private function getReflectionClass($className)
|
130 |
{
|
131 |
if (! class_exists($className)) {
|
132 |
throw InvalidArgumentException::fromNonExistingClass($className);
|
133 |
}
|
134 |
|
|
|
|
|
|
|
|
|
135 |
$reflection = new ReflectionClass($className);
|
136 |
|
137 |
if ($reflection->isAbstract()) {
|
@@ -142,16 +165,15 @@ final class Instantiator implements InstantiatorInterface
|
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
-
* @param ReflectionClass $reflectionClass
|
146 |
-
* @param string $serializedString
|
147 |
*
|
148 |
* @throws UnexpectedValueException
|
149 |
*
|
150 |
-
* @
|
151 |
*/
|
152 |
-
private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, $serializedString)
|
153 |
{
|
154 |
-
set_error_handler(function ($code, $message, $file, $line) use ($reflectionClass,
|
155 |
$error = UnexpectedValueException::fromUncleanUnSerialization(
|
156 |
$reflectionClass,
|
157 |
$message,
|
@@ -159,11 +181,15 @@ final class Instantiator implements InstantiatorInterface
|
|
159 |
$file,
|
160 |
$line
|
161 |
);
|
162 |
-
});
|
163 |
|
164 |
-
|
|
|
165 |
|
166 |
-
|
|
|
|
|
|
|
|
|
167 |
|
168 |
if ($error) {
|
169 |
throw $error;
|
@@ -171,103 +197,64 @@ final class Instantiator implements InstantiatorInterface
|
|
171 |
}
|
172 |
|
173 |
/**
|
174 |
-
* @param ReflectionClass $reflectionClass
|
175 |
-
* @param string $serializedString
|
176 |
*
|
177 |
* @throws UnexpectedValueException
|
178 |
*
|
179 |
-
* @
|
180 |
*/
|
181 |
-
private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString)
|
182 |
{
|
183 |
try {
|
184 |
unserialize($serializedString);
|
185 |
} catch (Exception $exception) {
|
186 |
-
restore_error_handler();
|
187 |
-
|
188 |
throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception);
|
189 |
}
|
190 |
}
|
191 |
|
192 |
/**
|
193 |
-
* @param ReflectionClass $reflectionClass
|
194 |
*
|
195 |
-
* @
|
196 |
*/
|
197 |
-
private function isInstantiableViaReflection(ReflectionClass $reflectionClass)
|
198 |
{
|
199 |
-
|
200 |
-
return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal());
|
201 |
-
}
|
202 |
-
|
203 |
-
return \PHP_VERSION_ID >= 50400 && ! $this->hasInternalAncestors($reflectionClass);
|
204 |
}
|
205 |
|
206 |
/**
|
207 |
* Verifies whether the given class is to be considered internal
|
208 |
*
|
209 |
-
* @param ReflectionClass $reflectionClass
|
210 |
*
|
211 |
-
* @
|
212 |
*/
|
213 |
-
private function hasInternalAncestors(ReflectionClass $reflectionClass)
|
214 |
{
|
215 |
do {
|
216 |
if ($reflectionClass->isInternal()) {
|
217 |
return true;
|
218 |
}
|
219 |
-
} while ($reflectionClass = $reflectionClass->getParentClass());
|
220 |
|
221 |
-
|
222 |
-
|
223 |
|
224 |
-
|
225 |
-
* Verifies if the given PHP version implements the `Serializable` interface serialization
|
226 |
-
* with an incompatible serialization format. If that's the case, use serialization marker
|
227 |
-
* "C" instead of "O".
|
228 |
-
*
|
229 |
-
* @link http://news.php.net/php.internals/74654
|
230 |
-
*
|
231 |
-
* @param ReflectionClass $reflectionClass
|
232 |
-
*
|
233 |
-
* @return string the serialization format marker, either self::SERIALIZATION_FORMAT_USE_UNSERIALIZER
|
234 |
-
* or self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER
|
235 |
-
*/
|
236 |
-
private function getSerializationFormat(ReflectionClass $reflectionClass)
|
237 |
-
{
|
238 |
-
if ($this->isPhpVersionWithBrokenSerializationFormat()
|
239 |
-
&& $reflectionClass->implementsInterface('Serializable')
|
240 |
-
) {
|
241 |
-
return self::SERIALIZATION_FORMAT_USE_UNSERIALIZER;
|
242 |
-
}
|
243 |
-
|
244 |
-
return self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER;
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Checks whether the current PHP runtime uses an incompatible serialization format
|
249 |
-
*
|
250 |
-
* @return bool
|
251 |
-
*/
|
252 |
-
private function isPhpVersionWithBrokenSerializationFormat()
|
253 |
-
{
|
254 |
-
return PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513;
|
255 |
}
|
256 |
|
257 |
/**
|
258 |
* Checks if a class is cloneable
|
259 |
*
|
260 |
-
*
|
261 |
*
|
262 |
-
* @
|
|
|
|
|
263 |
*/
|
264 |
-
private function isSafeToClone(ReflectionClass $
|
265 |
{
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
// not cloneable if it implements `__clone`, as we want to avoid calling it
|
271 |
-
return ! $reflection->hasMethod('__clone');
|
272 |
}
|
273 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace Doctrine\Instantiator;
|
4 |
|
5 |
+
use ArrayIterator;
|
6 |
+
use Doctrine\Instantiator\Exception\ExceptionInterface;
|
7 |
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
8 |
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
9 |
use Exception;
|
10 |
use ReflectionClass;
|
11 |
+
use ReflectionException;
|
12 |
+
use Serializable;
|
13 |
+
|
14 |
+
use function class_exists;
|
15 |
+
use function enum_exists;
|
16 |
+
use function is_subclass_of;
|
17 |
+
use function restore_error_handler;
|
18 |
+
use function set_error_handler;
|
19 |
+
use function sprintf;
|
20 |
+
use function strlen;
|
21 |
+
use function unserialize;
|
22 |
+
|
23 |
+
use const PHP_VERSION_ID;
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
final class Instantiator implements InstantiatorInterface
|
26 |
{
|
27 |
/**
|
29 |
* the method {@see \Serializable::unserialize()} when dealing with classes implementing
|
30 |
* the {@see \Serializable} interface.
|
31 |
*/
|
32 |
+
public const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
|
33 |
+
public const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O';
|
34 |
|
35 |
/**
|
36 |
+
* Used to instantiate specific classes, indexed by class name.
|
37 |
+
*
|
38 |
+
* @var callable[]
|
39 |
*/
|
40 |
+
private static $cachedInstantiators = [];
|
41 |
|
42 |
/**
|
43 |
+
* Array of objects that can directly be cloned, indexed by class name.
|
44 |
+
*
|
45 |
+
* @var object[]
|
46 |
*/
|
47 |
+
private static $cachedCloneables = [];
|
48 |
|
49 |
/**
|
50 |
+
* @param string $className
|
51 |
+
* @phpstan-param class-string<T> $className
|
52 |
+
*
|
53 |
+
* @return object
|
54 |
+
* @phpstan-return T
|
55 |
+
*
|
56 |
+
* @throws ExceptionInterface
|
57 |
+
*
|
58 |
+
* @template T of object
|
59 |
*/
|
60 |
public function instantiate($className)
|
61 |
{
|
62 |
if (isset(self::$cachedCloneables[$className])) {
|
63 |
+
/**
|
64 |
+
* @phpstan-var T
|
65 |
+
*/
|
66 |
+
$cachedCloneable = self::$cachedCloneables[$className];
|
67 |
+
|
68 |
+
return clone $cachedCloneable;
|
69 |
}
|
70 |
|
71 |
if (isset(self::$cachedInstantiators[$className])) {
|
80 |
/**
|
81 |
* Builds the requested object and caches it in static properties for performance
|
82 |
*
|
83 |
+
* @phpstan-param class-string<T> $className
|
84 |
*
|
85 |
* @return object
|
86 |
+
* @phpstan-return T
|
87 |
+
*
|
88 |
+
* @template T of object
|
89 |
*/
|
90 |
+
private function buildAndCacheFromFactory(string $className)
|
91 |
{
|
92 |
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
|
93 |
$instance = $factory();
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
+
* Builds a callable capable of instantiating the given $className without
|
104 |
* invoking its constructor.
|
105 |
*
|
106 |
+
* @phpstan-param class-string<T> $className
|
107 |
*
|
108 |
+
* @phpstan-return callable(): T
|
109 |
+
*
|
110 |
+
* @throws InvalidArgumentException
|
111 |
+
* @throws UnexpectedValueException
|
112 |
+
* @throws ReflectionException
|
113 |
+
*
|
114 |
+
* @template T of object
|
115 |
*/
|
116 |
+
private function buildFactory(string $className): callable
|
117 |
{
|
118 |
$reflectionClass = $this->getReflectionClass($className);
|
119 |
|
120 |
if ($this->isInstantiableViaReflection($reflectionClass)) {
|
121 |
+
return [$reflectionClass, 'newInstanceWithoutConstructor'];
|
|
|
|
|
122 |
}
|
123 |
|
124 |
$serializedString = sprintf(
|
125 |
'%s:%d:"%s":0:{}',
|
126 |
+
is_subclass_of($className, Serializable::class) ? self::SERIALIZATION_FORMAT_USE_UNSERIALIZER : self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER,
|
127 |
strlen($className),
|
128 |
$className
|
129 |
);
|
130 |
|
131 |
$this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString);
|
132 |
|
133 |
+
return static function () use ($serializedString) {
|
134 |
return unserialize($serializedString);
|
135 |
};
|
136 |
}
|
137 |
|
138 |
/**
|
139 |
+
* @phpstan-param class-string<T> $className
|
140 |
*
|
141 |
+
* @phpstan-return ReflectionClass<T>
|
142 |
*
|
143 |
* @throws InvalidArgumentException
|
144 |
+
* @throws ReflectionException
|
145 |
+
*
|
146 |
+
* @template T of object
|
147 |
*/
|
148 |
+
private function getReflectionClass(string $className): ReflectionClass
|
149 |
{
|
150 |
if (! class_exists($className)) {
|
151 |
throw InvalidArgumentException::fromNonExistingClass($className);
|
152 |
}
|
153 |
|
154 |
+
if (PHP_VERSION_ID >= 80100 && enum_exists($className, false)) {
|
155 |
+
throw InvalidArgumentException::fromEnum($className);
|
156 |
+
}
|
157 |
+
|
158 |
$reflection = new ReflectionClass($className);
|
159 |
|
160 |
if ($reflection->isAbstract()) {
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
+
* @phpstan-param ReflectionClass<T> $reflectionClass
|
|
|
169 |
*
|
170 |
* @throws UnexpectedValueException
|
171 |
*
|
172 |
+
* @template T of object
|
173 |
*/
|
174 |
+
private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, string $serializedString): void
|
175 |
{
|
176 |
+
set_error_handler(static function (int $code, string $message, string $file, int $line) use ($reflectionClass, &$error): bool {
|
177 |
$error = UnexpectedValueException::fromUncleanUnSerialization(
|
178 |
$reflectionClass,
|
179 |
$message,
|
181 |
$file,
|
182 |
$line
|
183 |
);
|
|
|
184 |
|
185 |
+
return true;
|
186 |
+
});
|
187 |
|
188 |
+
try {
|
189 |
+
$this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString);
|
190 |
+
} finally {
|
191 |
+
restore_error_handler();
|
192 |
+
}
|
193 |
|
194 |
if ($error) {
|
195 |
throw $error;
|
197 |
}
|
198 |
|
199 |
/**
|
200 |
+
* @phpstan-param ReflectionClass<T> $reflectionClass
|
|
|
201 |
*
|
202 |
* @throws UnexpectedValueException
|
203 |
*
|
204 |
+
* @template T of object
|
205 |
*/
|
206 |
+
private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, string $serializedString): void
|
207 |
{
|
208 |
try {
|
209 |
unserialize($serializedString);
|
210 |
} catch (Exception $exception) {
|
|
|
|
|
211 |
throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception);
|
212 |
}
|
213 |
}
|
214 |
|
215 |
/**
|
216 |
+
* @phpstan-param ReflectionClass<T> $reflectionClass
|
217 |
*
|
218 |
+
* @template T of object
|
219 |
*/
|
220 |
+
private function isInstantiableViaReflection(ReflectionClass $reflectionClass): bool
|
221 |
{
|
222 |
+
return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal());
|
|
|
|
|
|
|
|
|
223 |
}
|
224 |
|
225 |
/**
|
226 |
* Verifies whether the given class is to be considered internal
|
227 |
*
|
228 |
+
* @phpstan-param ReflectionClass<T> $reflectionClass
|
229 |
*
|
230 |
+
* @template T of object
|
231 |
*/
|
232 |
+
private function hasInternalAncestors(ReflectionClass $reflectionClass): bool
|
233 |
{
|
234 |
do {
|
235 |
if ($reflectionClass->isInternal()) {
|
236 |
return true;
|
237 |
}
|
|
|
238 |
|
239 |
+
$reflectionClass = $reflectionClass->getParentClass();
|
240 |
+
} while ($reflectionClass);
|
241 |
|
242 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
}
|
244 |
|
245 |
/**
|
246 |
* Checks if a class is cloneable
|
247 |
*
|
248 |
+
* Classes implementing `__clone` cannot be safely cloned, as that may cause side-effects.
|
249 |
*
|
250 |
+
* @phpstan-param ReflectionClass<T> $reflectionClass
|
251 |
+
*
|
252 |
+
* @template T of object
|
253 |
*/
|
254 |
+
private function isSafeToClone(ReflectionClass $reflectionClass): bool
|
255 |
{
|
256 |
+
return $reflectionClass->isCloneable()
|
257 |
+
&& ! $reflectionClass->hasMethod('__clone')
|
258 |
+
&& ! $reflectionClass->isSubclassOf(ArrayIterator::class);
|
|
|
|
|
|
|
259 |
}
|
260 |
}
|
vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php
CHANGED
@@ -1,37 +1,24 @@
|
|
1 |
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
|
20 |
namespace Doctrine\Instantiator;
|
21 |
|
|
|
|
|
22 |
/**
|
23 |
* Instantiator provides utility methods to build objects without invoking their constructors
|
24 |
-
*
|
25 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
26 |
*/
|
27 |
interface InstantiatorInterface
|
28 |
{
|
29 |
/**
|
30 |
* @param string $className
|
|
|
31 |
*
|
32 |
* @return object
|
|
|
|
|
|
|
33 |
*
|
34 |
-
* @
|
35 |
*/
|
36 |
public function instantiate($className);
|
37 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace Doctrine\Instantiator;
|
4 |
|
5 |
+
use Doctrine\Instantiator\Exception\ExceptionInterface;
|
6 |
+
|
7 |
/**
|
8 |
* Instantiator provides utility methods to build objects without invoking their constructors
|
|
|
|
|
9 |
*/
|
10 |
interface InstantiatorInterface
|
11 |
{
|
12 |
/**
|
13 |
* @param string $className
|
14 |
+
* @phpstan-param class-string<T> $className
|
15 |
*
|
16 |
* @return object
|
17 |
+
* @phpstan-return T
|
18 |
+
*
|
19 |
+
* @throws ExceptionInterface
|
20 |
*
|
21 |
+
* @template T of object
|
22 |
*/
|
23 |
public function instantiate($className);
|
24 |
}
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorPerformance/InstantiatorPerformanceEvent.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorPerformance;
|
21 |
-
|
22 |
-
use Athletic\AthleticEvent;
|
23 |
-
use Doctrine\Instantiator\Instantiator;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Performance tests for {@see \Doctrine\Instantiator\Instantiator}
|
27 |
-
*
|
28 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
-
*/
|
30 |
-
class InstantiatorPerformanceEvent extends AthleticEvent
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* @var \Doctrine\Instantiator\Instantiator
|
34 |
-
*/
|
35 |
-
private $instantiator;
|
36 |
-
|
37 |
-
/**
|
38 |
-
* {@inheritDoc}
|
39 |
-
*/
|
40 |
-
protected function setUp()
|
41 |
-
{
|
42 |
-
$this->instantiator = new Instantiator();
|
43 |
-
|
44 |
-
$this->instantiator->instantiate(__CLASS__);
|
45 |
-
$this->instantiator->instantiate('ArrayObject');
|
46 |
-
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
|
47 |
-
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
|
48 |
-
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @iterations 20000
|
53 |
-
* @baseline
|
54 |
-
* @group instantiation
|
55 |
-
*/
|
56 |
-
public function testInstantiateSelf()
|
57 |
-
{
|
58 |
-
$this->instantiator->instantiate(__CLASS__);
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* @iterations 20000
|
63 |
-
* @group instantiation
|
64 |
-
*/
|
65 |
-
public function testInstantiateInternalClass()
|
66 |
-
{
|
67 |
-
$this->instantiator->instantiate('ArrayObject');
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* @iterations 20000
|
72 |
-
* @group instantiation
|
73 |
-
*/
|
74 |
-
public function testInstantiateSimpleSerializableAssetClass()
|
75 |
-
{
|
76 |
-
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* @iterations 20000
|
81 |
-
* @group instantiation
|
82 |
-
*/
|
83 |
-
public function testInstantiateSerializableArrayObjectAsset()
|
84 |
-
{
|
85 |
-
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* @iterations 20000
|
90 |
-
* @group instantiation
|
91 |
-
*/
|
92 |
-
public function testInstantiateUnCloneableAsset()
|
93 |
-
{
|
94 |
-
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
|
95 |
-
}
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/Exception/InvalidArgumentExceptionTest.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTest\Exception;
|
21 |
-
|
22 |
-
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
23 |
-
use PHPUnit_Framework_TestCase;
|
24 |
-
use ReflectionClass;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Tests for {@see \Doctrine\Instantiator\Exception\InvalidArgumentException}
|
28 |
-
*
|
29 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
30 |
-
*
|
31 |
-
* @covers \Doctrine\Instantiator\Exception\InvalidArgumentException
|
32 |
-
*/
|
33 |
-
class InvalidArgumentExceptionTest extends PHPUnit_Framework_TestCase
|
34 |
-
{
|
35 |
-
public function testFromNonExistingTypeWithNonExistingClass()
|
36 |
-
{
|
37 |
-
$className = __CLASS__ . uniqid();
|
38 |
-
$exception = InvalidArgumentException::fromNonExistingClass($className);
|
39 |
-
|
40 |
-
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\InvalidArgumentException', $exception);
|
41 |
-
$this->assertSame('The provided class "' . $className . '" does not exist', $exception->getMessage());
|
42 |
-
}
|
43 |
-
|
44 |
-
public function testFromNonExistingTypeWithTrait()
|
45 |
-
{
|
46 |
-
if (PHP_VERSION_ID < 50400) {
|
47 |
-
$this->markTestSkipped('Need at least PHP 5.4.0, as this test requires traits support to run');
|
48 |
-
}
|
49 |
-
|
50 |
-
$exception = InvalidArgumentException::fromNonExistingClass(
|
51 |
-
'DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset'
|
52 |
-
);
|
53 |
-
|
54 |
-
$this->assertSame(
|
55 |
-
'The provided type "DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset" is a trait, '
|
56 |
-
. 'and can not be instantiated',
|
57 |
-
$exception->getMessage()
|
58 |
-
);
|
59 |
-
}
|
60 |
-
|
61 |
-
public function testFromNonExistingTypeWithInterface()
|
62 |
-
{
|
63 |
-
$exception = InvalidArgumentException::fromNonExistingClass('Doctrine\\Instantiator\\InstantiatorInterface');
|
64 |
-
|
65 |
-
$this->assertSame(
|
66 |
-
'The provided type "Doctrine\\Instantiator\\InstantiatorInterface" is an interface, '
|
67 |
-
. 'and can not be instantiated',
|
68 |
-
$exception->getMessage()
|
69 |
-
);
|
70 |
-
}
|
71 |
-
|
72 |
-
public function testFromAbstractClass()
|
73 |
-
{
|
74 |
-
$reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
|
75 |
-
$exception = InvalidArgumentException::fromAbstractClass($reflection);
|
76 |
-
|
77 |
-
$this->assertSame(
|
78 |
-
'The provided class "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" is abstract, '
|
79 |
-
. 'and can not be instantiated',
|
80 |
-
$exception->getMessage()
|
81 |
-
);
|
82 |
-
}
|
83 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/Exception/UnexpectedValueExceptionTest.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTest\Exception;
|
21 |
-
|
22 |
-
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
23 |
-
use Exception;
|
24 |
-
use PHPUnit_Framework_TestCase;
|
25 |
-
use ReflectionClass;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Tests for {@see \Doctrine\Instantiator\Exception\UnexpectedValueException}
|
29 |
-
*
|
30 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
31 |
-
*
|
32 |
-
* @covers \Doctrine\Instantiator\Exception\UnexpectedValueException
|
33 |
-
*/
|
34 |
-
class UnexpectedValueExceptionTest extends PHPUnit_Framework_TestCase
|
35 |
-
{
|
36 |
-
public function testFromSerializationTriggeredException()
|
37 |
-
{
|
38 |
-
$reflectionClass = new ReflectionClass($this);
|
39 |
-
$previous = new Exception();
|
40 |
-
$exception = UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $previous);
|
41 |
-
|
42 |
-
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception);
|
43 |
-
$this->assertSame($previous, $exception->getPrevious());
|
44 |
-
$this->assertSame(
|
45 |
-
'An exception was raised while trying to instantiate an instance of "'
|
46 |
-
. __CLASS__ . '" via un-serialization',
|
47 |
-
$exception->getMessage()
|
48 |
-
);
|
49 |
-
}
|
50 |
-
|
51 |
-
public function testFromUncleanUnSerialization()
|
52 |
-
{
|
53 |
-
$reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
|
54 |
-
$exception = UnexpectedValueException::fromUncleanUnSerialization($reflection, 'foo', 123, 'bar', 456);
|
55 |
-
|
56 |
-
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception);
|
57 |
-
$this->assertSame(
|
58 |
-
'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" '
|
59 |
-
. 'via un-serialization, since an error was triggered in file "bar" at line "456"',
|
60 |
-
$exception->getMessage()
|
61 |
-
);
|
62 |
-
|
63 |
-
$previous = $exception->getPrevious();
|
64 |
-
|
65 |
-
$this->assertInstanceOf('Exception', $previous);
|
66 |
-
$this->assertSame('foo', $previous->getMessage());
|
67 |
-
$this->assertSame(123, $previous->getCode());
|
68 |
-
}
|
69 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php
DELETED
@@ -1,219 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTest;
|
21 |
-
|
22 |
-
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
23 |
-
use Doctrine\Instantiator\Instantiator;
|
24 |
-
use PHPUnit_Framework_TestCase;
|
25 |
-
use ReflectionClass;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Tests for {@see \Doctrine\Instantiator\Instantiator}
|
29 |
-
*
|
30 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
31 |
-
*
|
32 |
-
* @covers \Doctrine\Instantiator\Instantiator
|
33 |
-
*/
|
34 |
-
class InstantiatorTest extends PHPUnit_Framework_TestCase
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* @var Instantiator
|
38 |
-
*/
|
39 |
-
private $instantiator;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* {@inheritDoc}
|
43 |
-
*/
|
44 |
-
protected function setUp()
|
45 |
-
{
|
46 |
-
$this->instantiator = new Instantiator();
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @param string $className
|
51 |
-
*
|
52 |
-
* @dataProvider getInstantiableClasses
|
53 |
-
*/
|
54 |
-
public function testCanInstantiate($className)
|
55 |
-
{
|
56 |
-
$this->assertInstanceOf($className, $this->instantiator->instantiate($className));
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* @param string $className
|
61 |
-
*
|
62 |
-
* @dataProvider getInstantiableClasses
|
63 |
-
*/
|
64 |
-
public function testInstantiatesSeparateInstances($className)
|
65 |
-
{
|
66 |
-
$instance1 = $this->instantiator->instantiate($className);
|
67 |
-
$instance2 = $this->instantiator->instantiate($className);
|
68 |
-
|
69 |
-
$this->assertEquals($instance1, $instance2);
|
70 |
-
$this->assertNotSame($instance1, $instance2);
|
71 |
-
}
|
72 |
-
|
73 |
-
public function testExceptionOnUnSerializationException()
|
74 |
-
{
|
75 |
-
if (defined('HHVM_VERSION')) {
|
76 |
-
$this->markTestSkipped(
|
77 |
-
'As of facebook/hhvm#3432, HHVM has no PDORow, and therefore '
|
78 |
-
. ' no internal final classes that cannot be instantiated'
|
79 |
-
);
|
80 |
-
}
|
81 |
-
|
82 |
-
$className = 'DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset';
|
83 |
-
|
84 |
-
if (\PHP_VERSION_ID >= 50600) {
|
85 |
-
$className = 'PDORow';
|
86 |
-
}
|
87 |
-
|
88 |
-
if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) {
|
89 |
-
$className = 'DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset';
|
90 |
-
}
|
91 |
-
|
92 |
-
$this->setExpectedException('Doctrine\\Instantiator\\Exception\\UnexpectedValueException');
|
93 |
-
|
94 |
-
$this->instantiator->instantiate($className);
|
95 |
-
}
|
96 |
-
|
97 |
-
public function testNoticeOnUnSerializationException()
|
98 |
-
{
|
99 |
-
if (\PHP_VERSION_ID >= 50600) {
|
100 |
-
$this->markTestSkipped(
|
101 |
-
'PHP 5.6 supports `ReflectionClass#newInstanceWithoutConstructor()` for some internal classes'
|
102 |
-
);
|
103 |
-
}
|
104 |
-
|
105 |
-
try {
|
106 |
-
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
107 |
-
|
108 |
-
$this->fail('No exception was raised');
|
109 |
-
} catch (UnexpectedValueException $exception) {
|
110 |
-
$wakeUpNoticesReflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
111 |
-
$previous = $exception->getPrevious();
|
112 |
-
|
113 |
-
$this->assertInstanceOf('Exception', $previous);
|
114 |
-
|
115 |
-
// in PHP 5.4.29 and PHP 5.5.13, this case is not a notice, but an exception being thrown
|
116 |
-
if (! (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513)) {
|
117 |
-
$this->assertSame(
|
118 |
-
'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\WakeUpNoticesAsset" '
|
119 |
-
. 'via un-serialization, since an error was triggered in file "'
|
120 |
-
. $wakeUpNoticesReflection->getFileName() . '" at line "36"',
|
121 |
-
$exception->getMessage()
|
122 |
-
);
|
123 |
-
|
124 |
-
$this->assertSame('Something went bananas while un-serializing this instance', $previous->getMessage());
|
125 |
-
$this->assertSame(\E_USER_NOTICE, $previous->getCode());
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* @param string $invalidClassName
|
132 |
-
*
|
133 |
-
* @dataProvider getInvalidClassNames
|
134 |
-
*/
|
135 |
-
public function testInstantiationFromNonExistingClass($invalidClassName)
|
136 |
-
{
|
137 |
-
$this->setExpectedException('Doctrine\\Instantiator\\Exception\\InvalidArgumentException');
|
138 |
-
|
139 |
-
$this->instantiator->instantiate($invalidClassName);
|
140 |
-
}
|
141 |
-
|
142 |
-
public function testInstancesAreNotCloned()
|
143 |
-
{
|
144 |
-
$className = 'TemporaryClass' . uniqid();
|
145 |
-
|
146 |
-
eval('namespace ' . __NAMESPACE__ . '; class ' . $className . '{}');
|
147 |
-
|
148 |
-
$instance = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);
|
149 |
-
|
150 |
-
$instance->foo = 'bar';
|
151 |
-
|
152 |
-
$instance2 = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);
|
153 |
-
|
154 |
-
$this->assertObjectNotHasAttribute('foo', $instance2);
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Provides a list of instantiable classes (existing)
|
159 |
-
*
|
160 |
-
* @return string[][]
|
161 |
-
*/
|
162 |
-
public function getInstantiableClasses()
|
163 |
-
{
|
164 |
-
$classes = array(
|
165 |
-
array('stdClass'),
|
166 |
-
array(__CLASS__),
|
167 |
-
array('Doctrine\\Instantiator\\Instantiator'),
|
168 |
-
array('Exception'),
|
169 |
-
array('PharException'),
|
170 |
-
array('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset'),
|
171 |
-
array('DoctrineTest\\InstantiatorTestAsset\\ExceptionAsset'),
|
172 |
-
array('DoctrineTest\\InstantiatorTestAsset\\FinalExceptionAsset'),
|
173 |
-
array('DoctrineTest\\InstantiatorTestAsset\\PharExceptionAsset'),
|
174 |
-
array('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset'),
|
175 |
-
array('DoctrineTest\\InstantiatorTestAsset\\XMLReaderAsset'),
|
176 |
-
);
|
177 |
-
|
178 |
-
if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) {
|
179 |
-
return $classes;
|
180 |
-
}
|
181 |
-
|
182 |
-
$classes = array_merge(
|
183 |
-
$classes,
|
184 |
-
array(
|
185 |
-
array('PharException'),
|
186 |
-
array('ArrayObject'),
|
187 |
-
array('DoctrineTest\\InstantiatorTestAsset\\ArrayObjectAsset'),
|
188 |
-
array('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset'),
|
189 |
-
)
|
190 |
-
);
|
191 |
-
|
192 |
-
if (\PHP_VERSION_ID >= 50600) {
|
193 |
-
$classes[] = array('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
194 |
-
$classes[] = array('DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset');
|
195 |
-
}
|
196 |
-
|
197 |
-
return $classes;
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Provides a list of instantiable classes (existing)
|
202 |
-
*
|
203 |
-
* @return string[][]
|
204 |
-
*/
|
205 |
-
public function getInvalidClassNames()
|
206 |
-
{
|
207 |
-
$classNames = array(
|
208 |
-
array(__CLASS__ . uniqid()),
|
209 |
-
array('Doctrine\\Instantiator\\InstantiatorInterface'),
|
210 |
-
array('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset'),
|
211 |
-
);
|
212 |
-
|
213 |
-
if (\PHP_VERSION_ID >= 50400) {
|
214 |
-
$classNames[] = array('DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset');
|
215 |
-
}
|
216 |
-
|
217 |
-
return $classNames;
|
218 |
-
}
|
219 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/AbstractClassAsset.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* A simple asset for an abstract class
|
24 |
-
*
|
25 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
26 |
-
*/
|
27 |
-
abstract class AbstractClassAsset
|
28 |
-
{
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ArrayObjectAsset.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use ArrayObject;
|
23 |
-
use BadMethodCallException;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Test asset that extends an internal PHP class
|
27 |
-
*
|
28 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
-
*/
|
30 |
-
class ArrayObjectAsset extends ArrayObject
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* Constructor - should not be called
|
34 |
-
*
|
35 |
-
* @throws BadMethodCallException
|
36 |
-
*/
|
37 |
-
public function __construct()
|
38 |
-
{
|
39 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ExceptionAsset.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use BadMethodCallException;
|
23 |
-
use Exception;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Test asset that extends an internal PHP base exception
|
27 |
-
*
|
28 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
-
*/
|
30 |
-
class ExceptionAsset extends Exception
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* Constructor - should not be called
|
34 |
-
*
|
35 |
-
* @throws BadMethodCallException
|
36 |
-
*/
|
37 |
-
public function __construct()
|
38 |
-
{
|
39 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/FinalExceptionAsset.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use BadMethodCallException;
|
23 |
-
use Exception;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Test asset that extends an internal PHP base exception
|
27 |
-
*
|
28 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
-
*/
|
30 |
-
final class FinalExceptionAsset extends Exception
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* Constructor - should not be called
|
34 |
-
*
|
35 |
-
* @throws BadMethodCallException
|
36 |
-
*/
|
37 |
-
public function __construct()
|
38 |
-
{
|
39 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharAsset.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use BadMethodCallException;
|
23 |
-
use Phar;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Test asset that extends an internal PHP class
|
27 |
-
*
|
28 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
-
*/
|
30 |
-
class PharAsset extends Phar
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* Constructor - should not be called
|
34 |
-
*
|
35 |
-
* @throws BadMethodCallException
|
36 |
-
*/
|
37 |
-
public function __construct()
|
38 |
-
{
|
39 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharExceptionAsset.php
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use BadMethodCallException;
|
23 |
-
use PharException;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Test asset that extends an internal PHP class
|
27 |
-
* This class should be serializable without problems
|
28 |
-
* and without getting the "Erroneous data format for unserializing"
|
29 |
-
* error
|
30 |
-
*
|
31 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
32 |
-
*/
|
33 |
-
class PharExceptionAsset extends PharException
|
34 |
-
{
|
35 |
-
/**
|
36 |
-
* Constructor - should not be called
|
37 |
-
*
|
38 |
-
* @throws BadMethodCallException
|
39 |
-
*/
|
40 |
-
public function __construct()
|
41 |
-
{
|
42 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
43 |
-
}
|
44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SerializableArrayObjectAsset.php
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use ArrayObject;
|
23 |
-
use BadMethodCallException;
|
24 |
-
use Serializable;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Serializable test asset that also extends an internal class
|
28 |
-
*
|
29 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
30 |
-
*/
|
31 |
-
class SerializableArrayObjectAsset extends ArrayObject implements Serializable
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Constructor - should not be called
|
35 |
-
*
|
36 |
-
* @throws BadMethodCallException
|
37 |
-
*/
|
38 |
-
public function __construct()
|
39 |
-
{
|
40 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* {@inheritDoc}
|
45 |
-
*/
|
46 |
-
public function serialize()
|
47 |
-
{
|
48 |
-
return '';
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* {@inheritDoc}
|
53 |
-
*
|
54 |
-
* Should not be called
|
55 |
-
*
|
56 |
-
* @throws BadMethodCallException
|
57 |
-
*/
|
58 |
-
public function unserialize($serialized)
|
59 |
-
{
|
60 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
61 |
-
}
|
62 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleSerializableAsset.php
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use BadMethodCallException;
|
23 |
-
use Serializable;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Base serializable test asset
|
27 |
-
*
|
28 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
-
*/
|
30 |
-
class SimpleSerializableAsset implements Serializable
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* Constructor - should not be called
|
34 |
-
*
|
35 |
-
* @throws BadMethodCallException
|
36 |
-
*/
|
37 |
-
public function __construct()
|
38 |
-
{
|
39 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* {@inheritDoc}
|
44 |
-
*/
|
45 |
-
public function serialize()
|
46 |
-
{
|
47 |
-
return '';
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* {@inheritDoc}
|
52 |
-
*
|
53 |
-
* Should not be called
|
54 |
-
*
|
55 |
-
* @throws BadMethodCallException
|
56 |
-
*/
|
57 |
-
public function unserialize($serialized)
|
58 |
-
{
|
59 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
60 |
-
}
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleTraitAsset.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* A simple trait with no attached logic
|
24 |
-
*
|
25 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
26 |
-
*/
|
27 |
-
trait SimpleTraitAsset
|
28 |
-
{
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnCloneableAsset.php
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use BadMethodCallException;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Base un-cloneable asset
|
26 |
-
*
|
27 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
28 |
-
*/
|
29 |
-
class UnCloneableAsset
|
30 |
-
{
|
31 |
-
/**
|
32 |
-
* Constructor - should not be called
|
33 |
-
*
|
34 |
-
* @throws BadMethodCallException
|
35 |
-
*/
|
36 |
-
public function __construct()
|
37 |
-
{
|
38 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Magic `__clone` - should not be invoked
|
43 |
-
*
|
44 |
-
* @throws BadMethodCallException
|
45 |
-
*/
|
46 |
-
public function __clone()
|
47 |
-
{
|
48 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
49 |
-
}
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnserializeExceptionArrayObjectAsset.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use ArrayObject;
|
23 |
-
use BadMethodCallException;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* A simple asset for an abstract class
|
27 |
-
*
|
28 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
29 |
-
*/
|
30 |
-
class UnserializeExceptionArrayObjectAsset extends ArrayObject
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* {@inheritDoc}
|
34 |
-
*/
|
35 |
-
public function __wakeup()
|
36 |
-
{
|
37 |
-
throw new BadMethodCallException();
|
38 |
-
}
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/WakeUpNoticesAsset.php
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use ArrayObject;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* A simple asset for an abstract class
|
26 |
-
*
|
27 |
-
* @author Marco Pivetta <ocramius@gmail.com>
|
28 |
-
*/
|
29 |
-
class WakeUpNoticesAsset extends ArrayObject
|
30 |
-
{
|
31 |
-
/**
|
32 |
-
* Wakeup method called after un-serialization
|
33 |
-
*/
|
34 |
-
public function __wakeup()
|
35 |
-
{
|
36 |
-
trigger_error('Something went bananas while un-serializing this instance');
|
37 |
-
}
|
38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/XMLReaderAsset.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
4 |
-
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
5 |
-
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
6 |
-
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
7 |
-
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
8 |
-
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
9 |
-
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
10 |
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
11 |
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
12 |
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
13 |
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14 |
-
*
|
15 |
-
* This software consists of voluntary contributions made by many individuals
|
16 |
-
* and is licensed under the MIT license. For more information, see
|
17 |
-
* <http://www.doctrine-project.org>.
|
18 |
-
*/
|
19 |
-
|
20 |
-
namespace DoctrineTest\InstantiatorTestAsset;
|
21 |
-
|
22 |
-
use BadMethodCallException;
|
23 |
-
use XMLReader;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Test asset that extends an internal PHP class
|
27 |
-
*
|
28 |
-
* @author Dave Marshall <dave@atst.io>
|
29 |
-
*/
|
30 |
-
class XMLReaderAsset extends XMLReader
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* Constructor - should not be called
|
34 |
-
*
|
35 |
-
* @throws BadMethodCallException
|
36 |
-
*/
|
37 |
-
public function __construct()
|
38 |
-
{
|
39 |
-
throw new BadMethodCallException('Not supposed to be called!');
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/composer.json
CHANGED
@@ -12,15 +12,23 @@
|
|
12 |
"config": {
|
13 |
"sort-packages": true
|
14 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
"require": {
|
16 |
-
|
17 |
-
"
|
18 |
-
"facebook/facebook-instant-articles-sdk-php": "
|
19 |
},
|
20 |
"require-dev": {
|
21 |
"phpunit/phpunit": "^4.8",
|
22 |
"squizlabs/php_codesniffer": "^3.0.0",
|
23 |
-
"phpdocumentor/reflection-docblock": "^2.0"
|
|
|
24 |
},
|
25 |
"autoload": {
|
26 |
"psr-4": {
|
12 |
"config": {
|
13 |
"sort-packages": true
|
14 |
},
|
15 |
+
"repositories": [
|
16 |
+
{
|
17 |
+
"type": "vcs",
|
18 |
+
"url": "https://github.com/whyisjake/facebook-instant-articles-sdk-php"
|
19 |
+
}
|
20 |
+
|
21 |
+
],
|
22 |
"require": {
|
23 |
+
"php": "^5.4 || ^7.0 || ^8.0",
|
24 |
+
"doctrine/instantiator": "1.4.1",
|
25 |
+
"facebook/facebook-instant-articles-sdk-php": "dev-php8"
|
26 |
},
|
27 |
"require-dev": {
|
28 |
"phpunit/phpunit": "^4.8",
|
29 |
"squizlabs/php_codesniffer": "^3.0.0",
|
30 |
+
"phpdocumentor/reflection-docblock": "^2.0",
|
31 |
+
"phpcompatibility/phpcompatibility-wp": "^2.1"
|
32 |
},
|
33 |
"autoload": {
|
34 |
"psr-4": {
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/composer.lock
CHANGED
@@ -1,42 +1,39 @@
|
|
1 |
{
|
2 |
"_readme": [
|
3 |
"This file locks the dependencies of your project to a known state",
|
4 |
-
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
-
"hash": "
|
8 |
-
"content-hash": "a01d8ebabee19a0d370df859423c6939",
|
9 |
"packages": [
|
10 |
{
|
11 |
"name": "doctrine/instantiator",
|
12 |
-
"version": "1.
|
13 |
"source": {
|
14 |
"type": "git",
|
15 |
"url": "https://github.com/doctrine/instantiator.git",
|
16 |
-
"reference": "
|
17 |
},
|
18 |
"dist": {
|
19 |
"type": "zip",
|
20 |
-
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/
|
21 |
-
"reference": "
|
22 |
"shasum": ""
|
23 |
},
|
24 |
"require": {
|
25 |
-
"php": "
|
26 |
},
|
27 |
"require-dev": {
|
28 |
-
"
|
29 |
"ext-pdo": "*",
|
30 |
"ext-phar": "*",
|
31 |
-
"
|
32 |
-
"
|
|
|
|
|
|
|
33 |
},
|
34 |
"type": "library",
|
35 |
-
"extra": {
|
36 |
-
"branch-alias": {
|
37 |
-
"dev-master": "1.0.x-dev"
|
38 |
-
}
|
39 |
-
},
|
40 |
"autoload": {
|
41 |
"psr-4": {
|
42 |
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
@@ -50,42 +47,60 @@
|
|
50 |
{
|
51 |
"name": "Marco Pivetta",
|
52 |
"email": "ocramius@gmail.com",
|
53 |
-
"homepage": "
|
54 |
}
|
55 |
],
|
56 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
57 |
-
"homepage": "https://
|
58 |
"keywords": [
|
59 |
"constructor",
|
60 |
"instantiate"
|
61 |
],
|
62 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
},
|
64 |
{
|
65 |
"name": "facebook/facebook-instant-articles-sdk-php",
|
66 |
-
"version": "
|
67 |
"source": {
|
68 |
"type": "git",
|
69 |
-
"url": "https://github.com/
|
70 |
-
"reference": "
|
71 |
},
|
72 |
"dist": {
|
73 |
"type": "zip",
|
74 |
-
"url": "https://api.github.com/repos/
|
75 |
-
"reference": "
|
76 |
"shasum": ""
|
77 |
},
|
78 |
"require": {
|
79 |
"facebook/graph-sdk": "~5.0",
|
80 |
-
"php": "^5.4 || ^7
|
81 |
-
"symfony/css-selector": "2.8
|
82 |
},
|
83 |
"require-dev": {
|
84 |
-
"fzaninotto/faker": "
|
85 |
-
"phpdocumentor/reflection-docblock": "^2.0",
|
86 |
"phpunit/phpunit": "4.8.*",
|
87 |
-
"squizlabs/php_codesniffer": "^2.6.0",
|
88 |
-
"symfony/yaml": "2.1.*"
|
89 |
},
|
90 |
"type": "library",
|
91 |
"autoload": {
|
@@ -93,7 +108,25 @@
|
|
93 |
"Facebook\\InstantArticles\\": "src/Facebook/InstantArticles/"
|
94 |
}
|
95 |
},
|
96 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
"license": [
|
98 |
"proprietary"
|
99 |
],
|
@@ -111,24 +144,28 @@
|
|
111 |
"instant",
|
112 |
"sdk"
|
113 |
],
|
114 |
-
"
|
|
|
|
|
|
|
115 |
},
|
116 |
{
|
117 |
"name": "facebook/graph-sdk",
|
118 |
-
"version": "5.
|
119 |
"source": {
|
120 |
"type": "git",
|
121 |
"url": "https://github.com/facebook/php-graph-sdk.git",
|
122 |
-
"reference": "
|
123 |
},
|
124 |
"dist": {
|
125 |
"type": "zip",
|
126 |
-
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/
|
127 |
-
"reference": "
|
128 |
"shasum": ""
|
129 |
},
|
130 |
"require": {
|
131 |
-
"
|
|
|
132 |
},
|
133 |
"require-dev": {
|
134 |
"guzzlehttp/guzzle": "~5.0",
|
@@ -136,8 +173,7 @@
|
|
136 |
"phpunit/phpunit": "~4.0"
|
137 |
},
|
138 |
"suggest": {
|
139 |
-
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
140 |
-
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5"
|
141 |
},
|
142 |
"type": "library",
|
143 |
"extra": {
|
@@ -148,10 +184,7 @@
|
|
148 |
"autoload": {
|
149 |
"psr-4": {
|
150 |
"Facebook\\": "src/Facebook/"
|
151 |
-
}
|
152 |
-
"files": [
|
153 |
-
"src/Facebook/polyfills.php"
|
154 |
-
]
|
155 |
},
|
156 |
"notification-url": "https://packagist.org/downloads/",
|
157 |
"license": [
|
@@ -160,40 +193,269 @@
|
|
160 |
"authors": [
|
161 |
{
|
162 |
"name": "Facebook",
|
163 |
-
"homepage": "https://github.com/facebook/php-
|
164 |
}
|
165 |
],
|
166 |
"description": "Facebook SDK for PHP",
|
167 |
-
"homepage": "https://github.com/facebook/php-
|
168 |
"keywords": [
|
169 |
"facebook",
|
170 |
"sdk"
|
171 |
],
|
172 |
-
"
|
|
|
|
|
|
|
|
|
|
|
173 |
},
|
174 |
{
|
175 |
-
"name": "
|
176 |
-
"version": "
|
177 |
"source": {
|
178 |
"type": "git",
|
179 |
-
"url": "https://github.com/
|
180 |
-
"reference": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
},
|
182 |
"dist": {
|
183 |
"type": "zip",
|
184 |
-
"url": "https://api.github.com/repos/
|
185 |
-
"reference": "
|
186 |
"shasum": ""
|
187 |
},
|
188 |
"require": {
|
189 |
-
"php": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
"type": "library",
|
192 |
"extra": {
|
193 |
"branch-alias": {
|
194 |
-
"dev-master": "
|
195 |
}
|
196 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
"autoload": {
|
198 |
"psr-4": {
|
199 |
"Symfony\\Component\\CssSelector\\": ""
|
@@ -207,22 +469,122 @@
|
|
207 |
"MIT"
|
208 |
],
|
209 |
"authors": [
|
|
|
|
|
|
|
|
|
210 |
{
|
211 |
"name": "Jean-François Simon",
|
212 |
"email": "jeanfrancois.simon@sensiolabs.com"
|
213 |
},
|
214 |
{
|
215 |
-
"name": "
|
216 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
},
|
218 |
{
|
219 |
"name": "Symfony Community",
|
220 |
"homepage": "https://symfony.com/contributors"
|
221 |
}
|
222 |
],
|
223 |
-
"description": "Symfony
|
224 |
"homepage": "https://symfony.com",
|
225 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
],
|
228 |
"packages-dev": [
|
@@ -273,37 +635,38 @@
|
|
273 |
"email": "mike.vanriel@naenius.com"
|
274 |
}
|
275 |
],
|
276 |
-
"
|
|
|
|
|
|
|
|
|
277 |
},
|
278 |
{
|
279 |
"name": "phpspec/prophecy",
|
280 |
-
"version": "
|
281 |
"source": {
|
282 |
"type": "git",
|
283 |
"url": "https://github.com/phpspec/prophecy.git",
|
284 |
-
"reference": "
|
285 |
},
|
286 |
"dist": {
|
287 |
"type": "zip",
|
288 |
-
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/
|
289 |
-
"reference": "
|
290 |
"shasum": ""
|
291 |
},
|
292 |
"require": {
|
293 |
"doctrine/instantiator": "^1.0.2",
|
294 |
-
"
|
295 |
-
"
|
296 |
-
"sebastian/comparator": "^1.1|^2.0",
|
297 |
-
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
|
298 |
},
|
299 |
"require-dev": {
|
300 |
-
"phpspec/phpspec": "
|
301 |
-
"phpunit/phpunit": "^4.8.35 || ^5.7"
|
302 |
},
|
303 |
"type": "library",
|
304 |
"extra": {
|
305 |
"branch-alias": {
|
306 |
-
"dev-master": "1.
|
307 |
}
|
308 |
},
|
309 |
"autoload": {
|
@@ -336,7 +699,11 @@
|
|
336 |
"spy",
|
337 |
"stub"
|
338 |
],
|
339 |
-
"
|
|
|
|
|
|
|
|
|
340 |
},
|
341 |
{
|
342 |
"name": "phpunit/php-code-coverage",
|
@@ -398,7 +765,12 @@
|
|
398 |
"testing",
|
399 |
"xunit"
|
400 |
],
|
401 |
-
"
|
|
|
|
|
|
|
|
|
|
|
402 |
},
|
403 |
{
|
404 |
"name": "phpunit/php-file-iterator",
|
@@ -445,7 +817,12 @@
|
|
445 |
"filesystem",
|
446 |
"iterator"
|
447 |
],
|
448 |
-
"
|
|
|
|
|
|
|
|
|
|
|
449 |
},
|
450 |
{
|
451 |
"name": "phpunit/php-text-template",
|
@@ -486,34 +863,33 @@
|
|
486 |
"keywords": [
|
487 |
"template"
|
488 |
],
|
489 |
-
"
|
|
|
|
|
|
|
|
|
490 |
},
|
491 |
{
|
492 |
"name": "phpunit/php-timer",
|
493 |
-
"version": "1.0.
|
494 |
"source": {
|
495 |
"type": "git",
|
496 |
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
497 |
-
"reference": "
|
498 |
},
|
499 |
"dist": {
|
500 |
"type": "zip",
|
501 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/
|
502 |
-
"reference": "
|
503 |
"shasum": ""
|
504 |
},
|
505 |
"require": {
|
506 |
-
"php": "
|
507 |
},
|
508 |
"require-dev": {
|
509 |
-
"phpunit/phpunit": "
|
510 |
},
|
511 |
"type": "library",
|
512 |
-
"extra": {
|
513 |
-
"branch-alias": {
|
514 |
-
"dev-master": "1.0-dev"
|
515 |
-
}
|
516 |
-
},
|
517 |
"autoload": {
|
518 |
"classmap": [
|
519 |
"src/"
|
@@ -535,7 +911,12 @@
|
|
535 |
"keywords": [
|
536 |
"timer"
|
537 |
],
|
538 |
-
"
|
|
|
|
|
|
|
|
|
|
|
539 |
},
|
540 |
{
|
541 |
"name": "phpunit/php-token-stream",
|
@@ -584,7 +965,12 @@
|
|
584 |
"keywords": [
|
585 |
"tokenizer"
|
586 |
],
|
587 |
-
"
|
|
|
|
|
|
|
|
|
|
|
588 |
},
|
589 |
{
|
590 |
"name": "phpunit/phpunit",
|
@@ -656,7 +1042,11 @@
|
|
656 |
"testing",
|
657 |
"xunit"
|
658 |
],
|
659 |
-
"
|
|
|
|
|
|
|
|
|
660 |
},
|
661 |
{
|
662 |
"name": "phpunit/phpunit-mock-objects",
|
@@ -712,7 +1102,13 @@
|
|
712 |
"mock",
|
713 |
"xunit"
|
714 |
],
|
715 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
},
|
717 |
{
|
718 |
"name": "sebastian/comparator",
|
@@ -776,27 +1172,31 @@
|
|
776 |
"compare",
|
777 |
"equality"
|
778 |
],
|
779 |
-
"
|
|
|
|
|
|
|
|
|
780 |
},
|
781 |
{
|
782 |
"name": "sebastian/diff",
|
783 |
-
"version": "1.4.
|
784 |
"source": {
|
785 |
"type": "git",
|
786 |
"url": "https://github.com/sebastianbergmann/diff.git",
|
787 |
-
"reference": "
|
788 |
},
|
789 |
"dist": {
|
790 |
"type": "zip",
|
791 |
-
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/
|
792 |
-
"reference": "
|
793 |
"shasum": ""
|
794 |
},
|
795 |
"require": {
|
796 |
-
"php": "
|
797 |
},
|
798 |
"require-dev": {
|
799 |
-
"phpunit/phpunit": "
|
800 |
},
|
801 |
"type": "library",
|
802 |
"extra": {
|
@@ -828,27 +1228,31 @@
|
|
828 |
"keywords": [
|
829 |
"diff"
|
830 |
],
|
831 |
-
"
|
|
|
|
|
|
|
|
|
832 |
},
|
833 |
{
|
834 |
"name": "sebastian/environment",
|
835 |
-
"version": "1.3.
|
836 |
"source": {
|
837 |
"type": "git",
|
838 |
"url": "https://github.com/sebastianbergmann/environment.git",
|
839 |
-
"reference": "
|
840 |
},
|
841 |
"dist": {
|
842 |
"type": "zip",
|
843 |
-
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/
|
844 |
-
"reference": "
|
845 |
"shasum": ""
|
846 |
},
|
847 |
"require": {
|
848 |
-
"php": "
|
849 |
},
|
850 |
"require-dev": {
|
851 |
-
"phpunit/phpunit": "
|
852 |
},
|
853 |
"type": "library",
|
854 |
"extra": {
|
@@ -878,7 +1282,11 @@
|
|
878 |
"environment",
|
879 |
"hhvm"
|
880 |
],
|
881 |
-
"
|
|
|
|
|
|
|
|
|
882 |
},
|
883 |
{
|
884 |
"name": "sebastian/exporter",
|
@@ -945,7 +1353,11 @@
|
|
945 |
"export",
|
946 |
"exporter"
|
947 |
],
|
948 |
-
"
|
|
|
|
|
|
|
|
|
949 |
},
|
950 |
{
|
951 |
"name": "sebastian/global-state",
|
@@ -996,7 +1408,11 @@
|
|
996 |
"keywords": [
|
997 |
"global state"
|
998 |
],
|
999 |
-
"
|
|
|
|
|
|
|
|
|
1000 |
},
|
1001 |
{
|
1002 |
"name": "sebastian/recursion-context",
|
@@ -1049,7 +1465,11 @@
|
|
1049 |
],
|
1050 |
"description": "Provides functionality to recursively process PHP variables",
|
1051 |
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1052 |
-
"
|
|
|
|
|
|
|
|
|
1053 |
},
|
1054 |
{
|
1055 |
"name": "sebastian/version",
|
@@ -1084,75 +1504,111 @@
|
|
1084 |
],
|
1085 |
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1086 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1087 |
-
"
|
|
|
|
|
|
|
|
|
1088 |
},
|
1089 |
{
|
1090 |
-
"name": "
|
1091 |
-
"version": "
|
1092 |
"source": {
|
1093 |
"type": "git",
|
1094 |
-
"url": "https://github.com/
|
1095 |
-
"reference": "
|
1096 |
},
|
1097 |
"dist": {
|
1098 |
"type": "zip",
|
1099 |
-
"url": "https://api.github.com/repos/
|
1100 |
-
"reference": "
|
1101 |
"shasum": ""
|
1102 |
},
|
1103 |
"require": {
|
1104 |
-
"
|
1105 |
-
"ext-tokenizer": "*",
|
1106 |
-
"ext-xmlwriter": "*",
|
1107 |
-
"php": ">=5.4.0"
|
1108 |
},
|
1109 |
-
"
|
1110 |
-
"
|
|
|
|
|
|
|
1111 |
},
|
1112 |
-
"bin": [
|
1113 |
-
"bin/phpcs",
|
1114 |
-
"bin/phpcbf"
|
1115 |
-
],
|
1116 |
"type": "library",
|
1117 |
"extra": {
|
1118 |
"branch-alias": {
|
1119 |
-
"dev-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1120 |
}
|
1121 |
},
|
1122 |
"notification-url": "https://packagist.org/downloads/",
|
1123 |
"license": [
|
1124 |
-
"
|
1125 |
],
|
1126 |
"authors": [
|
1127 |
{
|
1128 |
-
"name": "
|
1129 |
-
"
|
|
|
|
|
|
|
|
|
1130 |
}
|
1131 |
],
|
1132 |
-
"description": "
|
1133 |
-
"homepage": "
|
1134 |
"keywords": [
|
1135 |
-
"
|
1136 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1137 |
],
|
1138 |
-
"time": "
|
1139 |
},
|
1140 |
{
|
1141 |
"name": "symfony/yaml",
|
1142 |
-
"version": "v3.4.
|
1143 |
"source": {
|
1144 |
"type": "git",
|
1145 |
"url": "https://github.com/symfony/yaml.git",
|
1146 |
-
"reference": "
|
1147 |
},
|
1148 |
"dist": {
|
1149 |
"type": "zip",
|
1150 |
-
"url": "https://api.github.com/repos/symfony/yaml/zipball/
|
1151 |
-
"reference": "
|
1152 |
"shasum": ""
|
1153 |
},
|
1154 |
"require": {
|
1155 |
-
"php": "^5.5.9|>=7.0.8"
|
|
|
1156 |
},
|
1157 |
"conflict": {
|
1158 |
"symfony/console": "<3.4"
|
@@ -1164,11 +1620,6 @@
|
|
1164 |
"symfony/console": "For validating YAML files using the lint command"
|
1165 |
},
|
1166 |
"type": "library",
|
1167 |
-
"extra": {
|
1168 |
-
"branch-alias": {
|
1169 |
-
"dev-master": "3.4-dev"
|
1170 |
-
}
|
1171 |
-
},
|
1172 |
"autoload": {
|
1173 |
"psr-4": {
|
1174 |
"Symfony\\Component\\Yaml\\": ""
|
@@ -1193,16 +1644,36 @@
|
|
1193 |
],
|
1194 |
"description": "Symfony Yaml Component",
|
1195 |
"homepage": "https://symfony.com",
|
1196 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1197 |
}
|
1198 |
],
|
1199 |
"aliases": [],
|
1200 |
"minimum-stability": "stable",
|
1201 |
-
"stability-flags":
|
|
|
|
|
1202 |
"prefer-stable": false,
|
1203 |
"prefer-lowest": false,
|
1204 |
"platform": {
|
1205 |
-
"php": "^5.4 || ^7.0"
|
1206 |
},
|
1207 |
-
"platform-dev": []
|
|
|
1208 |
}
|
1 |
{
|
2 |
"_readme": [
|
3 |
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
+
"content-hash": "8349696650b0abf0e2e417bdecd0cf0e",
|
|
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "doctrine/instantiator",
|
11 |
+
"version": "1.4.1",
|
12 |
"source": {
|
13 |
"type": "git",
|
14 |
"url": "https://github.com/doctrine/instantiator.git",
|
15 |
+
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc"
|
16 |
},
|
17 |
"dist": {
|
18 |
"type": "zip",
|
19 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc",
|
20 |
+
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc",
|
21 |
"shasum": ""
|
22 |
},
|
23 |
"require": {
|
24 |
+
"php": "^7.1 || ^8.0"
|
25 |
},
|
26 |
"require-dev": {
|
27 |
+
"doctrine/coding-standard": "^9",
|
28 |
"ext-pdo": "*",
|
29 |
"ext-phar": "*",
|
30 |
+
"phpbench/phpbench": "^0.16 || ^1",
|
31 |
+
"phpstan/phpstan": "^1.4",
|
32 |
+
"phpstan/phpstan-phpunit": "^1",
|
33 |
+
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
34 |
+
"vimeo/psalm": "^4.22"
|
35 |
},
|
36 |
"type": "library",
|
|
|
|
|
|
|
|
|
|
|
37 |
"autoload": {
|
38 |
"psr-4": {
|
39 |
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
47 |
{
|
48 |
"name": "Marco Pivetta",
|
49 |
"email": "ocramius@gmail.com",
|
50 |
+
"homepage": "https://ocramius.github.io/"
|
51 |
}
|
52 |
],
|
53 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
54 |
+
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
|
55 |
"keywords": [
|
56 |
"constructor",
|
57 |
"instantiate"
|
58 |
],
|
59 |
+
"support": {
|
60 |
+
"issues": "https://github.com/doctrine/instantiator/issues",
|
61 |
+
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
|
62 |
+
},
|
63 |
+
"funding": [
|
64 |
+
{
|
65 |
+
"url": "https://www.doctrine-project.org/sponsorship.html",
|
66 |
+
"type": "custom"
|
67 |
+
},
|
68 |
+
{
|
69 |
+
"url": "https://www.patreon.com/phpdoctrine",
|
70 |
+
"type": "patreon"
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
|
74 |
+
"type": "tidelift"
|
75 |
+
}
|
76 |
+
],
|
77 |
+
"time": "2022-03-03T08:28:38+00:00"
|
78 |
},
|
79 |
{
|
80 |
"name": "facebook/facebook-instant-articles-sdk-php",
|
81 |
+
"version": "dev-php8",
|
82 |
"source": {
|
83 |
"type": "git",
|
84 |
+
"url": "https://github.com/whyisjake/facebook-instant-articles-sdk-php.git",
|
85 |
+
"reference": "beaaf75e9ee4aae1798f7ef1d06fbf5a33851cc0"
|
86 |
},
|
87 |
"dist": {
|
88 |
"type": "zip",
|
89 |
+
"url": "https://api.github.com/repos/whyisjake/facebook-instant-articles-sdk-php/zipball/beaaf75e9ee4aae1798f7ef1d06fbf5a33851cc0",
|
90 |
+
"reference": "beaaf75e9ee4aae1798f7ef1d06fbf5a33851cc0",
|
91 |
"shasum": ""
|
92 |
},
|
93 |
"require": {
|
94 |
"facebook/graph-sdk": "~5.0",
|
95 |
+
"php": "^5.4 || ^5.6 || ^7 || ^8",
|
96 |
+
"symfony/css-selector": "^2.8 || ^3.1 || ^4.1"
|
97 |
},
|
98 |
"require-dev": {
|
99 |
+
"fzaninotto/faker": "dev-master",
|
100 |
+
"phpdocumentor/reflection-docblock": "^2.0 || ^4.0",
|
101 |
"phpunit/phpunit": "4.8.*",
|
102 |
+
"squizlabs/php_codesniffer": "^2.6.0 || ^3.0.0",
|
103 |
+
"symfony/yaml": "2.1.* || 3.4.*"
|
104 |
},
|
105 |
"type": "library",
|
106 |
"autoload": {
|
108 |
"Facebook\\InstantArticles\\": "src/Facebook/InstantArticles/"
|
109 |
}
|
110 |
},
|
111 |
+
"autoload-dev": {
|
112 |
+
"psr-4": {
|
113 |
+
"Facebook\\": "tests/Facebook/"
|
114 |
+
}
|
115 |
+
},
|
116 |
+
"scripts": {
|
117 |
+
"all": [
|
118 |
+
"@cs",
|
119 |
+
"@test"
|
120 |
+
],
|
121 |
+
"cs": [
|
122 |
+
"composer install",
|
123 |
+
"phpcbf --standard=phpcs.xml -p || phpcs --standard=phpcs.xml -p"
|
124 |
+
],
|
125 |
+
"test": [
|
126 |
+
"composer install",
|
127 |
+
"phpunit"
|
128 |
+
]
|
129 |
+
},
|
130 |
"license": [
|
131 |
"proprietary"
|
132 |
],
|
144 |
"instant",
|
145 |
"sdk"
|
146 |
],
|
147 |
+
"support": {
|
148 |
+
"source": "https://github.com/whyisjake/facebook-instant-articles-sdk-php/tree/v1.10.3"
|
149 |
+
},
|
150 |
+
"time": "2022-09-14T22:27:59+00:00"
|
151 |
},
|
152 |
{
|
153 |
"name": "facebook/graph-sdk",
|
154 |
+
"version": "5.1.4",
|
155 |
"source": {
|
156 |
"type": "git",
|
157 |
"url": "https://github.com/facebook/php-graph-sdk.git",
|
158 |
+
"reference": "38fd7187a6704d3ab14ded2f3a534ac4ee6f3481"
|
159 |
},
|
160 |
"dist": {
|
161 |
"type": "zip",
|
162 |
+
"url": "https://api.github.com/repos/facebook/php-graph-sdk/zipball/38fd7187a6704d3ab14ded2f3a534ac4ee6f3481",
|
163 |
+
"reference": "38fd7187a6704d3ab14ded2f3a534ac4ee6f3481",
|
164 |
"shasum": ""
|
165 |
},
|
166 |
"require": {
|
167 |
+
"ext-mbstring": "*",
|
168 |
+
"php": ">=5.4.0"
|
169 |
},
|
170 |
"require-dev": {
|
171 |
"guzzlehttp/guzzle": "~5.0",
|
173 |
"phpunit/phpunit": "~4.0"
|
174 |
},
|
175 |
"suggest": {
|
176 |
+
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
|
|
177 |
},
|
178 |
"type": "library",
|
179 |
"extra": {
|
184 |
"autoload": {
|
185 |
"psr-4": {
|
186 |
"Facebook\\": "src/Facebook/"
|
187 |
+
}
|
|
|
|
|
|
|
188 |
},
|
189 |
"notification-url": "https://packagist.org/downloads/",
|
190 |
"license": [
|
193 |
"authors": [
|
194 |
{
|
195 |
"name": "Facebook",
|
196 |
+
"homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
|
197 |
}
|
198 |
],
|
199 |
"description": "Facebook SDK for PHP",
|
200 |
+
"homepage": "https://github.com/facebook/facebook-php-sdk-v4",
|
201 |
"keywords": [
|
202 |
"facebook",
|
203 |
"sdk"
|
204 |
],
|
205 |
+
"support": {
|
206 |
+
"issues": "https://github.com/facebook/php-graph-sdk/issues",
|
207 |
+
"source": "https://github.com/facebook/php-graph-sdk/tree/5.1.4"
|
208 |
+
},
|
209 |
+
"abandoned": true,
|
210 |
+
"time": "2016-05-13T17:28:30+00:00"
|
211 |
},
|
212 |
{
|
213 |
+
"name": "phpcompatibility/php-compatibility",
|
214 |
+
"version": "9.3.5",
|
215 |
"source": {
|
216 |
"type": "git",
|
217 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
218 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
|
219 |
+
},
|
220 |
+
"dist": {
|
221 |
+
"type": "zip",
|
222 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
|
223 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
|
224 |
+
"shasum": ""
|
225 |
+
},
|
226 |
+
"require": {
|
227 |
+
"php": ">=5.3",
|
228 |
+
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
|
229 |
+
},
|
230 |
+
"conflict": {
|
231 |
+
"squizlabs/php_codesniffer": "2.6.2"
|
232 |
+
},
|
233 |
+
"require-dev": {
|
234 |
+
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
|
235 |
+
},
|
236 |
+
"suggest": {
|
237 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
238 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
239 |
+
},
|
240 |
+
"type": "phpcodesniffer-standard",
|
241 |
+
"notification-url": "https://packagist.org/downloads/",
|
242 |
+
"license": [
|
243 |
+
"LGPL-3.0-or-later"
|
244 |
+
],
|
245 |
+
"authors": [
|
246 |
+
{
|
247 |
+
"name": "Wim Godden",
|
248 |
+
"homepage": "https://github.com/wimg",
|
249 |
+
"role": "lead"
|
250 |
+
},
|
251 |
+
{
|
252 |
+
"name": "Juliette Reinders Folmer",
|
253 |
+
"homepage": "https://github.com/jrfnl",
|
254 |
+
"role": "lead"
|
255 |
+
},
|
256 |
+
{
|
257 |
+
"name": "Contributors",
|
258 |
+
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
|
259 |
+
}
|
260 |
+
],
|
261 |
+
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
|
262 |
+
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
|
263 |
+
"keywords": [
|
264 |
+
"compatibility",
|
265 |
+
"phpcs",
|
266 |
+
"standards"
|
267 |
+
],
|
268 |
+
"support": {
|
269 |
+
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
|
270 |
+
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
|
271 |
+
},
|
272 |
+
"time": "2019-12-27T09:44:58+00:00"
|
273 |
+
},
|
274 |
+
{
|
275 |
+
"name": "phpcompatibility/phpcompatibility-paragonie",
|
276 |
+
"version": "1.3.1",
|
277 |
+
"source": {
|
278 |
+
"type": "git",
|
279 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
|
280 |
+
"reference": "ddabec839cc003651f2ce695c938686d1086cf43"
|
281 |
},
|
282 |
"dist": {
|
283 |
"type": "zip",
|
284 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43",
|
285 |
+
"reference": "ddabec839cc003651f2ce695c938686d1086cf43",
|
286 |
"shasum": ""
|
287 |
},
|
288 |
"require": {
|
289 |
+
"phpcompatibility/php-compatibility": "^9.0"
|
290 |
+
},
|
291 |
+
"require-dev": {
|
292 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
|
293 |
+
"paragonie/random_compat": "dev-master",
|
294 |
+
"paragonie/sodium_compat": "dev-master"
|
295 |
+
},
|
296 |
+
"suggest": {
|
297 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
298 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
299 |
},
|
300 |
+
"type": "phpcodesniffer-standard",
|
301 |
+
"notification-url": "https://packagist.org/downloads/",
|
302 |
+
"license": [
|
303 |
+
"LGPL-3.0-or-later"
|
304 |
+
],
|
305 |
+
"authors": [
|
306 |
+
{
|
307 |
+
"name": "Wim Godden",
|
308 |
+
"role": "lead"
|
309 |
+
},
|
310 |
+
{
|
311 |
+
"name": "Juliette Reinders Folmer",
|
312 |
+
"role": "lead"
|
313 |
+
}
|
314 |
+
],
|
315 |
+
"description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
|
316 |
+
"homepage": "http://phpcompatibility.com/",
|
317 |
+
"keywords": [
|
318 |
+
"compatibility",
|
319 |
+
"paragonie",
|
320 |
+
"phpcs",
|
321 |
+
"polyfill",
|
322 |
+
"standards"
|
323 |
+
],
|
324 |
+
"support": {
|
325 |
+
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
|
326 |
+
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
|
327 |
+
},
|
328 |
+
"time": "2021-02-15T10:24:51+00:00"
|
329 |
+
},
|
330 |
+
{
|
331 |
+
"name": "phpcompatibility/phpcompatibility-wp",
|
332 |
+
"version": "2.1.3",
|
333 |
+
"source": {
|
334 |
+
"type": "git",
|
335 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
|
336 |
+
"reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308"
|
337 |
+
},
|
338 |
+
"dist": {
|
339 |
+
"type": "zip",
|
340 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308",
|
341 |
+
"reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308",
|
342 |
+
"shasum": ""
|
343 |
+
},
|
344 |
+
"require": {
|
345 |
+
"phpcompatibility/php-compatibility": "^9.0",
|
346 |
+
"phpcompatibility/phpcompatibility-paragonie": "^1.0"
|
347 |
+
},
|
348 |
+
"require-dev": {
|
349 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7"
|
350 |
+
},
|
351 |
+
"suggest": {
|
352 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
353 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
354 |
+
},
|
355 |
+
"type": "phpcodesniffer-standard",
|
356 |
+
"notification-url": "https://packagist.org/downloads/",
|
357 |
+
"license": [
|
358 |
+
"LGPL-3.0-or-later"
|
359 |
+
],
|
360 |
+
"authors": [
|
361 |
+
{
|
362 |
+
"name": "Wim Godden",
|
363 |
+
"role": "lead"
|
364 |
+
},
|
365 |
+
{
|
366 |
+
"name": "Juliette Reinders Folmer",
|
367 |
+
"role": "lead"
|
368 |
+
}
|
369 |
+
],
|
370 |
+
"description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
|
371 |
+
"homepage": "http://phpcompatibility.com/",
|
372 |
+
"keywords": [
|
373 |
+
"compatibility",
|
374 |
+
"phpcs",
|
375 |
+
"standards",
|
376 |
+
"wordpress"
|
377 |
+
],
|
378 |
+
"support": {
|
379 |
+
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
|
380 |
+
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
|
381 |
+
},
|
382 |
+
"time": "2021-12-30T16:37:40+00:00"
|
383 |
+
},
|
384 |
+
{
|
385 |
+
"name": "squizlabs/php_codesniffer",
|
386 |
+
"version": "3.7.1",
|
387 |
+
"source": {
|
388 |
+
"type": "git",
|
389 |
+
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
390 |
+
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
|
391 |
+
},
|
392 |
+
"dist": {
|
393 |
+
"type": "zip",
|
394 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
|
395 |
+
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
|
396 |
+
"shasum": ""
|
397 |
+
},
|
398 |
+
"require": {
|
399 |
+
"ext-simplexml": "*",
|
400 |
+
"ext-tokenizer": "*",
|
401 |
+
"ext-xmlwriter": "*",
|
402 |
+
"php": ">=5.4.0"
|
403 |
+
},
|
404 |
+
"require-dev": {
|
405 |
+
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
406 |
+
},
|
407 |
+
"bin": [
|
408 |
+
"bin/phpcs",
|
409 |
+
"bin/phpcbf"
|
410 |
+
],
|
411 |
"type": "library",
|
412 |
"extra": {
|
413 |
"branch-alias": {
|
414 |
+
"dev-master": "3.x-dev"
|
415 |
}
|
416 |
},
|
417 |
+
"notification-url": "https://packagist.org/downloads/",
|
418 |
+
"license": [
|
419 |
+
"BSD-3-Clause"
|
420 |
+
],
|
421 |
+
"authors": [
|
422 |
+
{
|
423 |
+
"name": "Greg Sherwood",
|
424 |
+
"role": "lead"
|
425 |
+
}
|
426 |
+
],
|
427 |
+
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
428 |
+
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
429 |
+
"keywords": [
|
430 |
+
"phpcs",
|
431 |
+
"standards"
|
432 |
+
],
|
433 |
+
"support": {
|
434 |
+
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
|
435 |
+
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
|
436 |
+
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
|
437 |
+
},
|
438 |
+
"time": "2022-06-18T07:21:10+00:00"
|
439 |
+
},
|
440 |
+
{
|
441 |
+
"name": "symfony/css-selector",
|
442 |
+
"version": "v4.4.44",
|
443 |
+
"source": {
|
444 |
+
"type": "git",
|
445 |
+
"url": "https://github.com/symfony/css-selector.git",
|
446 |
+
"reference": "bd0a6737e48de45b4b0b7b6fc98c78404ddceaed"
|
447 |
+
},
|
448 |
+
"dist": {
|
449 |
+
"type": "zip",
|
450 |
+
"url": "https://api.github.com/repos/symfony/css-selector/zipball/bd0a6737e48de45b4b0b7b6fc98c78404ddceaed",
|
451 |
+
"reference": "bd0a6737e48de45b4b0b7b6fc98c78404ddceaed",
|
452 |
+
"shasum": ""
|
453 |
+
},
|
454 |
+
"require": {
|
455 |
+
"php": ">=7.1.3",
|
456 |
+
"symfony/polyfill-php80": "^1.16"
|
457 |
+
},
|
458 |
+
"type": "library",
|
459 |
"autoload": {
|
460 |
"psr-4": {
|
461 |
"Symfony\\Component\\CssSelector\\": ""
|
469 |
"MIT"
|
470 |
],
|
471 |
"authors": [
|
472 |
+
{
|
473 |
+
"name": "Fabien Potencier",
|
474 |
+
"email": "fabien@symfony.com"
|
475 |
+
},
|
476 |
{
|
477 |
"name": "Jean-François Simon",
|
478 |
"email": "jeanfrancois.simon@sensiolabs.com"
|
479 |
},
|
480 |
{
|
481 |
+
"name": "Symfony Community",
|
482 |
+
"homepage": "https://symfony.com/contributors"
|
483 |
+
}
|
484 |
+
],
|
485 |
+
"description": "Converts CSS selectors to XPath expressions",
|
486 |
+
"homepage": "https://symfony.com",
|
487 |
+
"support": {
|
488 |
+
"source": "https://github.com/symfony/css-selector/tree/v4.4.44"
|
489 |
+
},
|
490 |
+
"funding": [
|
491 |
+
{
|
492 |
+
"url": "https://symfony.com/sponsor",
|
493 |
+
"type": "custom"
|
494 |
+
},
|
495 |
+
{
|
496 |
+
"url": "https://github.com/fabpot",
|
497 |
+
"type": "github"
|
498 |
+
},
|
499 |
+
{
|
500 |
+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
501 |
+
"type": "tidelift"
|
502 |
+
}
|
503 |
+
],
|
504 |
+
"time": "2022-06-27T13:16:42+00:00"
|
505 |
+
},
|
506 |
+
{
|
507 |
+
"name": "symfony/polyfill-php80",
|
508 |
+
"version": "v1.26.0",
|
509 |
+
"source": {
|
510 |
+
"type": "git",
|
511 |
+
"url": "https://github.com/symfony/polyfill-php80.git",
|
512 |
+
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
|
513 |
+
},
|
514 |
+
"dist": {
|
515 |
+
"type": "zip",
|
516 |
+
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
|
517 |
+
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
|
518 |
+
"shasum": ""
|
519 |
+
},
|
520 |
+
"require": {
|
521 |
+
"php": ">=7.1"
|
522 |
+
},
|
523 |
+
"type": "library",
|
524 |
+
"extra": {
|
525 |
+
"branch-alias": {
|
526 |
+
"dev-main": "1.26-dev"
|
527 |
+
},
|
528 |
+
"thanks": {
|
529 |
+
"name": "symfony/polyfill",
|
530 |
+
"url": "https://github.com/symfony/polyfill"
|
531 |
+
}
|
532 |
+
},
|
533 |
+
"autoload": {
|
534 |
+
"files": [
|
535 |
+
"bootstrap.php"
|
536 |
+
],
|
537 |
+
"psr-4": {
|
538 |
+
"Symfony\\Polyfill\\Php80\\": ""
|
539 |
+
},
|
540 |
+
"classmap": [
|
541 |
+
"Resources/stubs"
|
542 |
+
]
|
543 |
+
},
|
544 |
+
"notification-url": "https://packagist.org/downloads/",
|
545 |
+
"license": [
|
546 |
+
"MIT"
|
547 |
+
],
|
548 |
+
"authors": [
|
549 |
+
{
|
550 |
+
"name": "Ion Bazan",
|
551 |
+
"email": "ion.bazan@gmail.com"
|
552 |
+
},
|
553 |
+
{
|
554 |
+
"name": "Nicolas Grekas",
|
555 |
+
"email": "p@tchwork.com"
|
556 |
},
|
557 |
{
|
558 |
"name": "Symfony Community",
|
559 |
"homepage": "https://symfony.com/contributors"
|
560 |
}
|
561 |
],
|
562 |
+
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
563 |
"homepage": "https://symfony.com",
|
564 |
+
"keywords": [
|
565 |
+
"compatibility",
|
566 |
+
"polyfill",
|
567 |
+
"portable",
|
568 |
+
"shim"
|
569 |
+
],
|
570 |
+
"support": {
|
571 |
+
"source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0"
|
572 |
+
},
|
573 |
+
"funding": [
|
574 |
+
{
|
575 |
+
"url": "https://symfony.com/sponsor",
|
576 |
+
"type": "custom"
|
577 |
+
},
|
578 |
+
{
|
579 |
+
"url": "https://github.com/fabpot",
|
580 |
+
"type": "github"
|
581 |
+
},
|
582 |
+
{
|
583 |
+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
584 |
+
"type": "tidelift"
|
585 |
+
}
|
586 |
+
],
|
587 |
+
"time": "2022-05-10T07:21:04+00:00"
|
588 |
}
|
589 |
],
|
590 |
"packages-dev": [
|
635 |
"email": "mike.vanriel@naenius.com"
|
636 |
}
|
637 |
],
|
638 |
+
"support": {
|
639 |
+
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
|
640 |
+
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/2.x"
|
641 |
+
},
|
642 |
+
"time": "2016-01-25T08:17:30+00:00"
|
643 |
},
|
644 |
{
|
645 |
"name": "phpspec/prophecy",
|
646 |
+
"version": "v1.5.0",
|
647 |
"source": {
|
648 |
"type": "git",
|
649 |
"url": "https://github.com/phpspec/prophecy.git",
|
650 |
+
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7"
|
651 |
},
|
652 |
"dist": {
|
653 |
"type": "zip",
|
654 |
+
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7",
|
655 |
+
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7",
|
656 |
"shasum": ""
|
657 |
},
|
658 |
"require": {
|
659 |
"doctrine/instantiator": "^1.0.2",
|
660 |
+
"phpdocumentor/reflection-docblock": "~2.0",
|
661 |
+
"sebastian/comparator": "~1.1"
|
|
|
|
|
662 |
},
|
663 |
"require-dev": {
|
664 |
+
"phpspec/phpspec": "~2.0"
|
|
|
665 |
},
|
666 |
"type": "library",
|
667 |
"extra": {
|
668 |
"branch-alias": {
|
669 |
+
"dev-master": "1.4.x-dev"
|
670 |
}
|
671 |
},
|
672 |
"autoload": {
|
699 |
"spy",
|
700 |
"stub"
|
701 |
],
|
702 |
+
"support": {
|
703 |
+
"issues": "https://github.com/phpspec/prophecy/issues",
|
704 |
+
"source": "https://github.com/phpspec/prophecy/tree/master"
|
705 |
+
},
|
706 |
+
"time": "2015-08-13T10:07:40+00:00"
|
707 |
},
|
708 |
{
|
709 |
"name": "phpunit/php-code-coverage",
|
765 |
"testing",
|
766 |
"xunit"
|
767 |
],
|
768 |
+
"support": {
|
769 |
+
"irc": "irc://irc.freenode.net/phpunit",
|
770 |
+
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
771 |
+
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/2.2"
|
772 |
+
},
|
773 |
+
"time": "2015-10-06T15:47:00+00:00"
|
774 |
},
|
775 |
{
|
776 |
"name": "phpunit/php-file-iterator",
|
817 |
"filesystem",
|
818 |
"iterator"
|
819 |
],
|
820 |
+
"support": {
|
821 |
+
"irc": "irc://irc.freenode.net/phpunit",
|
822 |
+
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
|
823 |
+
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5"
|
824 |
+
},
|
825 |
+
"time": "2017-11-27T13:52:08+00:00"
|
826 |
},
|
827 |
{
|
828 |
"name": "phpunit/php-text-template",
|
863 |
"keywords": [
|
864 |
"template"
|
865 |
],
|
866 |
+
"support": {
|
867 |
+
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
|
868 |
+
"source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1"
|
869 |
+
},
|
870 |
+
"time": "2015-06-21T13:50:34+00:00"
|
871 |
},
|
872 |
{
|
873 |
"name": "phpunit/php-timer",
|
874 |
+
"version": "1.0.8",
|
875 |
"source": {
|
876 |
"type": "git",
|
877 |
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
878 |
+
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
|
879 |
},
|
880 |
"dist": {
|
881 |
"type": "zip",
|
882 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
|
883 |
+
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
|
884 |
"shasum": ""
|
885 |
},
|
886 |
"require": {
|
887 |
+
"php": ">=5.3.3"
|
888 |
},
|
889 |
"require-dev": {
|
890 |
+
"phpunit/phpunit": "~4|~5"
|
891 |
},
|
892 |
"type": "library",
|
|
|
|
|
|
|
|
|
|
|
893 |
"autoload": {
|
894 |
"classmap": [
|
895 |
"src/"
|
911 |
"keywords": [
|
912 |
"timer"
|
913 |
],
|
914 |
+
"support": {
|
915 |
+
"irc": "irc://irc.freenode.net/phpunit",
|
916 |
+
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
|
917 |
+
"source": "https://github.com/sebastianbergmann/php-timer/tree/master"
|
918 |
+
},
|
919 |
+
"time": "2016-05-12T18:03:57+00:00"
|
920 |
},
|
921 |
{
|
922 |
"name": "phpunit/php-token-stream",
|
965 |
"keywords": [
|
966 |
"tokenizer"
|
967 |
],
|
968 |
+
"support": {
|
969 |
+
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
|
970 |
+
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4"
|
971 |
+
},
|
972 |
+
"abandoned": true,
|
973 |
+
"time": "2017-12-04T08:55:13+00:00"
|
974 |
},
|
975 |
{
|
976 |
"name": "phpunit/phpunit",
|
1042 |
"testing",
|
1043 |
"xunit"
|
1044 |
],
|
1045 |
+
"support": {
|
1046 |
+
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
1047 |
+
"source": "https://github.com/sebastianbergmann/phpunit/tree/4.8.36"
|
1048 |
+
},
|
1049 |
+
"time": "2017-06-21T08:07:12+00:00"
|
1050 |
},
|
1051 |
{
|
1052 |
"name": "phpunit/phpunit-mock-objects",
|
1102 |
"mock",
|
1103 |
"xunit"
|
1104 |
],
|
1105 |
+
"support": {
|
1106 |
+
"irc": "irc://irc.freenode.net/phpunit",
|
1107 |
+
"issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues",
|
1108 |
+
"source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/2.3"
|
1109 |
+
},
|
1110 |
+
"abandoned": true,
|
1111 |
+
"time": "2015-10-02T06:51:40+00:00"
|
1112 |
},
|
1113 |
{
|
1114 |
"name": "sebastian/comparator",
|
1172 |
"compare",
|
1173 |
"equality"
|
1174 |
],
|
1175 |
+
"support": {
|
1176 |
+
"issues": "https://github.com/sebastianbergmann/comparator/issues",
|
1177 |
+
"source": "https://github.com/sebastianbergmann/comparator/tree/1.2"
|
1178 |
+
},
|
1179 |
+
"time": "2017-01-29T09:50:25+00:00"
|
1180 |
},
|
1181 |
{
|
1182 |
"name": "sebastian/diff",
|
1183 |
+
"version": "1.4.1",
|
1184 |
"source": {
|
1185 |
"type": "git",
|
1186 |
"url": "https://github.com/sebastianbergmann/diff.git",
|
1187 |
+
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
|
1188 |
},
|
1189 |
"dist": {
|
1190 |
"type": "zip",
|
1191 |
+
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
|
1192 |
+
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
|
1193 |
"shasum": ""
|
1194 |
},
|
1195 |
"require": {
|
1196 |
+
"php": ">=5.3.3"
|
1197 |
},
|
1198 |
"require-dev": {
|
1199 |
+
"phpunit/phpunit": "~4.8"
|
1200 |
},
|
1201 |
"type": "library",
|
1202 |
"extra": {
|
1228 |
"keywords": [
|
1229 |
"diff"
|
1230 |
],
|
1231 |
+
"support": {
|
1232 |
+
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
1233 |
+
"source": "https://github.com/sebastianbergmann/diff/tree/master"
|
1234 |
+
},
|
1235 |
+
"time": "2015-12-08T07:14:41+00:00"
|
1236 |
},
|
1237 |
{
|
1238 |
"name": "sebastian/environment",
|
1239 |
+
"version": "1.3.7",
|
1240 |
"source": {
|
1241 |
"type": "git",
|
1242 |
"url": "https://github.com/sebastianbergmann/environment.git",
|
1243 |
+
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
|
1244 |
},
|
1245 |
"dist": {
|
1246 |
"type": "zip",
|
1247 |
+
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
|
1248 |
+
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
|
1249 |
"shasum": ""
|
1250 |
},
|
1251 |
"require": {
|
1252 |
+
"php": ">=5.3.3"
|
1253 |
},
|
1254 |
"require-dev": {
|
1255 |
+
"phpunit/phpunit": "~4.4"
|
1256 |
},
|
1257 |
"type": "library",
|
1258 |
"extra": {
|
1282 |
"environment",
|
1283 |
"hhvm"
|
1284 |
],
|
1285 |
+
"support": {
|
1286 |
+
"issues": "https://github.com/sebastianbergmann/environment/issues",
|
1287 |
+
"source": "https://github.com/sebastianbergmann/environment/tree/1.3.7"
|
1288 |
+
},
|
1289 |
+
"time": "2016-05-17T03:18:57+00:00"
|
1290 |
},
|
1291 |
{
|
1292 |
"name": "sebastian/exporter",
|
1353 |
"export",
|
1354 |
"exporter"
|
1355 |
],
|
1356 |
+
"support": {
|
1357 |
+
"issues": "https://github.com/sebastianbergmann/exporter/issues",
|
1358 |
+
"source": "https://github.com/sebastianbergmann/exporter/tree/master"
|
1359 |
+
},
|
1360 |
+
"time": "2016-06-17T09:04:28+00:00"
|
1361 |
},
|
1362 |
{
|
1363 |
"name": "sebastian/global-state",
|
1408 |
"keywords": [
|
1409 |
"global state"
|
1410 |
],
|
1411 |
+
"support": {
|
1412 |
+
"issues": "https://github.com/sebastianbergmann/global-state/issues",
|
1413 |
+
"source": "https://github.com/sebastianbergmann/global-state/tree/1.1.1"
|
1414 |
+
},
|
1415 |
+
"time": "2015-10-12T03:26:01+00:00"
|
1416 |
},
|
1417 |
{
|
1418 |
"name": "sebastian/recursion-context",
|
1465 |
],
|
1466 |
"description": "Provides functionality to recursively process PHP variables",
|
1467 |
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1468 |
+
"support": {
|
1469 |
+
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
|
1470 |
+
"source": "https://github.com/sebastianbergmann/recursion-context/tree/master"
|
1471 |
+
},
|
1472 |
+
"time": "2016-10-03T07:41:43+00:00"
|
1473 |
},
|
1474 |
{
|
1475 |
"name": "sebastian/version",
|
1504 |
],
|
1505 |
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1506 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1507 |
+
"support": {
|
1508 |
+
"issues": "https://github.com/sebastianbergmann/version/issues",
|
1509 |
+
"source": "https://github.com/sebastianbergmann/version/tree/1.0.6"
|
1510 |
+
},
|
1511 |
+
"time": "2015-06-21T13:59:46+00:00"
|
1512 |
},
|
1513 |
{
|
1514 |
+
"name": "symfony/polyfill-ctype",
|
1515 |
+
"version": "v1.26.0",
|
1516 |
"source": {
|
1517 |
"type": "git",
|
1518 |
+
"url": "https://github.com/symfony/polyfill-ctype.git",
|
1519 |
+
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4"
|
1520 |
},
|
1521 |
"dist": {
|
1522 |
"type": "zip",
|
1523 |
+
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
|
1524 |
+
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
|
1525 |
"shasum": ""
|
1526 |
},
|
1527 |
"require": {
|
1528 |
+
"php": ">=7.1"
|
|
|
|
|
|
|
1529 |
},
|
1530 |
+
"provide": {
|
1531 |
+
"ext-ctype": "*"
|
1532 |
+
},
|
1533 |
+
"suggest": {
|
1534 |
+
"ext-ctype": "For best performance"
|
1535 |
},
|
|
|
|
|
|
|
|
|
1536 |
"type": "library",
|
1537 |
"extra": {
|
1538 |
"branch-alias": {
|
1539 |
+
"dev-main": "1.26-dev"
|
1540 |
+
},
|
1541 |
+
"thanks": {
|
1542 |
+
"name": "symfony/polyfill",
|
1543 |
+
"url": "https://github.com/symfony/polyfill"
|
1544 |
+
}
|
1545 |
+
},
|
1546 |
+
"autoload": {
|
1547 |
+
"files": [
|
1548 |
+
"bootstrap.php"
|
1549 |
+
],
|
1550 |
+
"psr-4": {
|
1551 |
+
"Symfony\\Polyfill\\Ctype\\": ""
|
1552 |
}
|
1553 |
},
|
1554 |
"notification-url": "https://packagist.org/downloads/",
|
1555 |
"license": [
|
1556 |
+
"MIT"
|
1557 |
],
|
1558 |
"authors": [
|
1559 |
{
|
1560 |
+
"name": "Gert de Pagter",
|
1561 |
+
"email": "BackEndTea@gmail.com"
|
1562 |
+
},
|
1563 |
+
{
|
1564 |
+
"name": "Symfony Community",
|
1565 |
+
"homepage": "https://symfony.com/contributors"
|
1566 |
}
|
1567 |
],
|
1568 |
+
"description": "Symfony polyfill for ctype functions",
|
1569 |
+
"homepage": "https://symfony.com",
|
1570 |
"keywords": [
|
1571 |
+
"compatibility",
|
1572 |
+
"ctype",
|
1573 |
+
"polyfill",
|
1574 |
+
"portable"
|
1575 |
+
],
|
1576 |
+
"support": {
|
1577 |
+
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0"
|
1578 |
+
},
|
1579 |
+
"funding": [
|
1580 |
+
{
|
1581 |
+
"url": "https://symfony.com/sponsor",
|
1582 |
+
"type": "custom"
|
1583 |
+
},
|
1584 |
+
{
|
1585 |
+
"url": "https://github.com/fabpot",
|
1586 |
+
"type": "github"
|
1587 |
+
},
|
1588 |
+
{
|
1589 |
+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
1590 |
+
"type": "tidelift"
|
1591 |
+
}
|
1592 |
],
|
1593 |
+
"time": "2022-05-24T11:49:31+00:00"
|
1594 |
},
|
1595 |
{
|
1596 |
"name": "symfony/yaml",
|
1597 |
+
"version": "v3.4.47",
|
1598 |
"source": {
|
1599 |
"type": "git",
|
1600 |
"url": "https://github.com/symfony/yaml.git",
|
1601 |
+
"reference": "88289caa3c166321883f67fe5130188ebbb47094"
|
1602 |
},
|
1603 |
"dist": {
|
1604 |
"type": "zip",
|
1605 |
+
"url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094",
|
1606 |
+
"reference": "88289caa3c166321883f67fe5130188ebbb47094",
|
1607 |
"shasum": ""
|
1608 |
},
|
1609 |
"require": {
|
1610 |
+
"php": "^5.5.9|>=7.0.8",
|
1611 |
+
"symfony/polyfill-ctype": "~1.8"
|
1612 |
},
|
1613 |
"conflict": {
|
1614 |
"symfony/console": "<3.4"
|
1620 |
"symfony/console": "For validating YAML files using the lint command"
|
1621 |
},
|
1622 |
"type": "library",
|
|
|
|
|
|
|
|
|
|
|
1623 |
"autoload": {
|
1624 |
"psr-4": {
|
1625 |
"Symfony\\Component\\Yaml\\": ""
|
1644 |
],
|
1645 |
"description": "Symfony Yaml Component",
|
1646 |
"homepage": "https://symfony.com",
|
1647 |
+
"support": {
|
1648 |
+
"source": "https://github.com/symfony/yaml/tree/v3.4.47"
|
1649 |
+
},
|
1650 |
+
"funding": [
|
1651 |
+
{
|
1652 |
+
"url": "https://symfony.com/sponsor",
|
1653 |
+
"type": "custom"
|
1654 |
+
},
|
1655 |
+
{
|
1656 |
+
"url": "https://github.com/fabpot",
|
1657 |
+
"type": "github"
|
1658 |
+
},
|
1659 |
+
{
|
1660 |
+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
1661 |
+
"type": "tidelift"
|
1662 |
+
}
|
1663 |
+
],
|
1664 |
+
"time": "2020-10-24T10:57:07+00:00"
|
1665 |
}
|
1666 |
],
|
1667 |
"aliases": [],
|
1668 |
"minimum-stability": "stable",
|
1669 |
+
"stability-flags": {
|
1670 |
+
"facebook/facebook-instant-articles-sdk-php": 20
|
1671 |
+
},
|
1672 |
"prefer-stable": false,
|
1673 |
"prefer-lowest": false,
|
1674 |
"platform": {
|
1675 |
+
"php": "^5.4 || ^7.0 || ^8.0"
|
1676 |
},
|
1677 |
+
"platform-dev": [],
|
1678 |
+
"plugin-api-version": "2.0.0"
|
1679 |
}
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/examples/quiet_logger.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
\Logger::configure(
|
4 |
-
[
|
5 |
-
'rootLogger' => [
|
6 |
-
'appenders' => ['facebook-instantarticles-traverser']
|
7 |
-
],
|
8 |
-
'appenders' => [
|
9 |
-
'facebook-instantarticles-traverser' => [
|
10 |
-
'class' => 'LoggerAppenderConsole',
|
11 |
-
'threshold' => 'INFO',
|
12 |
-
'layout' => [
|
13 |
-
'class' => 'LoggerLayoutSimple'
|
14 |
-
]
|
15 |
-
]
|
16 |
-
]
|
17 |
-
]
|
18 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/AMPHeader.php
CHANGED
@@ -79,7 +79,7 @@ class AMPHeader
|
|
79 |
foreach ($authorsElement as $author) {
|
80 |
$authorsString[] = $author->getName();
|
81 |
}
|
82 |
-
$authors->appendChild($this->context->getDocument()->createTextNode('By '.implode(
|
83 |
$this->context->buildSpacingDiv($this->header);
|
84 |
}
|
85 |
|
79 |
foreach ($authorsElement as $author) {
|
80 |
$authorsString[] = $author->getName();
|
81 |
}
|
82 |
+
$authors->appendChild($this->context->getDocument()->createTextNode('By '.implode(', ', $authorsString)));
|
83 |
$this->context->buildSpacingDiv($this->header);
|
84 |
}
|
85 |
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/AMP/configuration/global.amp.css
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
/*
|
|
|
2 |
.ia2amp-header-bar {
|
3 |
margin: -5px 0 0 0;
|
4 |
height: 55px;
|
1 |
+
/* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. */
|
2 |
+
/* Global Styles */
|
3 |
.ia2amp-header-bar {
|
4 |
margin: -5px 0 0 0;
|
5 |
height: 55px;
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/src/Facebook/InstantArticles/Utils/Observer.php
CHANGED
@@ -150,8 +150,9 @@ class Observer
|
|
150 |
if (!isset($this->callbacks[$tag])) {
|
151 |
return $value;
|
152 |
}
|
153 |
-
|
154 |
// Uses this to be compatible with PHP < 5.6
|
|
|
155 |
$args = func_get_args();
|
156 |
|
157 |
// Removes the $tag, since this is not an expected parameter to callbacks.
|
150 |
if (!isset($this->callbacks[$tag])) {
|
151 |
return $value;
|
152 |
}
|
153 |
+
|
154 |
// Uses this to be compatible with PHP < 5.6
|
155 |
+
// phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection -- $tag wasn't changed.
|
156 |
$args = func_get_args();
|
157 |
|
158 |
// Removes the $tag, since this is not an expected parameter to callbacks.
|
vendor/facebook/facebook-instant-articles-sdk-extensions-in-php/tests/Facebook/InstantArticles/AMP/default.amp-custom.css
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
/*
|
2 |
Custom CSS for default style goes here
|
3 |
*/
|
1 |
+
/* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. */
|
2 |
/*
|
3 |
Custom CSS for default style goes here
|
4 |
*/
|
vendor/facebook/facebook-instant-articles-sdk-php/.circleci/config.yml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: 2
|
2 |
+
|
3 |
+
jobs:
|
4 |
+
build:
|
5 |
+
docker:
|
6 |
+
- image: circleci/php:7.4
|
7 |
+
steps:
|
8 |
+
- checkout
|
9 |
+
- run: composer install --prefer-source --no-interaction
|
10 |
+
- run: ./vendor/bin/phpunit
|
11 |
+
- run: ./vendor/bin/phpcs --standard=phpcs.xml -p
|
12 |
+
|
13 |
+
workflows:
|
14 |
+
version: 2
|
15 |
+
test:
|
16 |
+
jobs:
|
17 |
+
- build
|
18 |
+
|
vendor/facebook/facebook-instant-articles-sdk-php/.travis.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
# Fix TravisCI, add github token
|
2 |
-
language: php
|
3 |
-
|
4 |
-
env:
|
5 |
-
- GITHUB_TOKEN=fbc9f8b635109c0c7ad64013ff8346908389f5f9
|
6 |
-
|
7 |
-
matrix:
|
8 |
-
include:
|
9 |
-
- php: 5.4
|
10 |
-
- php: 5.5
|
11 |
-
- php: 5.6
|
12 |
-
- php: 7
|
13 |
-
- php: 7.1
|
14 |
-
env: WITH_CS=true GITHUB_TOKEN=fbc9f8b635109c0c7ad64013ff8346908389f5f9
|
15 |
-
|
16 |
-
cache:
|
17 |
-
directories:
|
18 |
-
- $HOME/.composer/cache
|
19 |
-
|
20 |
-
before_install:
|
21 |
-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi
|
22 |
-
- travis_retry composer self-update
|
23 |
-
- composer validate
|
24 |
-
|
25 |
-
install:
|
26 |
-
- travis_retry composer install --no-interaction --prefer-dist
|
27 |
-
|
28 |
-
script:
|
29 |
-
- vendor/bin/phpunit
|
30 |
-
- if [[ "$WITH_CS" == "true" ]]; then vendor/bin/phpcs --standard=phpcs.xml -p; fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
# Facebook Instant Articles PHP SDK #
|
2 |
|
3 |
-
[![
|
4 |
[![Latest Stable Version](https://poser.pugx.org/facebook/facebook-instant-articles-sdk-php/v/stable)](https://packagist.org/packages/facebook/facebook-instant-articles-sdk-php)
|
5 |
|
6 |
The Facebook Instant Articles SDK for PHP provides a native interface for creating and publishing Instant Articles. The SDK enables developers to more easily integrate Instant Articles into content management systems and in turn enables journalist and publishers to easily publish Instant Articles.
|
@@ -89,3 +89,8 @@ If you are encountering problems, the following tips may help in troubleshooting
|
|
89 |
## License
|
90 |
|
91 |
Please see the [license file](https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/LICENSE) for more information.
|
|
|
|
|
|
|
|
|
|
1 |
# Facebook Instant Articles PHP SDK #
|
2 |
|
3 |
+
[![CircleCI](https://circleci.com/gh/facebook/facebook-instant-articles-sdk-php.svg?style=shield)](https://circleci.com/gh/facebook/facebook-instant-articles-sdk-php)
|
4 |
[![Latest Stable Version](https://poser.pugx.org/facebook/facebook-instant-articles-sdk-php/v/stable)](https://packagist.org/packages/facebook/facebook-instant-articles-sdk-php)
|
5 |
|
6 |
The Facebook Instant Articles SDK for PHP provides a native interface for creating and publishing Instant Articles. The SDK enables developers to more easily integrate Instant Articles into content management systems and in turn enables journalist and publishers to easily publish Instant Articles.
|
89 |
## License
|
90 |
|
91 |
Please see the [license file](https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/LICENSE) for more information.
|
92 |
+
|
93 |
+
## Legal
|
94 |
+
|
95 |
+
* [Privacy](https://opensource.facebook.com/legal/privacy/)
|
96 |
+
* [Terms](https://opensource.facebook.com/legal/terms/)
|
vendor/facebook/facebook-instant-articles-sdk-php/composer.json
CHANGED
@@ -9,17 +9,24 @@
|
|
9 |
"name": "Facebook",
|
10 |
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php/contributors"
|
11 |
}],
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
"require": {
|
13 |
-
"php": "
|
14 |
"symfony/css-selector": "^2.8 || ^3.1 || ^4.1",
|
15 |
-
"facebook/graph-sdk": "
|
16 |
},
|
17 |
"require-dev": {
|
18 |
-
"fzaninotto/faker": "
|
19 |
"phpunit/phpunit": "4.8.*",
|
20 |
-
"symfony/yaml": "2.1.*",
|
21 |
-
"phpdocumentor/reflection-docblock": "^2.0",
|
22 |
-
"squizlabs/php_codesniffer": "^2.6.0"
|
|
|
23 |
},
|
24 |
"autoload": {
|
25 |
"psr-4": {
|
9 |
"name": "Facebook",
|
10 |
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php/contributors"
|
11 |
}],
|
12 |
+
"repositories": [
|
13 |
+
{
|
14 |
+
"type": "vcs",
|
15 |
+
"url": "https://github.com/whyisjake/php-graph-sdk"
|
16 |
+
}
|
17 |
+
],
|
18 |
"require": {
|
19 |
+
"php": ">=5.4",
|
20 |
"symfony/css-selector": "^2.8 || ^3.1 || ^4.1",
|
21 |
+
"facebook/graph-sdk": "dev-php8"
|
22 |
},
|
23 |
"require-dev": {
|
24 |
+
"fzaninotto/faker": "dev-master",
|
25 |
"phpunit/phpunit": "4.8.*",
|
26 |
+
"symfony/yaml": "2.1.* || 3.4.*",
|
27 |
+
"phpdocumentor/reflection-docblock": "^2.0 || ^4.0",
|
28 |
+
"squizlabs/php_codesniffer": "^2.6.0 || ^3.0.0",
|
29 |
+
"phpcompatibility/phpcompatibility-wp": "^2.1"
|
30 |
},
|
31 |
"autoload": {
|
32 |
"psr-4": {
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Author.php
CHANGED
@@ -173,7 +173,7 @@ class Author extends Element
|
|
173 |
$document = new \DOMDocument();
|
174 |
}
|
175 |
|
176 |
-
$author_url = $this->url ? $this->url :
|
177 |
$is_fb_author = strpos($author_url, 'facebook.com') !== false;
|
178 |
|
179 |
// Creates the root tag <address></address>
|
@@ -194,7 +194,9 @@ class Author extends Element
|
|
194 |
$element->appendChild($ahref);
|
195 |
|
196 |
// Appends author description
|
197 |
-
|
|
|
|
|
198 |
|
199 |
return $element;
|
200 |
}
|
173 |
$document = new \DOMDocument();
|
174 |
}
|
175 |
|
176 |
+
$author_url = $this->url ? $this->url : '';
|
177 |
$is_fb_author = strpos($author_url, 'facebook.com') !== false;
|
178 |
|
179 |
// Creates the root tag <address></address>
|
194 |
$element->appendChild($ahref);
|
195 |
|
196 |
// Appends author description
|
197 |
+
if ($this->description !== null) {
|
198 |
+
$element->appendChild($document->createTextNode($this->description));
|
199 |
+
}
|
200 |
|
201 |
return $element;
|
202 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Container.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
-
* All rights reserved.
|
5 |
-
*
|
6 |
-
* This source code is licensed under the license found in the
|
7 |
-
* LICENSE file in the root directory of this source tree.
|
8 |
-
*/
|
9 |
-
namespace Facebook\InstantArticles\Elements;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Interface Container
|
13 |
-
* This interface specifies the navigatable objects that have children.
|
14 |
-
*/
|
15 |
-
interface Container
|
16 |
-
{
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Must return an array of Element typed objects.
|
20 |
-
* To navigate thru the Container object tree, always check if it is a Container.
|
21 |
-
* <code>
|
22 |
-
* if (Type::is($object, Container::getClassName())) {
|
23 |
-
* foreach($object->getChildren() as $child) {
|
24 |
-
* //$child operations
|
25 |
-
* }
|
26 |
-
* }
|
27 |
-
* </code>
|
28 |
-
*
|
29 |
-
* @return array(<Element>) All implementing classes returns an array of Elements.
|
30 |
-
*/
|
31 |
-
public function getContainerChildren();
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Auxiliary method to extract all Elements full qualified class name.
|
35 |
-
*
|
36 |
-
* @return string The full qualified name of class
|
37 |
-
*/
|
38 |
-
public static function getClassName();
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php
CHANGED
@@ -34,7 +34,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
34 |
|
35 |
class InstantArticle extends Element implements ChildrenContainer, InstantArticleInterface
|
36 |
{
|
37 |
-
const CURRENT_VERSION = '1.10.
|
38 |
|
39 |
/**
|
40 |
* The meta properties that are used on <head>
|
@@ -478,6 +478,14 @@ class InstantArticle extends Element implements ChildrenContainer, InstantArticl
|
|
478 |
return $this;
|
479 |
}
|
480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
public function render($doctype = '<!doctype html>', $format = false, $validate = true)
|
482 |
{
|
483 |
$doctype = is_null($doctype) ? '<!doctype html>' : $doctype;
|
34 |
|
35 |
class InstantArticle extends Element implements ChildrenContainer, InstantArticleInterface
|
36 |
{
|
37 |
+
const CURRENT_VERSION = '1.10.2';
|
38 |
|
39 |
/**
|
40 |
* The meta properties that are used on <head>
|
478 |
return $this;
|
479 |
}
|
480 |
|
481 |
+
public function getMetaProperty($property_name)
|
482 |
+
{
|
483 |
+
if (array_key_exists($property_name, $this->metaProperties)) {
|
484 |
+
return $this->metaProperties[$property_name];
|
485 |
+
}
|
486 |
+
return null;
|
487 |
+
}
|
488 |
+
|
489 |
public function render($doctype = '<!doctype html>', $format = false, $validate = true)
|
490 |
{
|
491 |
$doctype = is_null($doctype) ? '<!doctype html>' : $doctype;
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/FragmentGetter.php
CHANGED
File without changes
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/JSONGetter.php
CHANGED
File without changes
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php
CHANGED
File without changes
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingElementGetter.php
CHANGED
File without changes
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Compat/JetpackSlideshowRule.php
CHANGED
File without changes
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveInsideParagraphRule.php
CHANGED
File without changes
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php
CHANGED
@@ -246,7 +246,7 @@ class Transformer
|
|
246 |
$libxml_previous_state = libxml_use_internal_errors(true);
|
247 |
$document = new \DOMDocument('1.0');
|
248 |
if (function_exists('mb_convert_encoding')) {
|
249 |
-
$document->loadHTML(mb_convert_encoding($content, '
|
250 |
} else {
|
251 |
$this->addLog(
|
252 |
TransformerLog::DEBUG,
|
@@ -263,9 +263,6 @@ class Transformer
|
|
263 |
libxml_clear_errors();
|
264 |
libxml_use_internal_errors($libxml_previous_state);
|
265 |
$result = $this->transform($context, $document);
|
266 |
-
if (Type::is($result, InstantArticle::getClassName())) {
|
267 |
-
$result = $this->handleTransformationSettings($result);
|
268 |
-
}
|
269 |
$totalTime = round(microtime(true) - $start, 3)*1000;
|
270 |
$totalWarnings = count($this->getWarnings());
|
271 |
$this->addLog(
|
@@ -278,15 +275,16 @@ class Transformer
|
|
278 |
/**
|
279 |
* @param InstantArticle $context
|
280 |
* @param \DOMNode $node
|
281 |
-
* @deprecated Use @see Transformer::transformString instead.
|
282 |
*
|
283 |
* @return mixed
|
284 |
*/
|
285 |
public function transform($context, $node)
|
286 |
{
|
287 |
-
|
|
|
288 |
$context->addMetaProperty('op:generator:transformer', 'facebook-instant-articles-sdk-php');
|
289 |
$context->addMetaProperty('op:generator:transformer:version', InstantArticle::CURRENT_VERSION);
|
|
|
290 |
$this->instantArticle = $context;
|
291 |
}
|
292 |
|
@@ -375,6 +373,10 @@ class Transformer
|
|
375 |
}
|
376 |
}
|
377 |
|
|
|
|
|
|
|
|
|
378 |
return $context;
|
379 |
}
|
380 |
|
246 |
$libxml_previous_state = libxml_use_internal_errors(true);
|
247 |
$document = new \DOMDocument('1.0');
|
248 |
if (function_exists('mb_convert_encoding')) {
|
249 |
+
$document->loadHTML(htmlspecialchars_decode(htmlentities(mb_convert_encoding($content, 'UTF-8', $encoding), ENT_NOQUOTES)));
|
250 |
} else {
|
251 |
$this->addLog(
|
252 |
TransformerLog::DEBUG,
|
263 |
libxml_clear_errors();
|
264 |
libxml_use_internal_errors($libxml_previous_state);
|
265 |
$result = $this->transform($context, $document);
|
|
|
|
|
|
|
266 |
$totalTime = round(microtime(true) - $start, 3)*1000;
|
267 |
$totalWarnings = count($this->getWarnings());
|
268 |
$this->addLog(
|
275 |
/**
|
276 |
* @param InstantArticle $context
|
277 |
* @param \DOMNode $node
|
|
|
278 |
*
|
279 |
* @return mixed
|
280 |
*/
|
281 |
public function transform($context, $node)
|
282 |
{
|
283 |
+
$is_first_run = false;
|
284 |
+
if (Type::is($context, InstantArticle::getClassName()) && $context->getMetaProperty('op:generator:transformer') === null) {
|
285 |
$context->addMetaProperty('op:generator:transformer', 'facebook-instant-articles-sdk-php');
|
286 |
$context->addMetaProperty('op:generator:transformer:version', InstantArticle::CURRENT_VERSION);
|
287 |
+
$is_first_run = true;
|
288 |
$this->instantArticle = $context;
|
289 |
}
|
290 |
|
373 |
}
|
374 |
}
|
375 |
|
376 |
+
if ($is_first_run) {
|
377 |
+
$context = $this->handleTransformationSettings($context);
|
378 |
+
}
|
379 |
+
|
380 |
return $context;
|
381 |
}
|
382 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php
CHANGED
@@ -14,7 +14,7 @@ use Facebook\InstantArticles\Transformer\Rules\ConfigurationSelectorRule;
|
|
14 |
/**
|
15 |
* Class InvalidSelector warning to show that an invalid selector for a required property was used
|
16 |
*/
|
17 |
-
class InvalidSelector
|
18 |
{
|
19 |
/**
|
20 |
* @var string
|
@@ -26,11 +26,6 @@ class InvalidSelector
|
|
26 |
*/
|
27 |
private $context;
|
28 |
|
29 |
-
/**
|
30 |
-
* @var \DOMNode
|
31 |
-
*/
|
32 |
-
private $node;
|
33 |
-
|
34 |
/**
|
35 |
* @var ConfigurationSelectorRule
|
36 |
*/
|
@@ -44,9 +39,9 @@ class InvalidSelector
|
|
44 |
*/
|
45 |
public function __construct($fields, $context, $node, $rule)
|
46 |
{
|
|
|
47 |
$this->fields = $fields;
|
48 |
$this->context = $context;
|
49 |
-
$this->node = $node;
|
50 |
$this->rule = $rule;
|
51 |
}
|
52 |
|
@@ -95,12 +90,12 @@ class InvalidSelector
|
|
95 |
{
|
96 |
return $this->context;
|
97 |
}
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
public function
|
103 |
{
|
104 |
-
return $this->
|
105 |
}
|
106 |
}
|
14 |
/**
|
15 |
* Class InvalidSelector warning to show that an invalid selector for a required property was used
|
16 |
*/
|
17 |
+
class InvalidSelector extends Warning
|
18 |
{
|
19 |
/**
|
20 |
* @var string
|
26 |
*/
|
27 |
private $context;
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* @var ConfigurationSelectorRule
|
31 |
*/
|
39 |
*/
|
40 |
public function __construct($fields, $context, $node, $rule)
|
41 |
{
|
42 |
+
parent::__construct($node);
|
43 |
$this->fields = $fields;
|
44 |
$this->context = $context;
|
|
|
45 |
$this->rule = $rule;
|
46 |
}
|
47 |
|
90 |
{
|
91 |
return $this->context;
|
92 |
}
|
93 |
+
public function getFields()
|
94 |
+
{
|
95 |
+
return $this->fields;
|
96 |
+
}
|
97 |
+
public function getRule()
|
98 |
{
|
99 |
+
return $this->rule;
|
100 |
}
|
101 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/NoRootInstantArticleFoundWarning.php
CHANGED
@@ -11,18 +11,13 @@ namespace Facebook\InstantArticles\Transformer\Warnings;
|
|
11 |
use Facebook\InstantArticles\Elements\Element;
|
12 |
use Facebook\InstantArticles\Validators\Type;
|
13 |
|
14 |
-
class NoRootInstantArticleFoundWarning
|
15 |
{
|
16 |
/**
|
17 |
* @var Element
|
18 |
*/
|
19 |
private $element;
|
20 |
|
21 |
-
/**
|
22 |
-
* @var DOMNode
|
23 |
-
*/
|
24 |
-
private $node;
|
25 |
-
|
26 |
/**
|
27 |
* @var array the configuration content
|
28 |
*/
|
@@ -34,8 +29,8 @@ class NoRootInstantArticleFoundWarning
|
|
34 |
*/
|
35 |
public function __construct($element, $node = null)
|
36 |
{
|
|
|
37 |
$this->element = $element;
|
38 |
-
$this->node = $node;
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -54,13 +49,6 @@ class NoRootInstantArticleFoundWarning
|
|
54 |
return $this->element;
|
55 |
}
|
56 |
|
57 |
-
/**
|
58 |
-
* @return DOMNode
|
59 |
-
*/
|
60 |
-
public function getNode()
|
61 |
-
{
|
62 |
-
return $this->node;
|
63 |
-
}
|
64 |
|
65 |
private function formatWarningMessage()
|
66 |
{
|
11 |
use Facebook\InstantArticles\Elements\Element;
|
12 |
use Facebook\InstantArticles\Validators\Type;
|
13 |
|
14 |
+
class NoRootInstantArticleFoundWarning extends Warning
|
15 |
{
|
16 |
/**
|
17 |
* @var Element
|
18 |
*/
|
19 |
private $element;
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
/**
|
22 |
* @var array the configuration content
|
23 |
*/
|
29 |
*/
|
30 |
public function __construct($element, $node = null)
|
31 |
{
|
32 |
+
parent::__construct($node);
|
33 |
$this->element = $element;
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
49 |
return $this->element;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
private function formatWarningMessage()
|
54 |
{
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/UnrecognizedElement.php
CHANGED
@@ -11,28 +11,21 @@ namespace Facebook\InstantArticles\Transformer\Warnings;
|
|
11 |
use Facebook\InstantArticles\Elements\Element;
|
12 |
use Facebook\InstantArticles\Validators\Type;
|
13 |
|
14 |
-
class UnrecognizedElement
|
15 |
{
|
16 |
/**
|
17 |
* @var Element
|
18 |
*/
|
19 |
private $context;
|
20 |
|
21 |
-
/**
|
22 |
-
* @var \DOMNode
|
23 |
-
*/
|
24 |
-
private $node;
|
25 |
-
|
26 |
/**
|
27 |
* @param Element $context
|
28 |
* @param \DOMNode $node
|
29 |
*/
|
30 |
public function __construct($context, $node)
|
31 |
{
|
|
|
32 |
$this->context = $context;
|
33 |
-
if ($node) {
|
34 |
-
$this->node = $node->cloneNode();
|
35 |
-
}
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -68,12 +61,4 @@ class UnrecognizedElement
|
|
68 |
{
|
69 |
return $this->context;
|
70 |
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* @return \DOMNode
|
74 |
-
*/
|
75 |
-
public function getNode()
|
76 |
-
{
|
77 |
-
return $this->node;
|
78 |
-
}
|
79 |
}
|
11 |
use Facebook\InstantArticles\Elements\Element;
|
12 |
use Facebook\InstantArticles\Validators\Type;
|
13 |
|
14 |
+
class UnrecognizedElement extends Warning
|
15 |
{
|
16 |
/**
|
17 |
* @var Element
|
18 |
*/
|
19 |
private $context;
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
/**
|
22 |
* @param Element $context
|
23 |
* @param \DOMNode $node
|
24 |
*/
|
25 |
public function __construct($context, $node)
|
26 |
{
|
27 |
+
parent::__construct($node ? $node->cloneNode() : null);
|
28 |
$this->context = $context;
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
/**
|
61 |
{
|
62 |
return $this->context;
|
63 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/ValidatorWarning.php
CHANGED
@@ -11,18 +11,13 @@ namespace Facebook\InstantArticles\Transformer\Warnings;
|
|
11 |
use Facebook\InstantArticles\Elements\Element;
|
12 |
use Facebook\InstantArticles\Validators\Type;
|
13 |
|
14 |
-
class ValidatorWarning
|
15 |
{
|
16 |
/**
|
17 |
* @var Element
|
18 |
*/
|
19 |
private $element;
|
20 |
|
21 |
-
/**
|
22 |
-
* @var DOMNode
|
23 |
-
*/
|
24 |
-
private $node;
|
25 |
-
|
26 |
/**
|
27 |
* @var array the configuration content
|
28 |
*/
|
@@ -34,8 +29,8 @@ class ValidatorWarning
|
|
34 |
*/
|
35 |
public function __construct($element, $node = null)
|
36 |
{
|
|
|
37 |
$this->element = $element;
|
38 |
-
$this->node = $node;
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -54,14 +49,6 @@ class ValidatorWarning
|
|
54 |
return $this->element;
|
55 |
}
|
56 |
|
57 |
-
/**
|
58 |
-
* @return DOMNode
|
59 |
-
*/
|
60 |
-
public function getNode()
|
61 |
-
{
|
62 |
-
return $this->node;
|
63 |
-
}
|
64 |
-
|
65 |
private function formatWarningMessage()
|
66 |
{
|
67 |
$object = Type::stringify($this->element);
|
11 |
use Facebook\InstantArticles\Elements\Element;
|
12 |
use Facebook\InstantArticles\Validators\Type;
|
13 |
|
14 |
+
class ValidatorWarning extends Warning
|
15 |
{
|
16 |
/**
|
17 |
* @var Element
|
18 |
*/
|
19 |
private $element;
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
/**
|
22 |
* @var array the configuration content
|
23 |
*/
|
29 |
*/
|
30 |
public function __construct($element, $node = null)
|
31 |
{
|
32 |
+
parent::__construct($node);
|
33 |
$this->element = $element;
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
49 |
return $this->element;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
private function formatWarningMessage()
|
53 |
{
|
54 |
$object = Type::stringify($this->element);
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/Warning.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Transformer\Warnings;
|
10 |
+
|
11 |
+
use Facebook\InstantArticles\Elements\Element;
|
12 |
+
use Facebook\InstantArticles\Validators\Type;
|
13 |
+
|
14 |
+
abstract class Warning
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @var DOMNode
|
18 |
+
*/
|
19 |
+
protected $node;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
protected $selector;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
abstract public function __toString();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param DOMNode $node
|
33 |
+
* @param string $selector
|
34 |
+
*/
|
35 |
+
public function __construct($node)
|
36 |
+
{
|
37 |
+
$this->node = $node;
|
38 |
+
$this->selector = $this->getCSSSelector();
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
public function getCSSSelector()
|
46 |
+
{
|
47 |
+
if ($this->node) {
|
48 |
+
if (Type::is($this->node, 'DOMElement')) {
|
49 |
+
$id = $this->node->getAttribute('id');
|
50 |
+
if ($id) {
|
51 |
+
return "#$id";
|
52 |
+
}
|
53 |
+
$class = $this->node->getAttribute('class');
|
54 |
+
if ($class) {
|
55 |
+
return $this->node->nodeName . "." . str_replace(" ", ".", $class);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
if (!Type::is($this->node, 'DOMText')) {
|
59 |
+
return $this->node->nodeName;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
return '';
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @return DOMNode
|
67 |
+
*/
|
68 |
+
public function getNode()
|
69 |
+
{
|
70 |
+
return $this->node;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public function getSelector()
|
77 |
+
{
|
78 |
+
return $this->selector;
|
79 |
+
}
|
80 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/ClientExceptionTest.php
CHANGED
@@ -1,5 +1,11 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
namespace Facebook\InstantArticles\Client;
|
4 |
|
5 |
use PHPUnit\Framework\TestCase;
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
namespace Facebook\InstantArticles\Client;
|
10 |
|
11 |
use PHPUnit\Framework\TestCase;
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/SimpleTransformerTest.php
CHANGED
@@ -24,7 +24,12 @@ class SimpleTransformerTest extends BaseHTMLTestCase
|
|
24 |
|
25 |
$html_file = file_get_contents(__DIR__ . '/simple.html');
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
28 |
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
29 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
30 |
$result = $instant_article->render('', true)."\n";
|
24 |
|
25 |
$html_file = file_get_contents(__DIR__ . '/simple.html');
|
26 |
|
27 |
+
libxml_use_internal_errors(true);
|
28 |
+
$document = new \DOMDocument();
|
29 |
+
$document->loadHTML($html_file);
|
30 |
+
libxml_use_internal_errors(false);
|
31 |
+
|
32 |
+
$transformer->transform($instant_article, $document);
|
33 |
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
34 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
35 |
$result = $instant_article->render('', true)."\n";
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Warnings/WarningTest.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Transformer\Warnings;
|
10 |
+
|
11 |
+
use PHPUnit\Framework\TestCase;
|
12 |
+
|
13 |
+
class WarningTest extends TestCase
|
14 |
+
{
|
15 |
+
public function testWarningElementSelector()
|
16 |
+
{
|
17 |
+
$document = new \DOMDocument();
|
18 |
+
$node = $document->createElement('img');
|
19 |
+
$expected = 'img';
|
20 |
+
|
21 |
+
$warningInvalidSelector = new InvalidSelector('field a and b', null, $node, null);
|
22 |
+
$warningoRootInstantArticleFound = new NoRootInstantArticleFoundWarning($node, $node);
|
23 |
+
$warningUnrecognizedElement = new UnrecognizedElement(null, $node);
|
24 |
+
$warningValidator = new ValidatorWarning($node, $node);
|
25 |
+
|
26 |
+
$this->assertEquals($expected, $warningInvalidSelector->getSelector());
|
27 |
+
$this->assertEquals($expected, $warningoRootInstantArticleFound->getSelector());
|
28 |
+
$this->assertEquals($expected, $warningUnrecognizedElement->getSelector());
|
29 |
+
$this->assertEquals($expected, $warningValidator->getSelector());
|
30 |
+
}
|
31 |
+
|
32 |
+
public function testWarningClassSelector()
|
33 |
+
{
|
34 |
+
$document = new \DOMDocument();
|
35 |
+
$node = $document->createElement('img');
|
36 |
+
$node->setAttribute('class', 'someClass');
|
37 |
+
$expected = 'img.someClass';
|
38 |
+
|
39 |
+
$warningInvalidSelector = new InvalidSelector('field a and b', null, $node, null);
|
40 |
+
$warningoRootInstantArticleFound = new NoRootInstantArticleFoundWarning($node, $node);
|
41 |
+
$warningUnrecognizedElement = new UnrecognizedElement(null, $node);
|
42 |
+
$warningValidator = new ValidatorWarning($node, $node);
|
43 |
+
|
44 |
+
$this->assertEquals($expected, $warningInvalidSelector->getSelector());
|
45 |
+
$this->assertEquals($expected, $warningoRootInstantArticleFound->getSelector());
|
46 |
+
$this->assertEquals($expected, $warningUnrecognizedElement->getSelector());
|
47 |
+
$this->assertEquals($expected, $warningValidator->getSelector());
|
48 |
+
}
|
49 |
+
|
50 |
+
public function testWarningIDSelector()
|
51 |
+
{
|
52 |
+
$document = new \DOMDocument();
|
53 |
+
$node = $document->createElement('img');
|
54 |
+
$node->setAttribute('id', 'myID');
|
55 |
+
$expected = '#myID';
|
56 |
+
|
57 |
+
$warningInvalidSelector = new InvalidSelector('field a and b', null, $node, null);
|
58 |
+
$warningoRootInstantArticleFound = new NoRootInstantArticleFoundWarning($node, $node);
|
59 |
+
$warningUnrecognizedElement = new UnrecognizedElement(null, $node);
|
60 |
+
$warningValidator = new ValidatorWarning($node, $node);
|
61 |
+
|
62 |
+
$this->assertEquals($expected, $warningInvalidSelector->getSelector());
|
63 |
+
$this->assertEquals($expected, $warningoRootInstantArticleFound->getSelector());
|
64 |
+
$this->assertEquals($expected, $warningUnrecognizedElement->getSelector());
|
65 |
+
$this->assertEquals($expected, $warningValidator->getSelector());
|
66 |
+
}
|
67 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example-multibyte.html
CHANGED
File without changes
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example-nonutf8.html
CHANGED
File without changes
|
vendor/facebook/graph-sdk/LICENSE
CHANGED
File without changes
|
vendor/facebook/graph-sdk/composer.json
CHANGED
@@ -12,12 +12,13 @@
|
|
12 |
}
|
13 |
],
|
14 |
"require": {
|
15 |
-
"php": "
|
16 |
},
|
17 |
"require-dev": {
|
18 |
"phpunit/phpunit": "~4.0",
|
19 |
"mockery/mockery": "~0.8",
|
20 |
-
"guzzlehttp/guzzle": "~5.0"
|
|
|
21 |
},
|
22 |
"suggest": {
|
23 |
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5",
|
12 |
}
|
13 |
],
|
14 |
"require": {
|
15 |
+
"php": ">=5.4"
|
16 |
},
|
17 |
"require-dev": {
|
18 |
"phpunit/phpunit": "~4.0",
|
19 |
"mockery/mockery": "~0.8",
|
20 |
+
"guzzlehttp/guzzle": "~5.0",
|
21 |
+
"phpcompatibility/phpcompatibility-wp": "^2.1"
|
22 |
},
|
23 |
"suggest": {
|
24 |
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5",
|
vendor/facebook/{facebook-instant-articles-sdk-php → graph-sdk}/composer.lock
RENAMED
@@ -1,184 +1,269 @@
|
|
1 |
{
|
2 |
"_readme": [
|
3 |
"This file locks the dependencies of your project to a known state",
|
4 |
-
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
-
"content-hash": "
|
8 |
"packages": [
|
9 |
{
|
10 |
-
"name": "
|
11 |
-
"version": "
|
12 |
"source": {
|
13 |
"type": "git",
|
14 |
-
"url": "https://
|
15 |
-
"reference": "
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
},
|
17 |
"require": {
|
18 |
-
"php": ">=5.
|
|
|
19 |
},
|
20 |
-
"
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
},
|
|
|
26 |
"notification-url": "https://packagist.org/downloads/",
|
27 |
"license": [
|
28 |
-
"
|
29 |
],
|
30 |
-
"
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
"keywords": [
|
33 |
-
"
|
34 |
-
"
|
35 |
-
"
|
36 |
],
|
37 |
-
"
|
|
|
|
|
|
|
|
|
38 |
},
|
39 |
{
|
40 |
-
"name": "
|
41 |
-
"version": "
|
42 |
"source": {
|
43 |
"type": "git",
|
44 |
-
"url": "https://github.com/
|
45 |
-
"reference": "
|
46 |
},
|
47 |
"dist": {
|
48 |
"type": "zip",
|
49 |
-
"url": "https://api.github.com/repos/
|
50 |
-
"reference": "
|
51 |
"shasum": ""
|
52 |
},
|
53 |
"require": {
|
54 |
-
"php": "^
|
55 |
},
|
56 |
"require-dev": {
|
57 |
-
"
|
58 |
-
"
|
59 |
-
"
|
60 |
},
|
61 |
"suggest": {
|
62 |
-
"
|
63 |
-
"
|
64 |
},
|
65 |
-
"type": "
|
66 |
-
"
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
},
|
71 |
-
"
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
"notification-url": "https://packagist.org/downloads/",
|
80 |
"license": [
|
81 |
-
"
|
82 |
],
|
83 |
"authors": [
|
84 |
{
|
85 |
-
"name": "
|
86 |
-
"
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
],
|
89 |
-
"description": "
|
90 |
-
"homepage": "
|
91 |
"keywords": [
|
92 |
-
"
|
93 |
-
"
|
|
|
|
|
94 |
],
|
95 |
-
"
|
|
|
|
|
|
|
|
|
96 |
},
|
97 |
{
|
98 |
-
"name": "
|
99 |
-
"version": "
|
100 |
"source": {
|
101 |
"type": "git",
|
102 |
-
"url": "https://github.com/
|
103 |
-
"reference": "
|
104 |
},
|
105 |
"dist": {
|
106 |
"type": "zip",
|
107 |
-
"url": "https://api.github.com/repos/
|
108 |
-
"reference": "
|
109 |
"shasum": ""
|
110 |
},
|
111 |
"require": {
|
112 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
},
|
|
|
|
|
|
|
|
|
114 |
"type": "library",
|
115 |
"extra": {
|
116 |
"branch-alias": {
|
117 |
-
"dev-master": "
|
118 |
}
|
119 |
},
|
120 |
-
"autoload": {
|
121 |
-
"psr-4": {
|
122 |
-
"Symfony\\Component\\CssSelector\\": ""
|
123 |
-
},
|
124 |
-
"exclude-from-classmap": [
|
125 |
-
"/Tests/"
|
126 |
-
]
|
127 |
-
},
|
128 |
"notification-url": "https://packagist.org/downloads/",
|
129 |
"license": [
|
130 |
-
"
|
131 |
],
|
132 |
"authors": [
|
133 |
{
|
134 |
-
"name": "
|
135 |
-
"
|
136 |
-
},
|
137 |
-
{
|
138 |
-
"name": "Fabien Potencier",
|
139 |
-
"email": "fabien@symfony.com"
|
140 |
-
},
|
141 |
-
{
|
142 |
-
"name": "Symfony Community",
|
143 |
-
"homepage": "https://symfony.com/contributors"
|
144 |
}
|
145 |
],
|
146 |
-
"description": "
|
147 |
-
"homepage": "https://
|
148 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
],
|
151 |
"packages-dev": [
|
152 |
{
|
153 |
"name": "doctrine/instantiator",
|
154 |
-
"version": "1.
|
155 |
"source": {
|
156 |
"type": "git",
|
157 |
"url": "https://github.com/doctrine/instantiator.git",
|
158 |
-
"reference": "
|
159 |
},
|
160 |
"dist": {
|
161 |
"type": "zip",
|
162 |
-
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/
|
163 |
-
"reference": "
|
164 |
"shasum": ""
|
165 |
},
|
166 |
"require": {
|
167 |
-
"php": "
|
168 |
},
|
169 |
"require-dev": {
|
170 |
-
"
|
171 |
"ext-pdo": "*",
|
172 |
"ext-phar": "*",
|
173 |
-
"
|
174 |
-
"
|
|
|
|
|
|
|
175 |
},
|
176 |
"type": "library",
|
177 |
-
"extra": {
|
178 |
-
"branch-alias": {
|
179 |
-
"dev-master": "1.0.x-dev"
|
180 |
-
}
|
181 |
-
},
|
182 |
"autoload": {
|
183 |
"psr-4": {
|
184 |
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
@@ -192,46 +277,177 @@
|
|
192 |
{
|
193 |
"name": "Marco Pivetta",
|
194 |
"email": "ocramius@gmail.com",
|
195 |
-
"homepage": "
|
196 |
}
|
197 |
],
|
198 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
199 |
-
"homepage": "https://
|
200 |
"keywords": [
|
201 |
"constructor",
|
202 |
"instantiate"
|
203 |
],
|
204 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
},
|
206 |
{
|
207 |
-
"name": "
|
208 |
-
"version": "
|
209 |
"source": {
|
210 |
"type": "git",
|
211 |
-
"url": "https://github.com/
|
212 |
-
"reference": "
|
213 |
},
|
214 |
"dist": {
|
215 |
"type": "zip",
|
216 |
-
"url": "https://api.github.com/repos/
|
217 |
-
"reference": "
|
218 |
"shasum": ""
|
219 |
},
|
220 |
"require": {
|
221 |
-
"
|
|
|
|
|
222 |
},
|
223 |
"require-dev": {
|
224 |
-
"ext-
|
225 |
-
"phpunit/phpunit": "~4.0"
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
},
|
228 |
"type": "library",
|
229 |
"extra": {
|
230 |
-
"branch-alias":
|
|
|
|
|
231 |
},
|
232 |
"autoload": {
|
233 |
"psr-4": {
|
234 |
-
"
|
235 |
}
|
236 |
},
|
237 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -240,29 +456,154 @@
|
|
240 |
],
|
241 |
"authors": [
|
242 |
{
|
243 |
-
"name": "
|
|
|
|
|
244 |
}
|
245 |
],
|
246 |
-
"description": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
"keywords": [
|
248 |
-
"
|
249 |
-
"faker",
|
250 |
-
"fixtures"
|
251 |
],
|
252 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
},
|
254 |
{
|
255 |
"name": "phpdocumentor/reflection-docblock",
|
256 |
-
"version": "2.0.
|
257 |
"source": {
|
258 |
"type": "git",
|
259 |
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
260 |
-
"reference": "
|
261 |
},
|
262 |
"dist": {
|
263 |
"type": "zip",
|
264 |
-
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/
|
265 |
-
"reference": "
|
266 |
"shasum": ""
|
267 |
},
|
268 |
"require": {
|
@@ -298,37 +639,38 @@
|
|
298 |
"email": "mike.vanriel@naenius.com"
|
299 |
}
|
300 |
],
|
301 |
-
"
|
|
|
|
|
|
|
|
|
302 |
},
|
303 |
{
|
304 |
"name": "phpspec/prophecy",
|
305 |
-
"version": "v1.
|
306 |
"source": {
|
307 |
"type": "git",
|
308 |
"url": "https://github.com/phpspec/prophecy.git",
|
309 |
-
"reference": "
|
310 |
},
|
311 |
"dist": {
|
312 |
"type": "zip",
|
313 |
-
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/
|
314 |
-
"reference": "
|
315 |
"shasum": ""
|
316 |
},
|
317 |
"require": {
|
318 |
"doctrine/instantiator": "^1.0.2",
|
319 |
-
"
|
320 |
-
"
|
321 |
-
"sebastian/comparator": "^1.1",
|
322 |
-
"sebastian/recursion-context": "^1.0|^2.0"
|
323 |
},
|
324 |
"require-dev": {
|
325 |
-
"phpspec/phpspec": "
|
326 |
-
"phpunit/phpunit": "^4.8 || ^5.6.5"
|
327 |
},
|
328 |
"type": "library",
|
329 |
"extra": {
|
330 |
"branch-alias": {
|
331 |
-
"dev-master": "1.
|
332 |
}
|
333 |
},
|
334 |
"autoload": {
|
@@ -361,7 +703,11 @@
|
|
361 |
"spy",
|
362 |
"stub"
|
363 |
],
|
364 |
-
"
|
|
|
|
|
|
|
|
|
365 |
},
|
366 |
{
|
367 |
"name": "phpunit/php-code-coverage",
|
@@ -423,20 +769,25 @@
|
|
423 |
"testing",
|
424 |
"xunit"
|
425 |
],
|
|
|
|
|
|
|
|
|
|
|
426 |
"time": "2015-10-06T15:47:00+00:00"
|
427 |
},
|
428 |
{
|
429 |
"name": "phpunit/php-file-iterator",
|
430 |
-
"version": "1.4.
|
431 |
"source": {
|
432 |
"type": "git",
|
433 |
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
434 |
-
"reference": "
|
435 |
},
|
436 |
"dist": {
|
437 |
"type": "zip",
|
438 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/
|
439 |
-
"reference": "
|
440 |
"shasum": ""
|
441 |
},
|
442 |
"require": {
|
@@ -470,7 +821,12 @@
|
|
470 |
"filesystem",
|
471 |
"iterator"
|
472 |
],
|
473 |
-
"
|
|
|
|
|
|
|
|
|
|
|
474 |
},
|
475 |
{
|
476 |
"name": "phpunit/php-text-template",
|
@@ -511,6 +867,10 @@
|
|
511 |
"keywords": [
|
512 |
"template"
|
513 |
],
|
|
|
|
|
|
|
|
|
514 |
"time": "2015-06-21T13:50:34+00:00"
|
515 |
},
|
516 |
{
|
@@ -555,20 +915,25 @@
|
|
555 |
"keywords": [
|
556 |
"timer"
|
557 |
],
|
|
|
|
|
|
|
|
|
|
|
558 |
"time": "2016-05-12T18:03:57+00:00"
|
559 |
},
|
560 |
{
|
561 |
"name": "phpunit/php-token-stream",
|
562 |
-
"version": "1.4.
|
563 |
"source": {
|
564 |
"type": "git",
|
565 |
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
566 |
-
"reference": "
|
567 |
},
|
568 |
"dist": {
|
569 |
"type": "zip",
|
570 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/
|
571 |
-
"reference": "
|
572 |
"shasum": ""
|
573 |
},
|
574 |
"require": {
|
@@ -604,20 +969,25 @@
|
|
604 |
"keywords": [
|
605 |
"tokenizer"
|
606 |
],
|
607 |
-
"
|
|
|
|
|
|
|
|
|
|
|
608 |
},
|
609 |
{
|
610 |
"name": "phpunit/phpunit",
|
611 |
-
"version": "4.8.
|
612 |
"source": {
|
613 |
"type": "git",
|
614 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
615 |
-
"reference": "
|
616 |
},
|
617 |
"dist": {
|
618 |
"type": "zip",
|
619 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/
|
620 |
-
"reference": "
|
621 |
"shasum": ""
|
622 |
},
|
623 |
"require": {
|
@@ -676,7 +1046,11 @@
|
|
676 |
"testing",
|
677 |
"xunit"
|
678 |
],
|
679 |
-
"
|
|
|
|
|
|
|
|
|
680 |
},
|
681 |
{
|
682 |
"name": "phpunit/phpunit-mock-objects",
|
@@ -732,20 +1106,102 @@
|
|
732 |
"mock",
|
733 |
"xunit"
|
734 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
735 |
"time": "2015-10-02T06:51:40+00:00"
|
736 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
{
|
738 |
"name": "sebastian/comparator",
|
739 |
-
"version": "1.2.
|
740 |
"source": {
|
741 |
"type": "git",
|
742 |
"url": "https://github.com/sebastianbergmann/comparator.git",
|
743 |
-
"reference": "
|
744 |
},
|
745 |
"dist": {
|
746 |
"type": "zip",
|
747 |
-
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/
|
748 |
-
"reference": "
|
749 |
"shasum": ""
|
750 |
},
|
751 |
"require": {
|
@@ -796,7 +1252,11 @@
|
|
796 |
"compare",
|
797 |
"equality"
|
798 |
],
|
799 |
-
"
|
|
|
|
|
|
|
|
|
800 |
},
|
801 |
{
|
802 |
"name": "sebastian/diff",
|
@@ -848,27 +1308,31 @@
|
|
848 |
"keywords": [
|
849 |
"diff"
|
850 |
],
|
|
|
|
|
|
|
|
|
851 |
"time": "2015-12-08T07:14:41+00:00"
|
852 |
},
|
853 |
{
|
854 |
"name": "sebastian/environment",
|
855 |
-
"version": "1.3.
|
856 |
"source": {
|
857 |
"type": "git",
|
858 |
"url": "https://github.com/sebastianbergmann/environment.git",
|
859 |
-
"reference": "
|
860 |
},
|
861 |
"dist": {
|
862 |
"type": "zip",
|
863 |
-
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/
|
864 |
-
"reference": "
|
865 |
"shasum": ""
|
866 |
},
|
867 |
"require": {
|
868 |
-
"php": "
|
869 |
},
|
870 |
"require-dev": {
|
871 |
-
"phpunit/phpunit": "
|
872 |
},
|
873 |
"type": "library",
|
874 |
"extra": {
|
@@ -898,7 +1362,11 @@
|
|
898 |
"environment",
|
899 |
"hhvm"
|
900 |
],
|
901 |
-
"
|
|
|
|
|
|
|
|
|
902 |
},
|
903 |
{
|
904 |
"name": "sebastian/exporter",
|
@@ -965,6 +1433,10 @@
|
|
965 |
"export",
|
966 |
"exporter"
|
967 |
],
|
|
|
|
|
|
|
|
|
968 |
"time": "2016-06-17T09:04:28+00:00"
|
969 |
},
|
970 |
{
|
@@ -1016,20 +1488,24 @@
|
|
1016 |
"keywords": [
|
1017 |
"global state"
|
1018 |
],
|
|
|
|
|
|
|
|
|
1019 |
"time": "2015-10-12T03:26:01+00:00"
|
1020 |
},
|
1021 |
{
|
1022 |
"name": "sebastian/recursion-context",
|
1023 |
-
"version": "1.0.
|
1024 |
"source": {
|
1025 |
"type": "git",
|
1026 |
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
1027 |
-
"reference": "
|
1028 |
},
|
1029 |
"dist": {
|
1030 |
"type": "zip",
|
1031 |
-
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/
|
1032 |
-
"reference": "
|
1033 |
"shasum": ""
|
1034 |
},
|
1035 |
"require": {
|
@@ -1069,7 +1545,11 @@
|
|
1069 |
],
|
1070 |
"description": "Provides functionality to recursively process PHP variables",
|
1071 |
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1072 |
-
"
|
|
|
|
|
|
|
|
|
1073 |
},
|
1074 |
{
|
1075 |
"name": "sebastian/version",
|
@@ -1104,109 +1584,122 @@
|
|
1104 |
],
|
1105 |
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1106 |
"homepage": "https://github.com/sebastianbergmann/version",
|
|
|
|
|
|
|
|
|
1107 |
"time": "2015-06-21T13:59:46+00:00"
|
1108 |
},
|
1109 |
{
|
1110 |
-
"name": "
|
1111 |
-
"version": "
|
1112 |
"source": {
|
1113 |
"type": "git",
|
1114 |
-
"url": "https://github.com/
|
1115 |
-
"reference": "
|
1116 |
},
|
1117 |
"dist": {
|
1118 |
"type": "zip",
|
1119 |
-
"url": "https://api.github.com/repos/
|
1120 |
-
"reference": "
|
1121 |
"shasum": ""
|
1122 |
},
|
1123 |
"require": {
|
1124 |
-
"
|
1125 |
-
"ext-tokenizer": "*",
|
1126 |
-
"ext-xmlwriter": "*",
|
1127 |
-
"php": ">=5.1.2"
|
1128 |
},
|
1129 |
-
"
|
1130 |
-
"
|
|
|
|
|
|
|
1131 |
},
|
1132 |
-
"bin": [
|
1133 |
-
"scripts/phpcs",
|
1134 |
-
"scripts/phpcbf"
|
1135 |
-
],
|
1136 |
"type": "library",
|
1137 |
"extra": {
|
1138 |
"branch-alias": {
|
1139 |
-
"dev-
|
|
|
|
|
|
|
|
|
1140 |
}
|
1141 |
},
|
1142 |
"autoload": {
|
1143 |
-
"
|
1144 |
-
"
|
1145 |
-
|
1146 |
-
|
1147 |
-
"
|
1148 |
-
|
1149 |
-
"CodeSniffer/Report.php",
|
1150 |
-
"CodeSniffer/Reporting.php",
|
1151 |
-
"CodeSniffer/Sniff.php",
|
1152 |
-
"CodeSniffer/Tokens.php",
|
1153 |
-
"CodeSniffer/Reports/",
|
1154 |
-
"CodeSniffer/Tokenizers/",
|
1155 |
-
"CodeSniffer/DocGenerators/",
|
1156 |
-
"CodeSniffer/Standards/AbstractPatternSniff.php",
|
1157 |
-
"CodeSniffer/Standards/AbstractScopeSniff.php",
|
1158 |
-
"CodeSniffer/Standards/AbstractVariableSniff.php",
|
1159 |
-
"CodeSniffer/Standards/IncorrectPatternException.php",
|
1160 |
-
"CodeSniffer/Standards/Generic/Sniffs/",
|
1161 |
-
"CodeSniffer/Standards/MySource/Sniffs/",
|
1162 |
-
"CodeSniffer/Standards/PEAR/Sniffs/",
|
1163 |
-
"CodeSniffer/Standards/PSR1/Sniffs/",
|
1164 |
-
"CodeSniffer/Standards/PSR2/Sniffs/",
|
1165 |
-
"CodeSniffer/Standards/Squiz/Sniffs/",
|
1166 |
-
"CodeSniffer/Standards/Zend/Sniffs/"
|
1167 |
-
]
|
1168 |
},
|
1169 |
"notification-url": "https://packagist.org/downloads/",
|
1170 |
"license": [
|
1171 |
-
"
|
1172 |
],
|
1173 |
"authors": [
|
1174 |
{
|
1175 |
-
"name": "
|
1176 |
-
"
|
|
|
|
|
|
|
|
|
1177 |
}
|
1178 |
],
|
1179 |
-
"description": "
|
1180 |
-
"homepage": "
|
1181 |
"keywords": [
|
1182 |
-
"
|
1183 |
-
"
|
|
|
|
|
1184 |
],
|
1185 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1186 |
},
|
1187 |
{
|
1188 |
"name": "symfony/yaml",
|
1189 |
-
"version": "
|
1190 |
"source": {
|
1191 |
"type": "git",
|
1192 |
"url": "https://github.com/symfony/yaml.git",
|
1193 |
-
"reference": "
|
1194 |
},
|
1195 |
"dist": {
|
1196 |
"type": "zip",
|
1197 |
-
"url": "https://api.github.com/repos/symfony/yaml/zipball/
|
1198 |
-
"reference": "
|
1199 |
"shasum": ""
|
1200 |
},
|
1201 |
"require": {
|
1202 |
-
"php": "
|
|
|
1203 |
},
|
1204 |
-
"
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
},
|
|
|
|
|
|
|
|
|
1210 |
"autoload": {
|
1211 |
"psr-4": {
|
1212 |
"Symfony\\Component\\Yaml\\": ""
|
@@ -1231,7 +1724,24 @@
|
|
1231 |
],
|
1232 |
"description": "Symfony Yaml Component",
|
1233 |
"homepage": "https://symfony.com",
|
1234 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1235 |
}
|
1236 |
],
|
1237 |
"aliases": [],
|
@@ -1240,7 +1750,8 @@
|
|
1240 |
"prefer-stable": false,
|
1241 |
"prefer-lowest": false,
|
1242 |
"platform": {
|
1243 |
-
"php": "^5.4 || ^7.0"
|
1244 |
},
|
1245 |
-
"platform-dev": []
|
|
|
1246 |
}
|
1 |
{
|
2 |
"_readme": [
|
3 |
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
+
"content-hash": "6efcdc8636942787d71d566ac34fc9d0",
|
8 |
"packages": [
|
9 |
{
|
10 |
+
"name": "phpcompatibility/php-compatibility",
|
11 |
+
"version": "9.3.5",
|
12 |
"source": {
|
13 |
"type": "git",
|
14 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
15 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
|
16 |
+
},
|
17 |
+
"dist": {
|
18 |
+
"type": "zip",
|
19 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
|
20 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
|
21 |
+
"shasum": ""
|
22 |
},
|
23 |
"require": {
|
24 |
+
"php": ">=5.3",
|
25 |
+
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
|
26 |
},
|
27 |
+
"conflict": {
|
28 |
+
"squizlabs/php_codesniffer": "2.6.2"
|
29 |
+
},
|
30 |
+
"require-dev": {
|
31 |
+
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
|
32 |
+
},
|
33 |
+
"suggest": {
|
34 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
35 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
36 |
},
|
37 |
+
"type": "phpcodesniffer-standard",
|
38 |
"notification-url": "https://packagist.org/downloads/",
|
39 |
"license": [
|
40 |
+
"LGPL-3.0-or-later"
|
41 |
],
|
42 |
+
"authors": [
|
43 |
+
{
|
44 |
+
"name": "Wim Godden",
|
45 |
+
"homepage": "https://github.com/wimg",
|
46 |
+
"role": "lead"
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"name": "Juliette Reinders Folmer",
|
50 |
+
"homepage": "https://github.com/jrfnl",
|
51 |
+
"role": "lead"
|
52 |
+
},
|
53 |
+
{
|
54 |
+
"name": "Contributors",
|
55 |
+
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
|
56 |
+
}
|
57 |
+
],
|
58 |
+
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
|
59 |
+
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
|
60 |
"keywords": [
|
61 |
+
"compatibility",
|
62 |
+
"phpcs",
|
63 |
+
"standards"
|
64 |
],
|
65 |
+
"support": {
|
66 |
+
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
|
67 |
+
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
|
68 |
+
},
|
69 |
+
"time": "2019-12-27T09:44:58+00:00"
|
70 |
},
|
71 |
{
|
72 |
+
"name": "phpcompatibility/phpcompatibility-paragonie",
|
73 |
+
"version": "1.3.1",
|
74 |
"source": {
|
75 |
"type": "git",
|
76 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
|
77 |
+
"reference": "ddabec839cc003651f2ce695c938686d1086cf43"
|
78 |
},
|
79 |
"dist": {
|
80 |
"type": "zip",
|
81 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43",
|
82 |
+
"reference": "ddabec839cc003651f2ce695c938686d1086cf43",
|
83 |
"shasum": ""
|
84 |
},
|
85 |
"require": {
|
86 |
+
"phpcompatibility/php-compatibility": "^9.0"
|
87 |
},
|
88 |
"require-dev": {
|
89 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
|
90 |
+
"paragonie/random_compat": "dev-master",
|
91 |
+
"paragonie/sodium_compat": "dev-master"
|
92 |
},
|
93 |
"suggest": {
|
94 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
95 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
96 |
},
|
97 |
+
"type": "phpcodesniffer-standard",
|
98 |
+
"notification-url": "https://packagist.org/downloads/",
|
99 |
+
"license": [
|
100 |
+
"LGPL-3.0-or-later"
|
101 |
+
],
|
102 |
+
"authors": [
|
103 |
+
{
|
104 |
+
"name": "Wim Godden",
|
105 |
+
"role": "lead"
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"name": "Juliette Reinders Folmer",
|
109 |
+
"role": "lead"
|
110 |
}
|
111 |
+
],
|
112 |
+
"description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
|
113 |
+
"homepage": "http://phpcompatibility.com/",
|
114 |
+
"keywords": [
|
115 |
+
"compatibility",
|
116 |
+
"paragonie",
|
117 |
+
"phpcs",
|
118 |
+
"polyfill",
|
119 |
+
"standards"
|
120 |
+
],
|
121 |
+
"support": {
|
122 |
+
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
|
123 |
+
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
|
124 |
},
|
125 |
+
"time": "2021-02-15T10:24:51+00:00"
|
126 |
+
},
|
127 |
+
{
|
128 |
+
"name": "phpcompatibility/phpcompatibility-wp",
|
129 |
+
"version": "2.1.3",
|
130 |
+
"source": {
|
131 |
+
"type": "git",
|
132 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
|
133 |
+
"reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308"
|
134 |
+
},
|
135 |
+
"dist": {
|
136 |
+
"type": "zip",
|
137 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308",
|
138 |
+
"reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308",
|
139 |
+
"shasum": ""
|
140 |
+
},
|
141 |
+
"require": {
|
142 |
+
"phpcompatibility/php-compatibility": "^9.0",
|
143 |
+
"phpcompatibility/phpcompatibility-paragonie": "^1.0"
|
144 |
},
|
145 |
+
"require-dev": {
|
146 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7"
|
147 |
+
},
|
148 |
+
"suggest": {
|
149 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
150 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
151 |
+
},
|
152 |
+
"type": "phpcodesniffer-standard",
|
153 |
"notification-url": "https://packagist.org/downloads/",
|
154 |
"license": [
|
155 |
+
"LGPL-3.0-or-later"
|
156 |
],
|
157 |
"authors": [
|
158 |
{
|
159 |
+
"name": "Wim Godden",
|
160 |
+
"role": "lead"
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"name": "Juliette Reinders Folmer",
|
164 |
+
"role": "lead"
|
165 |
}
|
166 |
],
|
167 |
+
"description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
|
168 |
+
"homepage": "http://phpcompatibility.com/",
|
169 |
"keywords": [
|
170 |
+
"compatibility",
|
171 |
+
"phpcs",
|
172 |
+
"standards",
|
173 |
+
"wordpress"
|
174 |
],
|
175 |
+
"support": {
|
176 |
+
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
|
177 |
+
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
|
178 |
+
},
|
179 |
+
"time": "2021-12-30T16:37:40+00:00"
|
180 |
},
|
181 |
{
|
182 |
+
"name": "squizlabs/php_codesniffer",
|
183 |
+
"version": "3.7.1",
|
184 |
"source": {
|
185 |
"type": "git",
|
186 |
+
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
187 |
+
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
|
188 |
},
|
189 |
"dist": {
|
190 |
"type": "zip",
|
191 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
|
192 |
+
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
|
193 |
"shasum": ""
|
194 |
},
|
195 |
"require": {
|
196 |
+
"ext-simplexml": "*",
|
197 |
+
"ext-tokenizer": "*",
|
198 |
+
"ext-xmlwriter": "*",
|
199 |
+
"php": ">=5.4.0"
|
200 |
+
},
|
201 |
+
"require-dev": {
|
202 |
+
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
203 |
},
|
204 |
+
"bin": [
|
205 |
+
"bin/phpcs",
|
206 |
+
"bin/phpcbf"
|
207 |
+
],
|
208 |
"type": "library",
|
209 |
"extra": {
|
210 |
"branch-alias": {
|
211 |
+
"dev-master": "3.x-dev"
|
212 |
}
|
213 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
"notification-url": "https://packagist.org/downloads/",
|
215 |
"license": [
|
216 |
+
"BSD-3-Clause"
|
217 |
],
|
218 |
"authors": [
|
219 |
{
|
220 |
+
"name": "Greg Sherwood",
|
221 |
+
"role": "lead"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
],
|
224 |
+
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
225 |
+
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
226 |
+
"keywords": [
|
227 |
+
"phpcs",
|
228 |
+
"standards"
|
229 |
+
],
|
230 |
+
"support": {
|
231 |
+
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
|
232 |
+
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
|
233 |
+
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
|
234 |
+
},
|
235 |
+
"time": "2022-06-18T07:21:10+00:00"
|
236 |
}
|
237 |
],
|
238 |
"packages-dev": [
|
239 |
{
|
240 |
"name": "doctrine/instantiator",
|
241 |
+
"version": "1.4.1",
|
242 |
"source": {
|
243 |
"type": "git",
|
244 |
"url": "https://github.com/doctrine/instantiator.git",
|
245 |
+
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc"
|
246 |
},
|
247 |
"dist": {
|
248 |
"type": "zip",
|
249 |
+
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc",
|
250 |
+
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc",
|
251 |
"shasum": ""
|
252 |
},
|
253 |
"require": {
|
254 |
+
"php": "^7.1 || ^8.0"
|
255 |
},
|
256 |
"require-dev": {
|
257 |
+
"doctrine/coding-standard": "^9",
|
258 |
"ext-pdo": "*",
|
259 |
"ext-phar": "*",
|
260 |
+
"phpbench/phpbench": "^0.16 || ^1",
|
261 |
+
"phpstan/phpstan": "^1.4",
|
262 |
+
"phpstan/phpstan-phpunit": "^1",
|
263 |
+
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
264 |
+
"vimeo/psalm": "^4.22"
|
265 |
},
|
266 |
"type": "library",
|
|
|
|
|
|
|
|
|
|
|
267 |
"autoload": {
|
268 |
"psr-4": {
|
269 |
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
|
277 |
{
|
278 |
"name": "Marco Pivetta",
|
279 |
"email": "ocramius@gmail.com",
|
280 |
+
"homepage": "https://ocramius.github.io/"
|
281 |
}
|
282 |
],
|
283 |
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
284 |
+
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
|
285 |
"keywords": [
|
286 |
"constructor",
|
287 |
"instantiate"
|
288 |
],
|
289 |
+
"support": {
|
290 |
+
"issues": "https://github.com/doctrine/instantiator/issues",
|
291 |
+
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
|
292 |
+
},
|
293 |
+
"funding": [
|
294 |
+
{
|
295 |
+
"url": "https://www.doctrine-project.org/sponsorship.html",
|
296 |
+
"type": "custom"
|
297 |
+
},
|
298 |
+
{
|
299 |
+
"url": "https://www.patreon.com/phpdoctrine",
|
300 |
+
"type": "patreon"
|
301 |
+
},
|
302 |
+
{
|
303 |
+
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
|
304 |
+
"type": "tidelift"
|
305 |
+
}
|
306 |
+
],
|
307 |
+
"time": "2022-03-03T08:28:38+00:00"
|
308 |
+
},
|
309 |
+
{
|
310 |
+
"name": "guzzlehttp/guzzle",
|
311 |
+
"version": "5.3.4",
|
312 |
+
"source": {
|
313 |
+
"type": "git",
|
314 |
+
"url": "https://github.com/guzzle/guzzle.git",
|
315 |
+
"reference": "b87eda7a7162f95574032da17e9323c9899cb6b2"
|
316 |
+
},
|
317 |
+
"dist": {
|
318 |
+
"type": "zip",
|
319 |
+
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/b87eda7a7162f95574032da17e9323c9899cb6b2",
|
320 |
+
"reference": "b87eda7a7162f95574032da17e9323c9899cb6b2",
|
321 |
+
"shasum": ""
|
322 |
+
},
|
323 |
+
"require": {
|
324 |
+
"guzzlehttp/ringphp": "^1.1",
|
325 |
+
"php": ">=5.4.0",
|
326 |
+
"react/promise": "^2.2"
|
327 |
+
},
|
328 |
+
"require-dev": {
|
329 |
+
"ext-curl": "*",
|
330 |
+
"phpunit/phpunit": "^4.0"
|
331 |
+
},
|
332 |
+
"type": "library",
|
333 |
+
"autoload": {
|
334 |
+
"psr-4": {
|
335 |
+
"GuzzleHttp\\": "src/"
|
336 |
+
}
|
337 |
+
},
|
338 |
+
"notification-url": "https://packagist.org/downloads/",
|
339 |
+
"license": [
|
340 |
+
"MIT"
|
341 |
+
],
|
342 |
+
"authors": [
|
343 |
+
{
|
344 |
+
"name": "Michael Dowling",
|
345 |
+
"email": "mtdowling@gmail.com",
|
346 |
+
"homepage": "https://github.com/mtdowling"
|
347 |
+
}
|
348 |
+
],
|
349 |
+
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
|
350 |
+
"homepage": "http://guzzlephp.org/",
|
351 |
+
"keywords": [
|
352 |
+
"client",
|
353 |
+
"curl",
|
354 |
+
"framework",
|
355 |
+
"http",
|
356 |
+
"http client",
|
357 |
+
"rest",
|
358 |
+
"web service"
|
359 |
+
],
|
360 |
+
"support": {
|
361 |
+
"issues": "https://github.com/guzzle/guzzle/issues",
|
362 |
+
"source": "https://github.com/guzzle/guzzle/tree/5.3"
|
363 |
+
},
|
364 |
+
"time": "2019-10-30T09:32:00+00:00"
|
365 |
},
|
366 |
{
|
367 |
+
"name": "guzzlehttp/ringphp",
|
368 |
+
"version": "1.1.1",
|
369 |
"source": {
|
370 |
"type": "git",
|
371 |
+
"url": "https://github.com/guzzle/RingPHP.git",
|
372 |
+
"reference": "5e2a174052995663dd68e6b5ad838afd47dd615b"
|
373 |
},
|
374 |
"dist": {
|
375 |
"type": "zip",
|
376 |
+
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b",
|
377 |
+
"reference": "5e2a174052995663dd68e6b5ad838afd47dd615b",
|
378 |
"shasum": ""
|
379 |
},
|
380 |
"require": {
|
381 |
+
"guzzlehttp/streams": "~3.0",
|
382 |
+
"php": ">=5.4.0",
|
383 |
+
"react/promise": "~2.0"
|
384 |
},
|
385 |
"require-dev": {
|
386 |
+
"ext-curl": "*",
|
387 |
+
"phpunit/phpunit": "~4.0"
|
388 |
+
},
|
389 |
+
"suggest": {
|
390 |
+
"ext-curl": "Guzzle will use specific adapters if cURL is present"
|
391 |
+
},
|
392 |
+
"type": "library",
|
393 |
+
"extra": {
|
394 |
+
"branch-alias": {
|
395 |
+
"dev-master": "1.1-dev"
|
396 |
+
}
|
397 |
+
},
|
398 |
+
"autoload": {
|
399 |
+
"psr-4": {
|
400 |
+
"GuzzleHttp\\Ring\\": "src/"
|
401 |
+
}
|
402 |
+
},
|
403 |
+
"notification-url": "https://packagist.org/downloads/",
|
404 |
+
"license": [
|
405 |
+
"MIT"
|
406 |
+
],
|
407 |
+
"authors": [
|
408 |
+
{
|
409 |
+
"name": "Michael Dowling",
|
410 |
+
"email": "mtdowling@gmail.com",
|
411 |
+
"homepage": "https://github.com/mtdowling"
|
412 |
+
}
|
413 |
+
],
|
414 |
+
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
|
415 |
+
"support": {
|
416 |
+
"issues": "https://github.com/guzzle/RingPHP/issues",
|
417 |
+
"source": "https://github.com/guzzle/RingPHP/tree/1.1.1"
|
418 |
+
},
|
419 |
+
"abandoned": true,
|
420 |
+
"time": "2018-07-31T13:22:33+00:00"
|
421 |
+
},
|
422 |
+
{
|
423 |
+
"name": "guzzlehttp/streams",
|
424 |
+
"version": "3.0.0",
|
425 |
+
"source": {
|
426 |
+
"type": "git",
|
427 |
+
"url": "https://github.com/guzzle/streams.git",
|
428 |
+
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
|
429 |
+
},
|
430 |
+
"dist": {
|
431 |
+
"type": "zip",
|
432 |
+
"url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
433 |
+
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
434 |
+
"shasum": ""
|
435 |
+
},
|
436 |
+
"require": {
|
437 |
+
"php": ">=5.4.0"
|
438 |
+
},
|
439 |
+
"require-dev": {
|
440 |
+
"phpunit/phpunit": "~4.0"
|
441 |
},
|
442 |
"type": "library",
|
443 |
"extra": {
|
444 |
+
"branch-alias": {
|
445 |
+
"dev-master": "3.0-dev"
|
446 |
+
}
|
447 |
},
|
448 |
"autoload": {
|
449 |
"psr-4": {
|
450 |
+
"GuzzleHttp\\Stream\\": "src/"
|
451 |
}
|
452 |
},
|
453 |
"notification-url": "https://packagist.org/downloads/",
|
456 |
],
|
457 |
"authors": [
|
458 |
{
|
459 |
+
"name": "Michael Dowling",
|
460 |
+
"email": "mtdowling@gmail.com",
|
461 |
+
"homepage": "https://github.com/mtdowling"
|
462 |
}
|
463 |
],
|
464 |
+
"description": "Provides a simple abstraction over streams of data",
|
465 |
+
"homepage": "http://guzzlephp.org/",
|
466 |
+
"keywords": [
|
467 |
+
"Guzzle",
|
468 |
+
"stream"
|
469 |
+
],
|
470 |
+
"support": {
|
471 |
+
"issues": "https://github.com/guzzle/streams/issues",
|
472 |
+
"source": "https://github.com/guzzle/streams/tree/master"
|
473 |
+
},
|
474 |
+
"abandoned": true,
|
475 |
+
"time": "2014-10-12T19:18:40+00:00"
|
476 |
+
},
|
477 |
+
{
|
478 |
+
"name": "hamcrest/hamcrest-php",
|
479 |
+
"version": "v1.2.2",
|
480 |
+
"source": {
|
481 |
+
"type": "git",
|
482 |
+
"url": "https://github.com/hamcrest/hamcrest-php.git",
|
483 |
+
"reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c"
|
484 |
+
},
|
485 |
+
"dist": {
|
486 |
+
"type": "zip",
|
487 |
+
"url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c",
|
488 |
+
"reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c",
|
489 |
+
"shasum": ""
|
490 |
+
},
|
491 |
+
"require": {
|
492 |
+
"php": ">=5.3.2"
|
493 |
+
},
|
494 |
+
"replace": {
|
495 |
+
"cordoval/hamcrest-php": "*",
|
496 |
+
"davedevelopment/hamcrest-php": "*",
|
497 |
+
"kodova/hamcrest-php": "*"
|
498 |
+
},
|
499 |
+
"require-dev": {
|
500 |
+
"phpunit/php-file-iterator": "1.3.3",
|
501 |
+
"satooshi/php-coveralls": "dev-master"
|
502 |
+
},
|
503 |
+
"type": "library",
|
504 |
+
"autoload": {
|
505 |
+
"files": [
|
506 |
+
"hamcrest/Hamcrest.php"
|
507 |
+
],
|
508 |
+
"classmap": [
|
509 |
+
"hamcrest"
|
510 |
+
]
|
511 |
+
},
|
512 |
+
"notification-url": "https://packagist.org/downloads/",
|
513 |
+
"license": [
|
514 |
+
"BSD"
|
515 |
+
],
|
516 |
+
"description": "This is the PHP port of Hamcrest Matchers",
|
517 |
"keywords": [
|
518 |
+
"test"
|
|
|
|
|
519 |
],
|
520 |
+
"support": {
|
521 |
+
"issues": "https://github.com/hamcrest/hamcrest-php/issues",
|
522 |
+
"source": "https://github.com/hamcrest/hamcrest-php/tree/master"
|
523 |
+
},
|
524 |
+
"time": "2015-05-11T14:41:42+00:00"
|
525 |
+
},
|
526 |
+
{
|
527 |
+
"name": "mockery/mockery",
|
528 |
+
"version": "0.9.11",
|
529 |
+
"source": {
|
530 |
+
"type": "git",
|
531 |
+
"url": "https://github.com/mockery/mockery.git",
|
532 |
+
"reference": "be9bf28d8e57d67883cba9fcadfcff8caab667f8"
|
533 |
+
},
|
534 |
+
"dist": {
|
535 |
+
"type": "zip",
|
536 |
+
"url": "https://api.github.com/repos/mockery/mockery/zipball/be9bf28d8e57d67883cba9fcadfcff8caab667f8",
|
537 |
+
"reference": "be9bf28d8e57d67883cba9fcadfcff8caab667f8",
|
538 |
+
"shasum": ""
|
539 |
+
},
|
540 |
+
"require": {
|
541 |
+
"hamcrest/hamcrest-php": "~1.1",
|
542 |
+
"lib-pcre": ">=7.0",
|
543 |
+
"php": ">=5.3.2"
|
544 |
+
},
|
545 |
+
"require-dev": {
|
546 |
+
"phpunit/phpunit": "~4.0"
|
547 |
+
},
|
548 |
+
"type": "library",
|
549 |
+
"extra": {
|
550 |
+
"branch-alias": {
|
551 |
+
"dev-master": "0.9.x-dev"
|
552 |
+
}
|
553 |
+
},
|
554 |
+
"autoload": {
|
555 |
+
"psr-0": {
|
556 |
+
"Mockery": "library/"
|
557 |
+
}
|
558 |
+
},
|
559 |
+
"notification-url": "https://packagist.org/downloads/",
|
560 |
+
"license": [
|
561 |
+
"BSD-3-Clause"
|
562 |
+
],
|
563 |
+
"authors": [
|
564 |
+
{
|
565 |
+
"name": "Pádraic Brady",
|
566 |
+
"email": "padraic.brady@gmail.com",
|
567 |
+
"homepage": "http://blog.astrumfutura.com"
|
568 |
+
},
|
569 |
+
{
|
570 |
+
"name": "Dave Marshall",
|
571 |
+
"email": "dave.marshall@atstsolutions.co.uk",
|
572 |
+
"homepage": "http://davedevelopment.co.uk"
|
573 |
+
}
|
574 |
+
],
|
575 |
+
"description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.",
|
576 |
+
"homepage": "http://github.com/padraic/mockery",
|
577 |
+
"keywords": [
|
578 |
+
"BDD",
|
579 |
+
"TDD",
|
580 |
+
"library",
|
581 |
+
"mock",
|
582 |
+
"mock objects",
|
583 |
+
"mockery",
|
584 |
+
"stub",
|
585 |
+
"test",
|
586 |
+
"test double",
|
587 |
+
"testing"
|
588 |
+
],
|
589 |
+
"support": {
|
590 |
+
"issues": "https://github.com/mockery/mockery/issues",
|
591 |
+
"source": "https://github.com/mockery/mockery/tree/0.9"
|
592 |
+
},
|
593 |
+
"time": "2019-02-12T16:07:13+00:00"
|
594 |
},
|
595 |
{
|
596 |
"name": "phpdocumentor/reflection-docblock",
|
597 |
+
"version": "2.0.5",
|
598 |
"source": {
|
599 |
"type": "git",
|
600 |
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
601 |
+
"reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b"
|
602 |
},
|
603 |
"dist": {
|
604 |
"type": "zip",
|
605 |
+
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b",
|
606 |
+
"reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b",
|
607 |
"shasum": ""
|
608 |
},
|
609 |
"require": {
|
639 |
"email": "mike.vanriel@naenius.com"
|
640 |
}
|
641 |
],
|
642 |
+
"support": {
|
643 |
+
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
|
644 |
+
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/2.x"
|
645 |
+
},
|
646 |
+
"time": "2016-01-25T08:17:30+00:00"
|
647 |
},
|
648 |
{
|
649 |
"name": "phpspec/prophecy",
|
650 |
+
"version": "v1.5.0",
|
651 |
"source": {
|
652 |
"type": "git",
|
653 |
"url": "https://github.com/phpspec/prophecy.git",
|
654 |
+
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7"
|
655 |
},
|
656 |
"dist": {
|
657 |
"type": "zip",
|
658 |
+
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7",
|
659 |
+
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7",
|
660 |
"shasum": ""
|
661 |
},
|
662 |
"require": {
|
663 |
"doctrine/instantiator": "^1.0.2",
|
664 |
+
"phpdocumentor/reflection-docblock": "~2.0",
|
665 |
+
"sebastian/comparator": "~1.1"
|
|
|
|
|
666 |
},
|
667 |
"require-dev": {
|
668 |
+
"phpspec/phpspec": "~2.0"
|
|
|
669 |
},
|
670 |
"type": "library",
|
671 |
"extra": {
|
672 |
"branch-alias": {
|
673 |
+
"dev-master": "1.4.x-dev"
|
674 |
}
|
675 |
},
|
676 |
"autoload": {
|
703 |
"spy",
|
704 |
"stub"
|
705 |
],
|
706 |
+
"support": {
|
707 |
+
"issues": "https://github.com/phpspec/prophecy/issues",
|
708 |
+
"source": "https://github.com/phpspec/prophecy/tree/master"
|
709 |
+
},
|
710 |
+
"time": "2015-08-13T10:07:40+00:00"
|
711 |
},
|
712 |
{
|
713 |
"name": "phpunit/php-code-coverage",
|
769 |
"testing",
|
770 |
"xunit"
|
771 |
],
|
772 |
+
"support": {
|
773 |
+
"irc": "irc://irc.freenode.net/phpunit",
|
774 |
+
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
775 |
+
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/2.2"
|
776 |
+
},
|
777 |
"time": "2015-10-06T15:47:00+00:00"
|
778 |
},
|
779 |
{
|
780 |
"name": "phpunit/php-file-iterator",
|
781 |
+
"version": "1.4.5",
|
782 |
"source": {
|
783 |
"type": "git",
|
784 |
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
785 |
+
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
|
786 |
},
|
787 |
"dist": {
|
788 |
"type": "zip",
|
789 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
|
790 |
+
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
|
791 |
"shasum": ""
|
792 |
},
|
793 |
"require": {
|
821 |
"filesystem",
|
822 |
"iterator"
|
823 |
],
|
824 |
+
"support": {
|
825 |
+
"irc": "irc://irc.freenode.net/phpunit",
|
826 |
+
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
|
827 |
+
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5"
|
828 |
+
},
|
829 |
+
"time": "2017-11-27T13:52:08+00:00"
|
830 |
},
|
831 |
{
|
832 |
"name": "phpunit/php-text-template",
|
867 |
"keywords": [
|
868 |
"template"
|
869 |
],
|
870 |
+
"support": {
|
871 |
+
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
|
872 |
+
"source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1"
|
873 |
+
},
|
874 |
"time": "2015-06-21T13:50:34+00:00"
|
875 |
},
|
876 |
{
|
915 |
"keywords": [
|
916 |
"timer"
|
917 |
],
|
918 |
+
"support": {
|
919 |
+
"irc": "irc://irc.freenode.net/phpunit",
|
920 |
+
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
|
921 |
+
"source": "https://github.com/sebastianbergmann/php-timer/tree/master"
|
922 |
+
},
|
923 |
"time": "2016-05-12T18:03:57+00:00"
|
924 |
},
|
925 |
{
|
926 |
"name": "phpunit/php-token-stream",
|
927 |
+
"version": "1.4.12",
|
928 |
"source": {
|
929 |
"type": "git",
|
930 |
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
931 |
+
"reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16"
|
932 |
},
|
933 |
"dist": {
|
934 |
"type": "zip",
|
935 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16",
|
936 |
+
"reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16",
|
937 |
"shasum": ""
|
938 |
},
|
939 |
"require": {
|
969 |
"keywords": [
|
970 |
"tokenizer"
|
971 |
],
|
972 |
+
"support": {
|
973 |
+
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
|
974 |
+
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4"
|
975 |
+
},
|
976 |
+
"abandoned": true,
|
977 |
+
"time": "2017-12-04T08:55:13+00:00"
|
978 |
},
|
979 |
{
|
980 |
"name": "phpunit/phpunit",
|
981 |
+
"version": "4.8.36",
|
982 |
"source": {
|
983 |
"type": "git",
|
984 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
985 |
+
"reference": "46023de9a91eec7dfb06cc56cb4e260017298517"
|
986 |
},
|
987 |
"dist": {
|
988 |
"type": "zip",
|
989 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517",
|
990 |
+
"reference": "46023de9a91eec7dfb06cc56cb4e260017298517",
|
991 |
"shasum": ""
|
992 |
},
|
993 |
"require": {
|
1046 |
"testing",
|
1047 |
"xunit"
|
1048 |
],
|
1049 |
+
"support": {
|
1050 |
+
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
1051 |
+
"source": "https://github.com/sebastianbergmann/phpunit/tree/4.8.36"
|
1052 |
+
},
|
1053 |
+
"time": "2017-06-21T08:07:12+00:00"
|
1054 |
},
|
1055 |
{
|
1056 |
"name": "phpunit/phpunit-mock-objects",
|
1106 |
"mock",
|
1107 |
"xunit"
|
1108 |
],
|
1109 |
+
"support": {
|
1110 |
+
"irc": "irc://irc.freenode.net/phpunit",
|
1111 |
+
"issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues",
|
1112 |
+
"source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/2.3"
|
1113 |
+
},
|
1114 |
+
"abandoned": true,
|
1115 |
"time": "2015-10-02T06:51:40+00:00"
|
1116 |
},
|
1117 |
+
{
|
1118 |
+
"name": "react/promise",
|
1119 |
+
"version": "v2.9.0",
|
1120 |
+
"source": {
|
1121 |
+
"type": "git",
|
1122 |
+
"url": "https://github.com/reactphp/promise.git",
|
1123 |
+
"reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910"
|
1124 |
+
},
|
1125 |
+
"dist": {
|
1126 |
+
"type": "zip",
|
1127 |
+
"url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910",
|
1128 |
+
"reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910",
|
1129 |
+
"shasum": ""
|
1130 |
+
},
|
1131 |
+
"require": {
|
1132 |
+
"php": ">=5.4.0"
|
1133 |
+
},
|
1134 |
+
"require-dev": {
|
1135 |
+
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36"
|
1136 |
+
},
|
1137 |
+
"type": "library",
|
1138 |
+
"autoload": {
|
1139 |
+
"files": [
|
1140 |
+
"src/functions_include.php"
|
1141 |
+
],
|
1142 |
+
"psr-4": {
|
1143 |
+
"React\\Promise\\": "src/"
|
1144 |
+
}
|
1145 |
+
},
|
1146 |
+
"notification-url": "https://packagist.org/downloads/",
|
1147 |
+
"license": [
|
1148 |
+
"MIT"
|
1149 |
+
],
|
1150 |
+
"authors": [
|
1151 |
+
{
|
1152 |
+
"name": "Jan Sorgalla",
|
1153 |
+
"email": "jsorgalla@gmail.com",
|
1154 |
+
"homepage": "https://sorgalla.com/"
|
1155 |
+
},
|
1156 |
+
{
|
1157 |
+
"name": "Christian Lück",
|
1158 |
+
"email": "christian@clue.engineering",
|
1159 |
+
"homepage": "https://clue.engineering/"
|
1160 |
+
},
|
1161 |
+
{
|
1162 |
+
"name": "Cees-Jan Kiewiet",
|
1163 |
+
"email": "reactphp@ceesjankiewiet.nl",
|
1164 |
+
"homepage": "https://wyrihaximus.net/"
|
1165 |
+
},
|
1166 |
+
{
|
1167 |
+
"name": "Chris Boden",
|
1168 |
+
"email": "cboden@gmail.com",
|
1169 |
+
"homepage": "https://cboden.dev/"
|
1170 |
+
}
|
1171 |
+
],
|
1172 |
+
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
|
1173 |
+
"keywords": [
|
1174 |
+
"promise",
|
1175 |
+
"promises"
|
1176 |
+
],
|
1177 |
+
"support": {
|
1178 |
+
"issues": "https://github.com/reactphp/promise/issues",
|
1179 |
+
"source": "https://github.com/reactphp/promise/tree/v2.9.0"
|
1180 |
+
},
|
1181 |
+
"funding": [
|
1182 |
+
{
|
1183 |
+
"url": "https://github.com/WyriHaximus",
|
1184 |
+
"type": "github"
|
1185 |
+
},
|
1186 |
+
{
|
1187 |
+
"url": "https://github.com/clue",
|
1188 |
+
"type": "github"
|
1189 |
+
}
|
1190 |
+
],
|
1191 |
+
"time": "2022-02-11T10:27:51+00:00"
|
1192 |
+
},
|
1193 |
{
|
1194 |
"name": "sebastian/comparator",
|
1195 |
+
"version": "1.2.4",
|
1196 |
"source": {
|
1197 |
"type": "git",
|
1198 |
"url": "https://github.com/sebastianbergmann/comparator.git",
|
1199 |
+
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
|
1200 |
},
|
1201 |
"dist": {
|
1202 |
"type": "zip",
|
1203 |
+
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
|
1204 |
+
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
|
1205 |
"shasum": ""
|
1206 |
},
|
1207 |
"require": {
|
1252 |
"compare",
|
1253 |
"equality"
|
1254 |
],
|
1255 |
+
"support": {
|
1256 |
+
"issues": "https://github.com/sebastianbergmann/comparator/issues",
|
1257 |
+
"source": "https://github.com/sebastianbergmann/comparator/tree/1.2"
|
1258 |
+
},
|
1259 |
+
"time": "2017-01-29T09:50:25+00:00"
|
1260 |
},
|
1261 |
{
|
1262 |
"name": "sebastian/diff",
|
1308 |
"keywords": [
|
1309 |
"diff"
|
1310 |
],
|
1311 |
+
"support": {
|
1312 |
+
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
1313 |
+
"source": "https://github.com/sebastianbergmann/diff/tree/master"
|
1314 |
+
},
|
1315 |
"time": "2015-12-08T07:14:41+00:00"
|
1316 |
},
|
1317 |
{
|
1318 |
"name": "sebastian/environment",
|
1319 |
+
"version": "1.3.7",
|
1320 |
"source": {
|
1321 |
"type": "git",
|
1322 |
"url": "https://github.com/sebastianbergmann/environment.git",
|
1323 |
+
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
|
1324 |
},
|
1325 |
"dist": {
|
1326 |
"type": "zip",
|
1327 |
+
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
|
1328 |
+
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
|
1329 |
"shasum": ""
|
1330 |
},
|
1331 |
"require": {
|
1332 |
+
"php": ">=5.3.3"
|
1333 |
},
|
1334 |
"require-dev": {
|
1335 |
+
"phpunit/phpunit": "~4.4"
|
1336 |
},
|
1337 |
"type": "library",
|
1338 |
"extra": {
|
1362 |
"environment",
|
1363 |
"hhvm"
|
1364 |
],
|
1365 |
+
"support": {
|
1366 |
+
"issues": "https://github.com/sebastianbergmann/environment/issues",
|
1367 |
+
"source": "https://github.com/sebastianbergmann/environment/tree/1.3.7"
|
1368 |
+
},
|
1369 |
+
"time": "2016-05-17T03:18:57+00:00"
|
1370 |
},
|
1371 |
{
|
1372 |
"name": "sebastian/exporter",
|
1433 |
"export",
|
1434 |
"exporter"
|
1435 |
],
|
1436 |
+
"support": {
|
1437 |
+
"issues": "https://github.com/sebastianbergmann/exporter/issues",
|
1438 |
+
"source": "https://github.com/sebastianbergmann/exporter/tree/master"
|
1439 |
+
},
|
1440 |
"time": "2016-06-17T09:04:28+00:00"
|
1441 |
},
|
1442 |
{
|
1488 |
"keywords": [
|
1489 |
"global state"
|
1490 |
],
|
1491 |
+
"support": {
|
1492 |
+
"issues": "https://github.com/sebastianbergmann/global-state/issues",
|
1493 |
+
"source": "https://github.com/sebastianbergmann/global-state/tree/1.1.1"
|
1494 |
+
},
|
1495 |
"time": "2015-10-12T03:26:01+00:00"
|
1496 |
},
|
1497 |
{
|
1498 |
"name": "sebastian/recursion-context",
|
1499 |
+
"version": "1.0.5",
|
1500 |
"source": {
|
1501 |
"type": "git",
|
1502 |
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
1503 |
+
"reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7"
|
1504 |
},
|
1505 |
"dist": {
|
1506 |
"type": "zip",
|
1507 |
+
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7",
|
1508 |
+
"reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7",
|
1509 |
"shasum": ""
|
1510 |
},
|
1511 |
"require": {
|
1545 |
],
|
1546 |
"description": "Provides functionality to recursively process PHP variables",
|
1547 |
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1548 |
+
"support": {
|
1549 |
+
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
|
1550 |
+
"source": "https://github.com/sebastianbergmann/recursion-context/tree/master"
|
1551 |
+
},
|
1552 |
+
"time": "2016-10-03T07:41:43+00:00"
|
1553 |
},
|
1554 |
{
|
1555 |
"name": "sebastian/version",
|
1584 |
],
|
1585 |
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1586 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1587 |
+
"support": {
|
1588 |
+
"issues": "https://github.com/sebastianbergmann/version/issues",
|
1589 |
+
"source": "https://github.com/sebastianbergmann/version/tree/1.0.6"
|
1590 |
+
},
|
1591 |
"time": "2015-06-21T13:59:46+00:00"
|
1592 |
},
|
1593 |
{
|
1594 |
+
"name": "symfony/polyfill-ctype",
|
1595 |
+
"version": "v1.26.0",
|
1596 |
"source": {
|
1597 |
"type": "git",
|
1598 |
+
"url": "https://github.com/symfony/polyfill-ctype.git",
|
1599 |
+
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4"
|
1600 |
},
|
1601 |
"dist": {
|
1602 |
"type": "zip",
|
1603 |
+
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
|
1604 |
+
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
|
1605 |
"shasum": ""
|
1606 |
},
|
1607 |
"require": {
|
1608 |
+
"php": ">=7.1"
|
|
|
|
|
|
|
1609 |
},
|
1610 |
+
"provide": {
|
1611 |
+
"ext-ctype": "*"
|
1612 |
+
},
|
1613 |
+
"suggest": {
|
1614 |
+
"ext-ctype": "For best performance"
|
1615 |
},
|
|
|
|
|
|
|
|
|
1616 |
"type": "library",
|
1617 |
"extra": {
|
1618 |
"branch-alias": {
|
1619 |
+
"dev-main": "1.26-dev"
|
1620 |
+
},
|
1621 |
+
"thanks": {
|
1622 |
+
"name": "symfony/polyfill",
|
1623 |
+
"url": "https://github.com/symfony/polyfill"
|
1624 |
}
|
1625 |
},
|
1626 |
"autoload": {
|
1627 |
+
"files": [
|
1628 |
+
"bootstrap.php"
|
1629 |
+
],
|
1630 |
+
"psr-4": {
|
1631 |
+
"Symfony\\Polyfill\\Ctype\\": ""
|
1632 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1633 |
},
|
1634 |
"notification-url": "https://packagist.org/downloads/",
|
1635 |
"license": [
|
1636 |
+
"MIT"
|
1637 |
],
|
1638 |
"authors": [
|
1639 |
{
|
1640 |
+
"name": "Gert de Pagter",
|
1641 |
+
"email": "BackEndTea@gmail.com"
|
1642 |
+
},
|
1643 |
+
{
|
1644 |
+
"name": "Symfony Community",
|
1645 |
+
"homepage": "https://symfony.com/contributors"
|
1646 |
}
|
1647 |
],
|
1648 |
+
"description": "Symfony polyfill for ctype functions",
|
1649 |
+
"homepage": "https://symfony.com",
|
1650 |
"keywords": [
|
1651 |
+
"compatibility",
|
1652 |
+
"ctype",
|
1653 |
+
"polyfill",
|
1654 |
+
"portable"
|
1655 |
],
|
1656 |
+
"support": {
|
1657 |
+
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0"
|
1658 |
+
},
|
1659 |
+
"funding": [
|
1660 |
+
{
|
1661 |
+
"url": "https://symfony.com/sponsor",
|
1662 |
+
"type": "custom"
|
1663 |
+
},
|
1664 |
+
{
|
1665 |
+
"url": "https://github.com/fabpot",
|
1666 |
+
"type": "github"
|
1667 |
+
},
|
1668 |
+
{
|
1669 |
+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
1670 |
+
"type": "tidelift"
|
1671 |
+
}
|
1672 |
+
],
|
1673 |
+
"time": "2022-05-24T11:49:31+00:00"
|
1674 |
},
|
1675 |
{
|
1676 |
"name": "symfony/yaml",
|
1677 |
+
"version": "v3.4.47",
|
1678 |
"source": {
|
1679 |
"type": "git",
|
1680 |
"url": "https://github.com/symfony/yaml.git",
|
1681 |
+
"reference": "88289caa3c166321883f67fe5130188ebbb47094"
|
1682 |
},
|
1683 |
"dist": {
|
1684 |
"type": "zip",
|
1685 |
+
"url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094",
|
1686 |
+
"reference": "88289caa3c166321883f67fe5130188ebbb47094",
|
1687 |
"shasum": ""
|
1688 |
},
|
1689 |
"require": {
|
1690 |
+
"php": "^5.5.9|>=7.0.8",
|
1691 |
+
"symfony/polyfill-ctype": "~1.8"
|
1692 |
},
|
1693 |
+
"conflict": {
|
1694 |
+
"symfony/console": "<3.4"
|
1695 |
+
},
|
1696 |
+
"require-dev": {
|
1697 |
+
"symfony/console": "~3.4|~4.0"
|
1698 |
},
|
1699 |
+
"suggest": {
|
1700 |
+
"symfony/console": "For validating YAML files using the lint command"
|
1701 |
+
},
|
1702 |
+
"type": "library",
|
1703 |
"autoload": {
|
1704 |
"psr-4": {
|
1705 |
"Symfony\\Component\\Yaml\\": ""
|
1724 |
],
|
1725 |
"description": "Symfony Yaml Component",
|
1726 |
"homepage": "https://symfony.com",
|
1727 |
+
"support": {
|
1728 |
+
"source": "https://github.com/symfony/yaml/tree/v3.4.47"
|
1729 |
+
},
|
1730 |
+
"funding": [
|
1731 |
+
{
|
1732 |
+
"url": "https://symfony.com/sponsor",
|
1733 |
+
"type": "custom"
|
1734 |
+
},
|
1735 |
+
{
|
1736 |
+
"url": "https://github.com/fabpot",
|
1737 |
+
"type": "github"
|
1738 |
+
},
|
1739 |
+
{
|
1740 |
+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
1741 |
+
"type": "tidelift"
|
1742 |
+
}
|
1743 |
+
],
|
1744 |
+
"time": "2020-10-24T10:57:07+00:00"
|
1745 |
}
|
1746 |
],
|
1747 |
"aliases": [],
|
1750 |
"prefer-stable": false,
|
1751 |
"prefer-lowest": false,
|
1752 |
"platform": {
|
1753 |
+
"php": "^5.4 || ^7.0 || ^8.0"
|
1754 |
},
|
1755 |
+
"platform-dev": [],
|
1756 |
+
"plugin-api-version": "2.0.0"
|
1757 |
}
|
vendor/facebook/graph-sdk/phpcs.xml.dist
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Authentication/AccessToken.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Authentication/AccessTokenMetadata.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Authentication/OAuth2Client.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthenticationException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthorizationException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookClientException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookOtherException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResponseException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookSDKException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookServerException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookThrottleException.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Facebook.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FacebookApp.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FacebookBatchRequest.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FacebookBatchResponse.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FacebookClient.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FacebookRequest.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FacebookResponse.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookFile.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookVideo.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/FileUpload/Mimetypes.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/Birthday.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/Collection.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphApplication.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEdge.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEvent.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphGroup.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphList.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphLocation.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNode.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObject.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPage.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPicture.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphUser.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookJavaScriptHelper.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookPageTabHelper.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Http/GraphRawResponse.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyInterface.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyMultipart.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyUrlEncoded.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurl.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookHttpClientInterface.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStream.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataFactory.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataInterface.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php
CHANGED
@@ -54,7 +54,7 @@ class McryptPseudoRandomStringGenerator implements PseudoRandomStringGeneratorIn
|
|
54 |
{
|
55 |
$this->validateLength($length);
|
56 |
|
57 |
-
$binaryString = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
|
58 |
|
59 |
if ($binaryString === false) {
|
60 |
throw new FacebookSDKException(
|
54 |
{
|
55 |
$this->validateLength($length);
|
56 |
|
57 |
+
$binaryString = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM); // phpcs:ignore
|
58 |
|
59 |
if ($binaryString === false) {
|
60 |
throw new FacebookSDKException(
|
vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/SignedRequest.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Url/FacebookUrlDetectionHandler.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/Url/UrlDetectionInterface.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/autoload.php
CHANGED
File without changes
|
vendor/facebook/graph-sdk/src/Facebook/polyfills.php
CHANGED
File without changes
|
vendor/squizlabs/php_codesniffer/.gitattributes
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
.travis.yml export-ignore
|
2 |
-
package.xml export-ignore
|
3 |
-
phpunit.xml.dist export-ignore
|
4 |
-
php5-testingConfig.ini export-ignore
|
5 |
-
php7-testingConfig.ini export-ignore
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/.gitignore
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/CodeSniffer.conf
|
2 |
-
/phpcs.xml
|
3 |
-
/phpunit.xml
|
4 |
-
.idea/*
|
5 |
-
/vendor/
|
6 |
-
composer.lock
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CONTRIBUTING.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
Contributing
|
2 |
-
-------------
|
3 |
-
|
4 |
-
Before you contribute code to PHP\_CodeSniffer, please make sure it conforms to the PHPCS coding standard and that the PHP\_CodeSniffer unit tests still pass. The easiest way to contribute is to work on a checkout of the repository, or your own fork, rather than an installed PEAR version. If you do this, you can run the following commands to check if everything is ready to submit:
|
5 |
-
|
6 |
-
cd PHP_CodeSniffer
|
7 |
-
php bin/phpcs
|
8 |
-
|
9 |
-
Which should display no coding standard errors. And then:
|
10 |
-
|
11 |
-
phpunit
|
12 |
-
|
13 |
-
Which should give you no failures or errors. You can ignore any skipped tests as these are for external tools.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer.conf.dist
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$phpCodeSnifferConfig = array (
|
3 |
-
'default_standard' => 'PSR2',
|
4 |
-
'report_format' => 'summary',
|
5 |
-
'show_warnings' => '0',
|
6 |
-
'show_progress' => '1',
|
7 |
-
'report_width' => '120',
|
8 |
-
)
|
9 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer.php
DELETED
@@ -1,2578 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* PHP_CodeSniffer tokenizes PHP code and detects violations of a
|
4 |
-
* defined set of coding standards.
|
5 |
-
*
|
6 |
-
* PHP version 5
|
7 |
-
*
|
8 |
-
* @category PHP
|
9 |
-
* @package PHP_CodeSniffer
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
spl_autoload_register(array('PHP_CodeSniffer', 'autoload'));
|
18 |
-
|
19 |
-
if (class_exists('PHP_CodeSniffer_Exception', true) === false) {
|
20 |
-
throw new Exception('Class PHP_CodeSniffer_Exception not found');
|
21 |
-
}
|
22 |
-
|
23 |
-
if (class_exists('PHP_CodeSniffer_File', true) === false) {
|
24 |
-
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_File not found');
|
25 |
-
}
|
26 |
-
|
27 |
-
if (class_exists('PHP_CodeSniffer_Fixer', true) === false) {
|
28 |
-
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_Fixer not found');
|
29 |
-
}
|
30 |
-
|
31 |
-
if (class_exists('PHP_CodeSniffer_Tokens', true) === false) {
|
32 |
-
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_Tokens not found');
|
33 |
-
}
|
34 |
-
|
35 |
-
if (class_exists('PHP_CodeSniffer_CLI', true) === false) {
|
36 |
-
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_CLI not found');
|
37 |
-
}
|
38 |
-
|
39 |
-
if (interface_exists('PHP_CodeSniffer_Sniff', true) === false) {
|
40 |
-
throw new PHP_CodeSniffer_Exception('Interface PHP_CodeSniffer_Sniff not found');
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* PHP_CodeSniffer tokenizes PHP code and detects violations of a
|
45 |
-
* defined set of coding standards.
|
46 |
-
*
|
47 |
-
* Standards are specified by classes that implement the PHP_CodeSniffer_Sniff
|
48 |
-
* interface. A sniff registers what token types it wishes to listen for, then
|
49 |
-
* PHP_CodeSniffer encounters that token, the sniff is invoked and passed
|
50 |
-
* information about where the token was found in the stack, and the token stack
|
51 |
-
* itself.
|
52 |
-
*
|
53 |
-
* Sniff files and their containing class must be prefixed with Sniff, and
|
54 |
-
* have an extension of .php.
|
55 |
-
*
|
56 |
-
* Multiple PHP_CodeSniffer operations can be performed by re-calling the
|
57 |
-
* process function with different parameters.
|
58 |
-
*
|
59 |
-
* @category PHP
|
60 |
-
* @package PHP_CodeSniffer
|
61 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
62 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
63 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
64 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
65 |
-
* @version Release: @package_version@
|
66 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
67 |
-
*/
|
68 |
-
class PHP_CodeSniffer
|
69 |
-
{
|
70 |
-
|
71 |
-
/**
|
72 |
-
* The current version.
|
73 |
-
*
|
74 |
-
* @var string
|
75 |
-
*/
|
76 |
-
const VERSION = '2.9.1';
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Package stability; either stable, beta or alpha.
|
80 |
-
*
|
81 |
-
* @var string
|
82 |
-
*/
|
83 |
-
const STABILITY = 'stable';
|
84 |
-
|
85 |
-
/**
|
86 |
-
* The file or directory that is currently being processed.
|
87 |
-
*
|
88 |
-
* @var string
|
89 |
-
*/
|
90 |
-
protected $file = '';
|
91 |
-
|
92 |
-
/**
|
93 |
-
* The directories that the processed rulesets are in.
|
94 |
-
*
|
95 |
-
* This is declared static because it is also used in the
|
96 |
-
* autoloader to look for sniffs outside the PHPCS install.
|
97 |
-
* This way, standards designed to be installed inside PHPCS can
|
98 |
-
* also be used from outside the PHPCS Standards directory.
|
99 |
-
*
|
100 |
-
* @var string
|
101 |
-
*/
|
102 |
-
protected static $rulesetDirs = array();
|
103 |
-
|
104 |
-
/**
|
105 |
-
* The CLI object controlling the run.
|
106 |
-
*
|
107 |
-
* @var PHP_CodeSniffer_CLI
|
108 |
-
*/
|
109 |
-
public $cli = null;
|
110 |
-
|
111 |
-
/**
|
112 |
-
* The Reporting object controlling report generation.
|
113 |
-
*
|
114 |
-
* @var PHP_CodeSniffer_Reporting
|
115 |
-
*/
|
116 |
-
public $reporting = null;
|
117 |
-
|
118 |
-
/**
|
119 |
-
* An array of sniff objects that are being used to check files.
|
120 |
-
*
|
121 |
-
* @var array(PHP_CodeSniffer_Sniff)
|
122 |
-
*/
|
123 |
-
protected $listeners = array();
|
124 |
-
|
125 |
-
/**
|
126 |
-
* An array of sniffs that are being used to check files.
|
127 |
-
*
|
128 |
-
* @var array(string)
|
129 |
-
*/
|
130 |
-
protected $sniffs = array();
|
131 |
-
|
132 |
-
/**
|
133 |
-
* A mapping of sniff codes to fully qualified class names.
|
134 |
-
*
|
135 |
-
* The key is the sniff code and the value
|
136 |
-
* is the fully qualified name of the sniff class.
|
137 |
-
*
|
138 |
-
* @var array<string, string>
|
139 |
-
*/
|
140 |
-
public $sniffCodes = array();
|
141 |
-
|
142 |
-
/**
|
143 |
-
* The listeners array, indexed by token type.
|
144 |
-
*
|
145 |
-
* @var array
|
146 |
-
*/
|
147 |
-
private $_tokenListeners = array();
|
148 |
-
|
149 |
-
/**
|
150 |
-
* An array of rules from the ruleset.xml file.
|
151 |
-
*
|
152 |
-
* It may be empty, indicating that the ruleset does not override
|
153 |
-
* any of the default sniff settings.
|
154 |
-
*
|
155 |
-
* @var array
|
156 |
-
*/
|
157 |
-
protected $ruleset = array();
|
158 |
-
|
159 |
-
/**
|
160 |
-
* An array of patterns to use for skipping files.
|
161 |
-
*
|
162 |
-
* @var array
|
163 |
-
*/
|
164 |
-
protected $ignorePatterns = array();
|
165 |
-
|
166 |
-
/**
|
167 |
-
* An array of extensions for files we will check.
|
168 |
-
*
|
169 |
-
* @var array
|
170 |
-
*/
|
171 |
-
public $allowedFileExtensions = array();
|
172 |
-
|
173 |
-
/**
|
174 |
-
* An array of default extensions and associated tokenizers.
|
175 |
-
*
|
176 |
-
* If no extensions are set, these will be used as the defaults.
|
177 |
-
* If extensions are set, these will be used when the correct tokenizer
|
178 |
-
* can not be determined, such as when checking a passed filename instead
|
179 |
-
* of files in a directory.
|
180 |
-
*
|
181 |
-
* @var array
|
182 |
-
*/
|
183 |
-
public $defaultFileExtensions = array(
|
184 |
-
'php' => 'PHP',
|
185 |
-
'inc' => 'PHP',
|
186 |
-
'js' => 'JS',
|
187 |
-
'css' => 'CSS',
|
188 |
-
);
|
189 |
-
|
190 |
-
/**
|
191 |
-
* An array of variable types for param/var we will check.
|
192 |
-
*
|
193 |
-
* @var array(string)
|
194 |
-
*/
|
195 |
-
public static $allowedTypes = array(
|
196 |
-
'array',
|
197 |
-
'boolean',
|
198 |
-
'float',
|
199 |
-
'integer',
|
200 |
-
'mixed',
|
201 |
-
'object',
|
202 |
-
'string',
|
203 |
-
'resource',
|
204 |
-
'callable',
|
205 |
-
);
|
206 |
-
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Constructs a PHP_CodeSniffer object.
|
210 |
-
*
|
211 |
-
* @param int $verbosity The verbosity level.
|
212 |
-
* 1: Print progress information.
|
213 |
-
* 2: Print tokenizer debug information.
|
214 |
-
* 3: Print sniff debug information.
|
215 |
-
* @param int $tabWidth The number of spaces each tab represents.
|
216 |
-
* If greater than zero, tabs will be replaced
|
217 |
-
* by spaces before testing each file.
|
218 |
-
* @param string $encoding The charset of the sniffed files.
|
219 |
-
* This is important for some reports that output
|
220 |
-
* with utf-8 encoding as you don't want it double
|
221 |
-
* encoding messages.
|
222 |
-
* @param bool $interactive If TRUE, will stop after each file with errors
|
223 |
-
* and wait for user input.
|
224 |
-
*
|
225 |
-
* @see process()
|
226 |
-
*/
|
227 |
-
public function __construct(
|
228 |
-
$verbosity=0,
|
229 |
-
$tabWidth=0,
|
230 |
-
$encoding='iso-8859-1',
|
231 |
-
$interactive=false
|
232 |
-
) {
|
233 |
-
if ($verbosity !== null) {
|
234 |
-
$this->setVerbosity($verbosity);
|
235 |
-
}
|
236 |
-
|
237 |
-
if ($tabWidth !== null) {
|
238 |
-
$this->setTabWidth($tabWidth);
|
239 |
-
}
|
240 |
-
|
241 |
-
if ($encoding !== null) {
|
242 |
-
$this->setEncoding($encoding);
|
243 |
-
}
|
244 |
-
|
245 |
-
if ($interactive !== null) {
|
246 |
-
$this->setInteractive($interactive);
|
247 |
-
}
|
248 |
-
|
249 |
-
if (defined('PHPCS_DEFAULT_ERROR_SEV') === false) {
|
250 |
-
define('PHPCS_DEFAULT_ERROR_SEV', 5);
|
251 |
-
}
|
252 |
-
|
253 |
-
if (defined('PHPCS_DEFAULT_WARN_SEV') === false) {
|
254 |
-
define('PHPCS_DEFAULT_WARN_SEV', 5);
|
255 |
-
}
|
256 |
-
|
257 |
-
if (defined('PHP_CODESNIFFER_CBF') === false) {
|
258 |
-
define('PHP_CODESNIFFER_CBF', false);
|
259 |
-
}
|
260 |
-
|
261 |
-
// Set default CLI object in case someone is running us
|
262 |
-
// without using the command line script.
|
263 |
-
$this->cli = new PHP_CodeSniffer_CLI();
|
264 |
-
$this->cli->errorSeverity = PHPCS_DEFAULT_ERROR_SEV;
|
265 |
-
$this->cli->warningSeverity = PHPCS_DEFAULT_WARN_SEV;
|
266 |
-
$this->cli->dieOnUnknownArg = false;
|
267 |
-
|
268 |
-
$this->reporting = new PHP_CodeSniffer_Reporting();
|
269 |
-
|
270 |
-
}//end __construct()
|
271 |
-
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Autoload static method for loading classes and interfaces.
|
275 |
-
*
|
276 |
-
* @param string $className The name of the class or interface.
|
277 |
-
*
|
278 |
-
* @return void
|
279 |
-
*/
|
280 |
-
public static function autoload($className)
|
281 |
-
{
|
282 |
-
if (substr($className, 0, 4) === 'PHP_') {
|
283 |
-
$newClassName = substr($className, 4);
|
284 |
-
} else {
|
285 |
-
$newClassName = $className;
|
286 |
-
}
|
287 |
-
|
288 |
-
$path = str_replace(array('_', '\\'), DIRECTORY_SEPARATOR, $newClassName).'.php';
|
289 |
-
|
290 |
-
if (is_file(dirname(__FILE__).DIRECTORY_SEPARATOR.$path) === true) {
|
291 |
-
// Check standard file locations based on class name.
|
292 |
-
include dirname(__FILE__).DIRECTORY_SEPARATOR.$path;
|
293 |
-
return;
|
294 |
-
} else {
|
295 |
-
// Check for included sniffs.
|
296 |
-
$installedPaths = PHP_CodeSniffer::getInstalledStandardPaths();
|
297 |
-
foreach ($installedPaths as $installedPath) {
|
298 |
-
if (is_file($installedPath.DIRECTORY_SEPARATOR.$path) === true) {
|
299 |
-
include $installedPath.DIRECTORY_SEPARATOR.$path;
|
300 |
-
return;
|
301 |
-
}
|
302 |
-
}
|
303 |
-
|
304 |
-
// Check standard file locations based on the loaded rulesets.
|
305 |
-
foreach (self::$rulesetDirs as $rulesetDir) {
|
306 |
-
if (is_file(dirname($rulesetDir).DIRECTORY_SEPARATOR.$path) === true) {
|
307 |
-
include_once dirname($rulesetDir).DIRECTORY_SEPARATOR.$path;
|
308 |
-
return;
|
309 |
-
}
|
310 |
-
}
|
311 |
-
}//end if
|
312 |
-
|
313 |
-
// Everything else.
|
314 |
-
@include $path;
|
315 |
-
|
316 |
-
}//end autoload()
|
317 |
-
|
318 |
-
|
319 |
-
/**
|
320 |
-
* Sets the verbosity level.
|
321 |
-
*
|
322 |
-
* @param int $verbosity The verbosity level.
|
323 |
-
* 1: Print progress information.
|
324 |
-
* 2: Print tokenizer debug information.
|
325 |
-
* 3: Print sniff debug information.
|
326 |
-
*
|
327 |
-
* @return void
|
328 |
-
*/
|
329 |
-
public function setVerbosity($verbosity)
|
330 |
-
{
|
331 |
-
if (defined('PHP_CODESNIFFER_VERBOSITY') === false) {
|
332 |
-
define('PHP_CODESNIFFER_VERBOSITY', $verbosity);
|
333 |
-
}
|
334 |
-
|
335 |
-
}//end setVerbosity()
|
336 |
-
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Sets the tab width.
|
340 |
-
*
|
341 |
-
* @param int $tabWidth The number of spaces each tab represents.
|
342 |
-
* If greater than zero, tabs will be replaced
|
343 |
-
* by spaces before testing each file.
|
344 |
-
*
|
345 |
-
* @return void
|
346 |
-
*/
|
347 |
-
public function setTabWidth($tabWidth)
|
348 |
-
{
|
349 |
-
if (defined('PHP_CODESNIFFER_TAB_WIDTH') === false) {
|
350 |
-
define('PHP_CODESNIFFER_TAB_WIDTH', $tabWidth);
|
351 |
-
}
|
352 |
-
|
353 |
-
}//end setTabWidth()
|
354 |
-
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Sets the encoding.
|
358 |
-
*
|
359 |
-
* @param string $encoding The charset of the sniffed files.
|
360 |
-
* This is important for some reports that output
|
361 |
-
* with utf-8 encoding as you don't want it double
|
362 |
-
* encoding messages.
|
363 |
-
*
|
364 |
-
* @return void
|
365 |
-
*/
|
366 |
-
public function setEncoding($encoding)
|
367 |
-
{
|
368 |
-
if (defined('PHP_CODESNIFFER_ENCODING') === false) {
|
369 |
-
define('PHP_CODESNIFFER_ENCODING', $encoding);
|
370 |
-
}
|
371 |
-
|
372 |
-
}//end setEncoding()
|
373 |
-
|
374 |
-
|
375 |
-
/**
|
376 |
-
* Sets the interactive flag.
|
377 |
-
*
|
378 |
-
* @param bool $interactive If TRUE, will stop after each file with errors
|
379 |
-
* and wait for user input.
|
380 |
-
*
|
381 |
-
* @return void
|
382 |
-
*/
|
383 |
-
public function setInteractive($interactive)
|
384 |
-
{
|
385 |
-
if (defined('PHP_CODESNIFFER_INTERACTIVE') === false) {
|
386 |
-
define('PHP_CODESNIFFER_INTERACTIVE', $interactive);
|
387 |
-
}
|
388 |
-
|
389 |
-
}//end setInteractive()
|
390 |
-
|
391 |
-
|
392 |
-
/**
|
393 |
-
* Sets an array of file extensions that we will allow checking of.
|
394 |
-
*
|
395 |
-
* If the extension is one of the defaults, a specific tokenizer
|
396 |
-
* will be used. Otherwise, the PHP tokenizer will be used for
|
397 |
-
* all extensions passed.
|
398 |
-
*
|
399 |
-
* @param array $extensions An array of file extensions.
|
400 |
-
*
|
401 |
-
* @return void
|
402 |
-
*/
|
403 |
-
public function setAllowedFileExtensions(array $extensions)
|
404 |
-
{
|
405 |
-
$newExtensions = array();
|
406 |
-
foreach ($extensions as $ext) {
|
407 |
-
$slash = strpos($ext, '/');
|
408 |
-
if ($slash !== false) {
|
409 |
-
// They specified the tokenizer too.
|
410 |
-
list($ext, $tokenizer) = explode('/', $ext);
|
411 |
-
$newExtensions[$ext] = strtoupper($tokenizer);
|
412 |
-
continue;
|
413 |
-
}
|
414 |
-
|
415 |
-
if (isset($this->allowedFileExtensions[$ext]) === true) {
|
416 |
-
$newExtensions[$ext] = $this->allowedFileExtensions[$ext];
|
417 |
-
} else if (isset($this->defaultFileExtensions[$ext]) === true) {
|
418 |
-
$newExtensions[$ext] = $this->defaultFileExtensions[$ext];
|
419 |
-
} else {
|
420 |
-
$newExtensions[$ext] = 'PHP';
|
421 |
-
}
|
422 |
-
}
|
423 |
-
|
424 |
-
$this->allowedFileExtensions = $newExtensions;
|
425 |
-
|
426 |
-
}//end setAllowedFileExtensions()
|
427 |
-
|
428 |
-
|
429 |
-
/**
|
430 |
-
* Sets an array of ignore patterns that we use to skip files and folders.
|
431 |
-
*
|
432 |
-
* Patterns are not case sensitive.
|
433 |
-
*
|
434 |
-
* @param array $patterns An array of ignore patterns. The pattern is the key
|
435 |
-
* and the value is either "absolute" or "relative",
|
436 |
-
* depending on how the pattern should be applied to a
|
437 |
-
* file path.
|
438 |
-
*
|
439 |
-
* @return void
|
440 |
-
*/
|
441 |
-
public function setIgnorePatterns(array $patterns)
|
442 |
-
{
|
443 |
-
$this->ignorePatterns = $patterns;
|
444 |
-
|
445 |
-
}//end setIgnorePatterns()
|
446 |
-
|
447 |
-
|
448 |
-
/**
|
449 |
-
* Gets the array of ignore patterns.
|
450 |
-
*
|
451 |
-
* Optionally takes a listener to get ignore patterns specified
|
452 |
-
* for that sniff only.
|
453 |
-
*
|
454 |
-
* @param string $listener The listener to get patterns for. If NULL, all
|
455 |
-
* patterns are returned.
|
456 |
-
*
|
457 |
-
* @return array
|
458 |
-
*/
|
459 |
-
public function getIgnorePatterns($listener=null)
|
460 |
-
{
|
461 |
-
if ($listener === null) {
|
462 |
-
return $this->ignorePatterns;
|
463 |
-
}
|
464 |
-
|
465 |
-
if (isset($this->ignorePatterns[$listener]) === true) {
|
466 |
-
return $this->ignorePatterns[$listener];
|
467 |
-
}
|
468 |
-
|
469 |
-
return array();
|
470 |
-
|
471 |
-
}//end getIgnorePatterns()
|
472 |
-
|
473 |
-
|
474 |
-
/**
|
475 |
-
* Sets the internal CLI object.
|
476 |
-
*
|
477 |
-
* @param object $cli The CLI object controlling the run.
|
478 |
-
*
|
479 |
-
* @return void
|
480 |
-
*/
|
481 |
-
public function setCli($cli)
|
482 |
-
{
|
483 |
-
$this->cli = $cli;
|
484 |
-
|
485 |
-
}//end setCli()
|
486 |
-
|
487 |
-
|
488 |
-
/**
|
489 |
-
* Start a PHP_CodeSniffer run.
|
490 |
-
*
|
491 |
-
* @param string|array $files The files and directories to process. For
|
492 |
-
* directories, each sub directory will also
|
493 |
-
* be traversed for source files.
|
494 |
-
* @param string|array $standards The set of code sniffs we are testing
|
495 |
-
* against.
|
496 |
-
* @param array $restrictions The sniff codes to restrict the
|
497 |
-
* violations to.
|
498 |
-
* @param boolean $local If true, don't recurse into directories.
|
499 |
-
*
|
500 |
-
* @return void
|
501 |
-
*/
|
502 |
-
public function process($files, $standards, array $restrictions=array(), $local=false)
|
503 |
-
{
|
504 |
-
$files = (array) $files;
|
505 |
-
$this->initStandard($standards, $restrictions);
|
506 |
-
$this->processFiles($files, $local);
|
507 |
-
|
508 |
-
}//end process()
|
509 |
-
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Initialise the standard that the run will use.
|
513 |
-
*
|
514 |
-
* @param string|array $standards The set of code sniffs we are testing
|
515 |
-
* against.
|
516 |
-
* @param array $restrictions The sniff codes to restrict the testing to.
|
517 |
-
* @param array $exclusions The sniff codes to exclude from testing.
|
518 |
-
*
|
519 |
-
* @return void
|
520 |
-
*/
|
521 |
-
public function initStandard($standards, array $restrictions=array(), array $exclusions=array())
|
522 |
-
{
|
523 |
-
$standards = (array) $standards;
|
524 |
-
|
525 |
-
// Reset the members.
|
526 |
-
$this->listeners = array();
|
527 |
-
$this->sniffs = array();
|
528 |
-
$this->ruleset = array();
|
529 |
-
$this->_tokenListeners = array();
|
530 |
-
self::$rulesetDirs = array();
|
531 |
-
|
532 |
-
// Ensure this option is enabled or else line endings will not always
|
533 |
-
// be detected properly for files created on a Mac with the /r line ending.
|
534 |
-
ini_set('auto_detect_line_endings', true);
|
535 |
-
|
536 |
-
if (defined('PHP_CODESNIFFER_IN_TESTS') === true && empty($restrictions) === false) {
|
537 |
-
// Should be one standard and one sniff being tested at a time.
|
538 |
-
$installed = $this->getInstalledStandardPath($standards[0]);
|
539 |
-
if ($installed !== null) {
|
540 |
-
$standard = $installed;
|
541 |
-
} else {
|
542 |
-
$standard = self::realpath($standards[0]);
|
543 |
-
if (is_dir($standard) === true
|
544 |
-
&& is_file(self::realpath($standard.DIRECTORY_SEPARATOR.'ruleset.xml')) === true
|
545 |
-
) {
|
546 |
-
$standard = self::realpath($standard.DIRECTORY_SEPARATOR.'ruleset.xml');
|
547 |
-
}
|
548 |
-
}
|
549 |
-
|
550 |
-
$sniffs = $this->_expandRulesetReference($restrictions[0], dirname($standard));
|
551 |
-
} else {
|
552 |
-
$sniffs = array();
|
553 |
-
foreach ($standards as $standard) {
|
554 |
-
$installed = $this->getInstalledStandardPath($standard);
|
555 |
-
if ($installed !== null) {
|
556 |
-
$standard = $installed;
|
557 |
-
} else {
|
558 |
-
$standard = self::realpath($standard);
|
559 |
-
if (is_dir($standard) === true
|
560 |
-
&& is_file(self::realpath($standard.DIRECTORY_SEPARATOR.'ruleset.xml')) === true
|
561 |
-
) {
|
562 |
-
$standard = self::realpath($standard.DIRECTORY_SEPARATOR.'ruleset.xml');
|
563 |
-
}
|
564 |
-
}
|
565 |
-
|
566 |
-
if (PHP_CODESNIFFER_VERBOSITY === 1) {
|
567 |
-
$ruleset = simplexml_load_string(file_get_contents($standard));
|
568 |
-
if ($ruleset !== false) {
|
569 |
-
$standardName = (string) $ruleset['name'];
|
570 |
-
}
|
571 |
-
|
572 |
-
echo "Registering sniffs in the $standardName standard... ";
|
573 |
-
if (count($standards) > 1 || PHP_CODESNIFFER_VERBOSITY > 2) {
|
574 |
-
echo PHP_EOL;
|
575 |
-
}
|
576 |
-
}
|
577 |
-
|
578 |
-
$sniffs = array_merge($sniffs, $this->processRuleset($standard));
|
579 |
-
}//end foreach
|
580 |
-
}//end if
|
581 |
-
|
582 |
-
$sniffRestrictions = array();
|
583 |
-
foreach ($restrictions as $sniffCode) {
|
584 |
-
$parts = explode('.', strtolower($sniffCode));
|
585 |
-
$sniffRestrictions[] = $parts[0].'_sniffs_'.$parts[1].'_'.$parts[2].'sniff';
|
586 |
-
}
|
587 |
-
|
588 |
-
$sniffExclusions = array();
|
589 |
-
foreach ($exclusions as $sniffCode) {
|
590 |
-
$parts = explode('.', strtolower($sniffCode));
|
591 |
-
$sniffExclusions[] = $parts[0].'_sniffs_'.$parts[1].'_'.$parts[2].'sniff';
|
592 |
-
}
|
593 |
-
|
594 |
-
$this->registerSniffs($sniffs, $sniffRestrictions, $sniffExclusions);
|
595 |
-
$this->populateTokenListeners();
|
596 |
-
|
597 |
-
if (PHP_CODESNIFFER_VERBOSITY === 1) {
|
598 |
-
$numSniffs = count($this->sniffs);
|
599 |
-
echo "DONE ($numSniffs sniffs registered)".PHP_EOL;
|
600 |
-
}
|
601 |
-
|
602 |
-
}//end initStandard()
|
603 |
-
|
604 |
-
|
605 |
-
/**
|
606 |
-
* Processes the files/directories that PHP_CodeSniffer was constructed with.
|
607 |
-
*
|
608 |
-
* @param string|array $files The files and directories to process. For
|
609 |
-
* directories, each sub directory will also
|
610 |
-
* be traversed for source files.
|
611 |
-
* @param boolean $local If true, don't recurse into directories.
|
612 |
-
*
|
613 |
-
* @return void
|
614 |
-
* @throws PHP_CodeSniffer_Exception If files are invalid.
|
615 |
-
*/
|
616 |
-
public function processFiles($files, $local=false)
|
617 |
-
{
|
618 |
-
$files = (array) $files;
|
619 |
-
$cliValues = $this->cli->getCommandLineValues();
|
620 |
-
$showProgress = $cliValues['showProgress'];
|
621 |
-
$useColors = $cliValues['colors'];
|
622 |
-
|
623 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0) {
|
624 |
-
echo 'Creating file list... ';
|
625 |
-
}
|
626 |
-
|
627 |
-
if (empty($this->allowedFileExtensions) === true) {
|
628 |
-
$this->allowedFileExtensions = $this->defaultFileExtensions;
|
629 |
-
}
|
630 |
-
|
631 |
-
$todo = $this->getFilesToProcess($files, $local);
|
632 |
-
$numFiles = count($todo);
|
633 |
-
|
634 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0) {
|
635 |
-
echo "DONE ($numFiles files in queue)".PHP_EOL;
|
636 |
-
}
|
637 |
-
|
638 |
-
$numProcessed = 0;
|
639 |
-
$dots = 0;
|
640 |
-
$maxLength = strlen($numFiles);
|
641 |
-
$lastDir = '';
|
642 |
-
foreach ($todo as $file) {
|
643 |
-
$this->file = $file;
|
644 |
-
$currDir = dirname($file);
|
645 |
-
if ($lastDir !== $currDir) {
|
646 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0 || PHP_CODESNIFFER_CBF === true) {
|
647 |
-
echo 'Changing into directory '.$currDir.PHP_EOL;
|
648 |
-
}
|
649 |
-
|
650 |
-
$lastDir = $currDir;
|
651 |
-
}
|
652 |
-
|
653 |
-
$phpcsFile = $this->processFile($file, null);
|
654 |
-
$numProcessed++;
|
655 |
-
|
656 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0
|
657 |
-
|| PHP_CODESNIFFER_INTERACTIVE === true
|
658 |
-
|| $showProgress === false
|
659 |
-
) {
|
660 |
-
continue;
|
661 |
-
}
|
662 |
-
|
663 |
-
// Show progress information.
|
664 |
-
if ($phpcsFile === null) {
|
665 |
-
echo 'S';
|
666 |
-
} else {
|
667 |
-
$errors = $phpcsFile->getErrorCount();
|
668 |
-
$warnings = $phpcsFile->getWarningCount();
|
669 |
-
if ($errors > 0) {
|
670 |
-
if ($useColors === true) {
|
671 |
-
echo "\033[31m";
|
672 |
-
}
|
673 |
-
|
674 |
-
echo 'E';
|
675 |
-
} else if ($warnings > 0) {
|
676 |
-
if ($useColors === true) {
|
677 |
-
echo "\033[33m";
|
678 |
-
}
|
679 |
-
|
680 |
-
echo 'W';
|
681 |
-
} else {
|
682 |
-
echo '.';
|
683 |
-
}
|
684 |
-
|
685 |
-
if ($useColors === true) {
|
686 |
-
echo "\033[0m";
|
687 |
-
}
|
688 |
-
}//end if
|
689 |
-
|
690 |
-
$dots++;
|
691 |
-
if ($dots === 60) {
|
692 |
-
$padding = ($maxLength - strlen($numProcessed));
|
693 |
-
echo str_repeat(' ', $padding);
|
694 |
-
$percent = round(($numProcessed / $numFiles) * 100);
|
695 |
-
echo " $numProcessed / $numFiles ($percent%)".PHP_EOL;
|
696 |
-
$dots = 0;
|
697 |
-
}
|
698 |
-
}//end foreach
|
699 |
-
|
700 |
-
if (PHP_CODESNIFFER_VERBOSITY === 0
|
701 |
-
&& PHP_CODESNIFFER_INTERACTIVE === false
|
702 |
-
&& $showProgress === true
|
703 |
-
) {
|
704 |
-
echo PHP_EOL.PHP_EOL;
|
705 |
-
}
|
706 |
-
|
707 |
-
}//end processFiles()
|
708 |
-
|
709 |
-
|
710 |
-
/**
|
711 |
-
* Processes a single ruleset and returns a list of the sniffs it represents.
|
712 |
-
*
|
713 |
-
* Rules founds within the ruleset are processed immediately, but sniff classes
|
714 |
-
* are not registered by this method.
|
715 |
-
*
|
716 |
-
* @param string $rulesetPath The path to a ruleset XML file.
|
717 |
-
* @param int $depth How many nested processing steps we are in. This
|
718 |
-
* is only used for debug output.
|
719 |
-
*
|
720 |
-
* @return array
|
721 |
-
* @throws PHP_CodeSniffer_Exception If the ruleset path is invalid.
|
722 |
-
*/
|
723 |
-
public function processRuleset($rulesetPath, $depth=0)
|
724 |
-
{
|
725 |
-
$rulesetPath = self::realpath($rulesetPath);
|
726 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
727 |
-
echo str_repeat("\t", $depth);
|
728 |
-
echo "Processing ruleset $rulesetPath".PHP_EOL;
|
729 |
-
}
|
730 |
-
|
731 |
-
$ruleset = simplexml_load_string(file_get_contents($rulesetPath));
|
732 |
-
if ($ruleset === false) {
|
733 |
-
throw new PHP_CodeSniffer_Exception("Ruleset $rulesetPath is not valid");
|
734 |
-
}
|
735 |
-
|
736 |
-
$ownSniffs = array();
|
737 |
-
$includedSniffs = array();
|
738 |
-
$excludedSniffs = array();
|
739 |
-
$cliValues = $this->cli->getCommandLineValues();
|
740 |
-
|
741 |
-
$rulesetDir = dirname($rulesetPath);
|
742 |
-
self::$rulesetDirs[] = $rulesetDir;
|
743 |
-
|
744 |
-
if (is_dir($rulesetDir.DIRECTORY_SEPARATOR.'Sniffs') === true) {
|
745 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
746 |
-
echo str_repeat("\t", $depth);
|
747 |
-
echo "\tAdding sniff files from \"/.../".basename($rulesetDir)."/Sniffs/\" directory".PHP_EOL;
|
748 |
-
}
|
749 |
-
|
750 |
-
$ownSniffs = $this->_expandSniffDirectory($rulesetDir.DIRECTORY_SEPARATOR.'Sniffs', $depth);
|
751 |
-
}
|
752 |
-
|
753 |
-
// Process custom sniff config settings.
|
754 |
-
foreach ($ruleset->{'config'} as $config) {
|
755 |
-
if ($this->_shouldProcessElement($config) === false) {
|
756 |
-
continue;
|
757 |
-
}
|
758 |
-
|
759 |
-
$this->setConfigData((string) $config['name'], (string) $config['value'], true);
|
760 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
761 |
-
echo str_repeat("\t", $depth);
|
762 |
-
echo "\t=> set config value ".(string) $config['name'].': '.(string) $config['value'].PHP_EOL;
|
763 |
-
}
|
764 |
-
}
|
765 |
-
|
766 |
-
foreach ($ruleset->rule as $rule) {
|
767 |
-
if (isset($rule['ref']) === false
|
768 |
-
|| $this->_shouldProcessElement($rule) === false
|
769 |
-
) {
|
770 |
-
continue;
|
771 |
-
}
|
772 |
-
|
773 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
774 |
-
echo str_repeat("\t", $depth);
|
775 |
-
echo "\tProcessing rule \"".$rule['ref'].'"'.PHP_EOL;
|
776 |
-
}
|
777 |
-
|
778 |
-
$includedSniffs = array_merge(
|
779 |
-
$includedSniffs,
|
780 |
-
$this->_expandRulesetReference($rule['ref'], $rulesetDir, $depth)
|
781 |
-
);
|
782 |
-
|
783 |
-
if (isset($rule->exclude) === true) {
|
784 |
-
foreach ($rule->exclude as $exclude) {
|
785 |
-
if ($this->_shouldProcessElement($exclude) === false) {
|
786 |
-
continue;
|
787 |
-
}
|
788 |
-
|
789 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
790 |
-
echo str_repeat("\t", $depth);
|
791 |
-
echo "\t\tExcluding rule \"".$exclude['name'].'"'.PHP_EOL;
|
792 |
-
}
|
793 |
-
|
794 |
-
// Check if a single code is being excluded, which is a shortcut
|
795 |
-
// for setting the severity of the message to 0.
|
796 |
-
$parts = explode('.', $exclude['name']);
|
797 |
-
if (count($parts) === 4) {
|
798 |
-
$this->ruleset[(string) $exclude['name']]['severity'] = 0;
|
799 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
800 |
-
echo str_repeat("\t", $depth);
|
801 |
-
echo "\t\t=> severity set to 0".PHP_EOL;
|
802 |
-
}
|
803 |
-
} else {
|
804 |
-
$excludedSniffs = array_merge(
|
805 |
-
$excludedSniffs,
|
806 |
-
$this->_expandRulesetReference($exclude['name'], $rulesetDir, ($depth + 1))
|
807 |
-
);
|
808 |
-
}
|
809 |
-
}//end foreach
|
810 |
-
}//end if
|
811 |
-
|
812 |
-
$this->_processRule($rule, $depth);
|
813 |
-
}//end foreach
|
814 |
-
|
815 |
-
// Process custom command line arguments.
|
816 |
-
$cliArgs = array();
|
817 |
-
foreach ($ruleset->{'arg'} as $arg) {
|
818 |
-
if ($this->_shouldProcessElement($arg) === false) {
|
819 |
-
continue;
|
820 |
-
}
|
821 |
-
|
822 |
-
if (isset($arg['name']) === true) {
|
823 |
-
$argString = '--'.(string) $arg['name'];
|
824 |
-
if (isset($arg['value']) === true) {
|
825 |
-
$argString .= '='.(string) $arg['value'];
|
826 |
-
}
|
827 |
-
} else {
|
828 |
-
$argString = '-'.(string) $arg['value'];
|
829 |
-
}
|
830 |
-
|
831 |
-
$cliArgs[] = $argString;
|
832 |
-
|
833 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
834 |
-
echo str_repeat("\t", $depth);
|
835 |
-
echo "\t=> set command line value $argString".PHP_EOL;
|
836 |
-
}
|
837 |
-
}//end foreach
|
838 |
-
|
839 |
-
// Set custom php ini values as CLI args.
|
840 |
-
foreach ($ruleset->{'ini'} as $arg) {
|
841 |
-
if ($this->_shouldProcessElement($arg) === false) {
|
842 |
-
continue;
|
843 |
-
}
|
844 |
-
|
845 |
-
if (isset($arg['name']) === false) {
|
846 |
-
continue;
|
847 |
-
}
|
848 |
-
|
849 |
-
$name = (string) $arg['name'];
|
850 |
-
$argString = $name;
|
851 |
-
if (isset($arg['value']) === true) {
|
852 |
-
$value = (string) $arg['value'];
|
853 |
-
$argString .= "=$value";
|
854 |
-
} else {
|
855 |
-
$value = 'true';
|
856 |
-
}
|
857 |
-
|
858 |
-
$cliArgs[] = '-d';
|
859 |
-
$cliArgs[] = $argString;
|
860 |
-
|
861 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
862 |
-
echo str_repeat("\t", $depth);
|
863 |
-
echo "\t=> set PHP ini value $name to $value".PHP_EOL;
|
864 |
-
}
|
865 |
-
}//end foreach
|
866 |
-
|
867 |
-
if (empty($cliValues['files']) === true && $cliValues['stdin'] === null) {
|
868 |
-
// Process hard-coded file paths.
|
869 |
-
foreach ($ruleset->{'file'} as $file) {
|
870 |
-
$file = (string) $file;
|
871 |
-
$cliArgs[] = $file;
|
872 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
873 |
-
echo str_repeat("\t", $depth);
|
874 |
-
echo "\t=> added \"$file\" to the file list".PHP_EOL;
|
875 |
-
}
|
876 |
-
}
|
877 |
-
}
|
878 |
-
|
879 |
-
if (empty($cliArgs) === false) {
|
880 |
-
// Change the directory so all relative paths are worked
|
881 |
-
// out based on the location of the ruleset instead of
|
882 |
-
// the location of the user.
|
883 |
-
$inPhar = self::isPharFile($rulesetDir);
|
884 |
-
if ($inPhar === false) {
|
885 |
-
$currentDir = getcwd();
|
886 |
-
chdir($rulesetDir);
|
887 |
-
}
|
888 |
-
|
889 |
-
$this->cli->setCommandLineValues($cliArgs);
|
890 |
-
|
891 |
-
if ($inPhar === false) {
|
892 |
-
chdir($currentDir);
|
893 |
-
}
|
894 |
-
}
|
895 |
-
|
896 |
-
// Process custom ignore pattern rules.
|
897 |
-
foreach ($ruleset->{'exclude-pattern'} as $pattern) {
|
898 |
-
if ($this->_shouldProcessElement($pattern) === false) {
|
899 |
-
continue;
|
900 |
-
}
|
901 |
-
|
902 |
-
if (isset($pattern['type']) === false) {
|
903 |
-
$pattern['type'] = 'absolute';
|
904 |
-
}
|
905 |
-
|
906 |
-
$this->ignorePatterns[(string) $pattern] = (string) $pattern['type'];
|
907 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
908 |
-
echo str_repeat("\t", $depth);
|
909 |
-
echo "\t=> added global ".(string) $pattern['type'].' ignore pattern: '.(string) $pattern.PHP_EOL;
|
910 |
-
}
|
911 |
-
}
|
912 |
-
|
913 |
-
$includedSniffs = array_unique(array_merge($ownSniffs, $includedSniffs));
|
914 |
-
$excludedSniffs = array_unique($excludedSniffs);
|
915 |
-
|
916 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
917 |
-
$included = count($includedSniffs);
|
918 |
-
$excluded = count($excludedSniffs);
|
919 |
-
echo str_repeat("\t", $depth);
|
920 |
-
echo "=> Ruleset processing complete; included $included sniffs and excluded $excluded".PHP_EOL;
|
921 |
-
}
|
922 |
-
|
923 |
-
// Merge our own sniff list with our externally included
|
924 |
-
// sniff list, but filter out any excluded sniffs.
|
925 |
-
$files = array();
|
926 |
-
foreach ($includedSniffs as $sniff) {
|
927 |
-
if (in_array($sniff, $excludedSniffs) === true) {
|
928 |
-
continue;
|
929 |
-
} else {
|
930 |
-
$files[] = self::realpath($sniff);
|
931 |
-
}
|
932 |
-
}
|
933 |
-
|
934 |
-
return $files;
|
935 |
-
|
936 |
-
}//end processRuleset()
|
937 |
-
|
938 |
-
|
939 |
-
/**
|
940 |
-
* Expands a directory into a list of sniff files within.
|
941 |
-
*
|
942 |
-
* @param string $directory The path to a directory.
|
943 |
-
* @param int $depth How many nested processing steps we are in. This
|
944 |
-
* is only used for debug output.
|
945 |
-
*
|
946 |
-
* @return array
|
947 |
-
*/
|
948 |
-
private function _expandSniffDirectory($directory, $depth=0)
|
949 |
-
{
|
950 |
-
$sniffs = array();
|
951 |
-
|
952 |
-
if (defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS') === true) {
|
953 |
-
$rdi = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
|
954 |
-
} else {
|
955 |
-
$rdi = new RecursiveDirectoryIterator($directory);
|
956 |
-
}
|
957 |
-
|
958 |
-
$di = new RecursiveIteratorIterator($rdi, 0, RecursiveIteratorIterator::CATCH_GET_CHILD);
|
959 |
-
|
960 |
-
$dirLen = strlen($directory);
|
961 |
-
|
962 |
-
foreach ($di as $file) {
|
963 |
-
$filename = $file->getFilename();
|
964 |
-
|
965 |
-
// Skip hidden files.
|
966 |
-
if (substr($filename, 0, 1) === '.') {
|
967 |
-
continue;
|
968 |
-
}
|
969 |
-
|
970 |
-
// We are only interested in PHP and sniff files.
|
971 |
-
$fileParts = explode('.', $filename);
|
972 |
-
if (array_pop($fileParts) !== 'php') {
|
973 |
-
continue;
|
974 |
-
}
|
975 |
-
|
976 |
-
$basename = basename($filename, '.php');
|
977 |
-
if (substr($basename, -5) !== 'Sniff') {
|
978 |
-
continue;
|
979 |
-
}
|
980 |
-
|
981 |
-
$path = $file->getPathname();
|
982 |
-
|
983 |
-
// Skip files in hidden directories within the Sniffs directory of this
|
984 |
-
// standard. We use the offset with strpos() to allow hidden directories
|
985 |
-
// before, valid example:
|
986 |
-
// /home/foo/.composer/vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/...
|
987 |
-
if (strpos($path, DIRECTORY_SEPARATOR.'.', $dirLen) !== false) {
|
988 |
-
continue;
|
989 |
-
}
|
990 |
-
|
991 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
992 |
-
echo str_repeat("\t", $depth);
|
993 |
-
echo "\t\t=> $path".PHP_EOL;
|
994 |
-
}
|
995 |
-
|
996 |
-
$sniffs[] = $path;
|
997 |
-
}//end foreach
|
998 |
-
|
999 |
-
return $sniffs;
|
1000 |
-
|
1001 |
-
}//end _expandSniffDirectory()
|
1002 |
-
|
1003 |
-
|
1004 |
-
/**
|
1005 |
-
* Expands a ruleset reference into a list of sniff files.
|
1006 |
-
*
|
1007 |
-
* @param string $ref The reference from the ruleset XML file.
|
1008 |
-
* @param string $rulesetDir The directory of the ruleset XML file, used to
|
1009 |
-
* evaluate relative paths.
|
1010 |
-
* @param int $depth How many nested processing steps we are in. This
|
1011 |
-
* is only used for debug output.
|
1012 |
-
*
|
1013 |
-
* @return array
|
1014 |
-
* @throws PHP_CodeSniffer_Exception If the reference is invalid.
|
1015 |
-
*/
|
1016 |
-
private function _expandRulesetReference($ref, $rulesetDir, $depth=0)
|
1017 |
-
{
|
1018 |
-
// Ignore internal sniffs codes as they are used to only
|
1019 |
-
// hide and change internal messages.
|
1020 |
-
if (substr($ref, 0, 9) === 'Internal.') {
|
1021 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1022 |
-
echo str_repeat("\t", $depth);
|
1023 |
-
echo "\t\t* ignoring internal sniff code *".PHP_EOL;
|
1024 |
-
}
|
1025 |
-
|
1026 |
-
return array();
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
// As sniffs can't begin with a full stop, assume references in
|
1030 |
-
// this format are relative paths and attempt to convert them
|
1031 |
-
// to absolute paths. If this fails, let the reference run through
|
1032 |
-
// the normal checks and have it fail as normal.
|
1033 |
-
if (substr($ref, 0, 1) === '.') {
|
1034 |
-
$realpath = self::realpath($rulesetDir.'/'.$ref);
|
1035 |
-
if ($realpath !== false) {
|
1036 |
-
$ref = $realpath;
|
1037 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1038 |
-
echo str_repeat("\t", $depth);
|
1039 |
-
echo "\t\t=> $ref".PHP_EOL;
|
1040 |
-
}
|
1041 |
-
}
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
// As sniffs can't begin with a tilde, assume references in
|
1045 |
-
// this format at relative to the user's home directory.
|
1046 |
-
if (substr($ref, 0, 2) === '~/') {
|
1047 |
-
$realpath = self::realpath($ref);
|
1048 |
-
if ($realpath !== false) {
|
1049 |
-
$ref = $realpath;
|
1050 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1051 |
-
echo str_repeat("\t", $depth);
|
1052 |
-
echo "\t\t=> $ref".PHP_EOL;
|
1053 |
-
}
|
1054 |
-
}
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
if (is_file($ref) === true) {
|
1058 |
-
if (substr($ref, -9) === 'Sniff.php') {
|
1059 |
-
// A single external sniff.
|
1060 |
-
self::$rulesetDirs[] = dirname(dirname(dirname($ref)));
|
1061 |
-
return array($ref);
|
1062 |
-
}
|
1063 |
-
} else {
|
1064 |
-
// See if this is a whole standard being referenced.
|
1065 |
-
$path = $this->getInstalledStandardPath($ref);
|
1066 |
-
if (self::isPharFile($path) === true && strpos($path, 'ruleset.xml') === false) {
|
1067 |
-
// If the ruleset exists inside the phar file, use it.
|
1068 |
-
if (file_exists($path.DIRECTORY_SEPARATOR.'ruleset.xml') === true) {
|
1069 |
-
$path = $path.DIRECTORY_SEPARATOR.'ruleset.xml';
|
1070 |
-
} else {
|
1071 |
-
$path = null;
|
1072 |
-
}
|
1073 |
-
}
|
1074 |
-
|
1075 |
-
if ($path !== null) {
|
1076 |
-
$ref = $path;
|
1077 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1078 |
-
echo str_repeat("\t", $depth);
|
1079 |
-
echo "\t\t=> $ref".PHP_EOL;
|
1080 |
-
}
|
1081 |
-
} else if (is_dir($ref) === false) {
|
1082 |
-
// Work out the sniff path.
|
1083 |
-
$sepPos = strpos($ref, DIRECTORY_SEPARATOR);
|
1084 |
-
if ($sepPos !== false) {
|
1085 |
-
$stdName = substr($ref, 0, $sepPos);
|
1086 |
-
$path = substr($ref, $sepPos);
|
1087 |
-
} else {
|
1088 |
-
$parts = explode('.', $ref);
|
1089 |
-
$stdName = $parts[0];
|
1090 |
-
if (count($parts) === 1) {
|
1091 |
-
// A whole standard?
|
1092 |
-
$path = '';
|
1093 |
-
} else if (count($parts) === 2) {
|
1094 |
-
// A directory of sniffs?
|
1095 |
-
$path = DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR.$parts[1];
|
1096 |
-
} else {
|
1097 |
-
// A single sniff?
|
1098 |
-
$path = DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR.$parts[1].DIRECTORY_SEPARATOR.$parts[2].'Sniff.php';
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
-
|
1102 |
-
$newRef = false;
|
1103 |
-
$stdPath = $this->getInstalledStandardPath($stdName);
|
1104 |
-
if ($stdPath !== null && $path !== '') {
|
1105 |
-
if (self::isPharFile($stdPath) === true
|
1106 |
-
&& strpos($stdPath, 'ruleset.xml') === false
|
1107 |
-
) {
|
1108 |
-
// Phar files can only return the directory,
|
1109 |
-
// since ruleset can be omitted if building one standard.
|
1110 |
-
$newRef = self::realpath($stdPath.$path);
|
1111 |
-
} else {
|
1112 |
-
$newRef = self::realpath(dirname($stdPath).$path);
|
1113 |
-
}
|
1114 |
-
}
|
1115 |
-
|
1116 |
-
if ($newRef === false) {
|
1117 |
-
// The sniff is not locally installed, so check if it is being
|
1118 |
-
// referenced as a remote sniff outside the install. We do this
|
1119 |
-
// by looking through all directories where we have found ruleset
|
1120 |
-
// files before, looking for ones for this particular standard,
|
1121 |
-
// and seeing if it is in there.
|
1122 |
-
foreach (self::$rulesetDirs as $dir) {
|
1123 |
-
if (strtolower(basename($dir)) !== strtolower($stdName)) {
|
1124 |
-
continue;
|
1125 |
-
}
|
1126 |
-
|
1127 |
-
$newRef = self::realpath($dir.$path);
|
1128 |
-
|
1129 |
-
if ($newRef !== false) {
|
1130 |
-
$ref = $newRef;
|
1131 |
-
}
|
1132 |
-
}
|
1133 |
-
} else {
|
1134 |
-
$ref = $newRef;
|
1135 |
-
}
|
1136 |
-
|
1137 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1138 |
-
echo str_repeat("\t", $depth);
|
1139 |
-
echo "\t\t=> $ref".PHP_EOL;
|
1140 |
-
}
|
1141 |
-
}//end if
|
1142 |
-
}//end if
|
1143 |
-
|
1144 |
-
if (is_dir($ref) === true) {
|
1145 |
-
if (is_file($ref.DIRECTORY_SEPARATOR.'ruleset.xml') === true) {
|
1146 |
-
// We are referencing an external coding standard.
|
1147 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1148 |
-
echo str_repeat("\t", $depth);
|
1149 |
-
echo "\t\t* rule is referencing a standard using directory name; processing *".PHP_EOL;
|
1150 |
-
}
|
1151 |
-
|
1152 |
-
return $this->processRuleset($ref.DIRECTORY_SEPARATOR.'ruleset.xml', ($depth + 2));
|
1153 |
-
} else {
|
1154 |
-
// We are referencing a whole directory of sniffs.
|
1155 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1156 |
-
echo str_repeat("\t", $depth);
|
1157 |
-
echo "\t\t* rule is referencing a directory of sniffs *".PHP_EOL;
|
1158 |
-
echo str_repeat("\t", $depth);
|
1159 |
-
echo "\t\tAdding sniff files from directory".PHP_EOL;
|
1160 |
-
}
|
1161 |
-
|
1162 |
-
return $this->_expandSniffDirectory($ref, ($depth + 1));
|
1163 |
-
}
|
1164 |
-
} else {
|
1165 |
-
if (is_file($ref) === false) {
|
1166 |
-
$error = "Referenced sniff \"$ref\" does not exist";
|
1167 |
-
throw new PHP_CodeSniffer_Exception($error);
|
1168 |
-
}
|
1169 |
-
|
1170 |
-
if (substr($ref, -9) === 'Sniff.php') {
|
1171 |
-
// A single sniff.
|
1172 |
-
return array($ref);
|
1173 |
-
} else {
|
1174 |
-
// Assume an external ruleset.xml file.
|
1175 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1176 |
-
echo str_repeat("\t", $depth);
|
1177 |
-
echo "\t\t* rule is referencing a standard using ruleset path; processing *".PHP_EOL;
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
return $this->processRuleset($ref, ($depth + 2));
|
1181 |
-
}
|
1182 |
-
}//end if
|
1183 |
-
|
1184 |
-
}//end _expandRulesetReference()
|
1185 |
-
|
1186 |
-
|
1187 |
-
/**
|
1188 |
-
* Processes a rule from a ruleset XML file, overriding built-in defaults.
|
1189 |
-
*
|
1190 |
-
* @param SimpleXMLElement $rule The rule object from a ruleset XML file.
|
1191 |
-
* @param int $depth How many nested processing steps we are in.
|
1192 |
-
* This is only used for debug output.
|
1193 |
-
*
|
1194 |
-
* @return void
|
1195 |
-
*/
|
1196 |
-
private function _processRule($rule, $depth=0)
|
1197 |
-
{
|
1198 |
-
$code = (string) $rule['ref'];
|
1199 |
-
|
1200 |
-
// Custom severity.
|
1201 |
-
if (isset($rule->severity) === true
|
1202 |
-
&& $this->_shouldProcessElement($rule->severity) === true
|
1203 |
-
) {
|
1204 |
-
if (isset($this->ruleset[$code]) === false) {
|
1205 |
-
$this->ruleset[$code] = array();
|
1206 |
-
}
|
1207 |
-
|
1208 |
-
$this->ruleset[$code]['severity'] = (int) $rule->severity;
|
1209 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1210 |
-
echo str_repeat("\t", $depth);
|
1211 |
-
echo "\t\t=> severity set to ".(int) $rule->severity.PHP_EOL;
|
1212 |
-
}
|
1213 |
-
}
|
1214 |
-
|
1215 |
-
// Custom message type.
|
1216 |
-
if (isset($rule->type) === true
|
1217 |
-
&& $this->_shouldProcessElement($rule->type) === true
|
1218 |
-
) {
|
1219 |
-
if (isset($this->ruleset[$code]) === false) {
|
1220 |
-
$this->ruleset[$code] = array();
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
$this->ruleset[$code]['type'] = (string) $rule->type;
|
1224 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1225 |
-
echo str_repeat("\t", $depth);
|
1226 |
-
echo "\t\t=> message type set to ".(string) $rule->type.PHP_EOL;
|
1227 |
-
}
|
1228 |
-
}
|
1229 |
-
|
1230 |
-
// Custom message.
|
1231 |
-
if (isset($rule->message) === true
|
1232 |
-
&& $this->_shouldProcessElement($rule->message) === true
|
1233 |
-
) {
|
1234 |
-
if (isset($this->ruleset[$code]) === false) {
|
1235 |
-
$this->ruleset[$code] = array();
|
1236 |
-
}
|
1237 |
-
|
1238 |
-
$this->ruleset[$code]['message'] = (string) $rule->message;
|
1239 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1240 |
-
echo str_repeat("\t", $depth);
|
1241 |
-
echo "\t\t=> message set to ".(string) $rule->message.PHP_EOL;
|
1242 |
-
}
|
1243 |
-
}
|
1244 |
-
|
1245 |
-
// Custom properties.
|
1246 |
-
if (isset($rule->properties) === true
|
1247 |
-
&& $this->_shouldProcessElement($rule->properties) === true
|
1248 |
-
) {
|
1249 |
-
foreach ($rule->properties->property as $prop) {
|
1250 |
-
if ($this->_shouldProcessElement($prop) === false) {
|
1251 |
-
continue;
|
1252 |
-
}
|
1253 |
-
|
1254 |
-
if (isset($this->ruleset[$code]) === false) {
|
1255 |
-
$this->ruleset[$code] = array(
|
1256 |
-
'properties' => array(),
|
1257 |
-
);
|
1258 |
-
} else if (isset($this->ruleset[$code]['properties']) === false) {
|
1259 |
-
$this->ruleset[$code]['properties'] = array();
|
1260 |
-
}
|
1261 |
-
|
1262 |
-
$name = (string) $prop['name'];
|
1263 |
-
if (isset($prop['type']) === true
|
1264 |
-
&& (string) $prop['type'] === 'array'
|
1265 |
-
) {
|
1266 |
-
$value = (string) $prop['value'];
|
1267 |
-
$values = array();
|
1268 |
-
foreach (explode(',', $value) as $val) {
|
1269 |
-
$v = '';
|
1270 |
-
|
1271 |
-
list($k,$v) = explode('=>', $val.'=>');
|
1272 |
-
if ($v !== '') {
|
1273 |
-
$values[$k] = $v;
|
1274 |
-
} else {
|
1275 |
-
$values[] = $k;
|
1276 |
-
}
|
1277 |
-
}
|
1278 |
-
|
1279 |
-
$this->ruleset[$code]['properties'][$name] = $values;
|
1280 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1281 |
-
echo str_repeat("\t", $depth);
|
1282 |
-
echo "\t\t=> array property \"$name\" set to \"$value\"".PHP_EOL;
|
1283 |
-
}
|
1284 |
-
} else {
|
1285 |
-
$this->ruleset[$code]['properties'][$name] = (string) $prop['value'];
|
1286 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1287 |
-
echo str_repeat("\t", $depth);
|
1288 |
-
echo "\t\t=> property \"$name\" set to \"".(string) $prop['value'].'"'.PHP_EOL;
|
1289 |
-
}
|
1290 |
-
}//end if
|
1291 |
-
}//end foreach
|
1292 |
-
}//end if
|
1293 |
-
|
1294 |
-
// Ignore patterns.
|
1295 |
-
foreach ($rule->{'exclude-pattern'} as $pattern) {
|
1296 |
-
if ($this->_shouldProcessElement($pattern) === false) {
|
1297 |
-
continue;
|
1298 |
-
}
|
1299 |
-
|
1300 |
-
if (isset($this->ignorePatterns[$code]) === false) {
|
1301 |
-
$this->ignorePatterns[$code] = array();
|
1302 |
-
}
|
1303 |
-
|
1304 |
-
if (isset($pattern['type']) === false) {
|
1305 |
-
$pattern['type'] = 'absolute';
|
1306 |
-
}
|
1307 |
-
|
1308 |
-
$this->ignorePatterns[$code][(string) $pattern] = (string) $pattern['type'];
|
1309 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1310 |
-
echo str_repeat("\t", $depth);
|
1311 |
-
echo "\t\t=> added sniff-specific ".(string) $pattern['type'].' ignore pattern: '.(string) $pattern.PHP_EOL;
|
1312 |
-
}
|
1313 |
-
}
|
1314 |
-
|
1315 |
-
}//end _processRule()
|
1316 |
-
|
1317 |
-
|
1318 |
-
/**
|
1319 |
-
* Determine if an element should be processed or ignored.
|
1320 |
-
*
|
1321 |
-
* @param SimpleXMLElement $element An object from a ruleset XML file.
|
1322 |
-
* @param int $depth How many nested processing steps we are in.
|
1323 |
-
* This is only used for debug output.
|
1324 |
-
*
|
1325 |
-
* @return bool
|
1326 |
-
*/
|
1327 |
-
private function _shouldProcessElement($element, $depth=0)
|
1328 |
-
{
|
1329 |
-
if (isset($element['phpcbf-only']) === false
|
1330 |
-
&& isset($element['phpcs-only']) === false
|
1331 |
-
) {
|
1332 |
-
// No exceptions are being made.
|
1333 |
-
return true;
|
1334 |
-
}
|
1335 |
-
|
1336 |
-
if (PHP_CODESNIFFER_CBF === true
|
1337 |
-
&& isset($element['phpcbf-only']) === true
|
1338 |
-
&& (string) $element['phpcbf-only'] === 'true'
|
1339 |
-
) {
|
1340 |
-
return true;
|
1341 |
-
}
|
1342 |
-
|
1343 |
-
if (PHP_CODESNIFFER_CBF === false
|
1344 |
-
&& isset($element['phpcs-only']) === true
|
1345 |
-
&& (string) $element['phpcs-only'] === 'true'
|
1346 |
-
) {
|
1347 |
-
return true;
|
1348 |
-
}
|
1349 |
-
|
1350 |
-
return false;
|
1351 |
-
|
1352 |
-
}//end _shouldProcessElement()
|
1353 |
-
|
1354 |
-
|
1355 |
-
/**
|
1356 |
-
* Loads and stores sniffs objects used for sniffing files.
|
1357 |
-
*
|
1358 |
-
* @param array $files Paths to the sniff files to register.
|
1359 |
-
* @param array $restrictions The sniff class names to restrict the allowed
|
1360 |
-
* listeners to.
|
1361 |
-
* @param array $exclusions The sniff class names to exclude from the
|
1362 |
-
* listeners list.
|
1363 |
-
*
|
1364 |
-
* @return void
|
1365 |
-
* @throws PHP_CodeSniffer_Exception If a sniff file path is invalid.
|
1366 |
-
*/
|
1367 |
-
public function registerSniffs($files, $restrictions, $exclusions)
|
1368 |
-
{
|
1369 |
-
$listeners = array();
|
1370 |
-
|
1371 |
-
foreach ($files as $file) {
|
1372 |
-
// Work out where the position of /StandardName/Sniffs/... is
|
1373 |
-
// so we can determine what the class will be called.
|
1374 |
-
$sniffPos = strrpos($file, DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR);
|
1375 |
-
if ($sniffPos === false) {
|
1376 |
-
continue;
|
1377 |
-
}
|
1378 |
-
|
1379 |
-
$slashPos = strrpos(substr($file, 0, $sniffPos), DIRECTORY_SEPARATOR);
|
1380 |
-
if ($slashPos === false) {
|
1381 |
-
continue;
|
1382 |
-
}
|
1383 |
-
|
1384 |
-
$className = substr($file, ($slashPos + 1));
|
1385 |
-
|
1386 |
-
if (substr_count($className, DIRECTORY_SEPARATOR) !== 3) {
|
1387 |
-
throw new PHP_CodeSniffer_Exception("Sniff file $className is not valid; sniff files must be located in a .../StandardName/Sniffs/CategoryName/ directory");
|
1388 |
-
}
|
1389 |
-
|
1390 |
-
$className = substr($className, 0, -4);
|
1391 |
-
$className = str_replace(DIRECTORY_SEPARATOR, '_', $className);
|
1392 |
-
|
1393 |
-
// If they have specified a list of sniffs to restrict to, check
|
1394 |
-
// to see if this sniff is allowed.
|
1395 |
-
if (empty($restrictions) === false
|
1396 |
-
&& in_array(strtolower($className), $restrictions) === false
|
1397 |
-
) {
|
1398 |
-
continue;
|
1399 |
-
}
|
1400 |
-
|
1401 |
-
// If they have specified a list of sniffs to exclude, check
|
1402 |
-
// to see if this sniff is allowed.
|
1403 |
-
if (empty($exclusions) === false
|
1404 |
-
&& in_array(strtolower($className), $exclusions) === true
|
1405 |
-
) {
|
1406 |
-
continue;
|
1407 |
-
}
|
1408 |
-
|
1409 |
-
include_once $file;
|
1410 |
-
|
1411 |
-
// Support the use of PHP namespaces. If the class name we included
|
1412 |
-
// contains namespace separators instead of underscores, use this as the
|
1413 |
-
// class name from now on.
|
1414 |
-
$classNameNS = str_replace('_', '\\', $className);
|
1415 |
-
if (class_exists($classNameNS, false) === true) {
|
1416 |
-
$className = $classNameNS;
|
1417 |
-
}
|
1418 |
-
|
1419 |
-
// Skip abstract classes.
|
1420 |
-
$reflection = new ReflectionClass($className);
|
1421 |
-
if ($reflection->isAbstract() === true) {
|
1422 |
-
continue;
|
1423 |
-
}
|
1424 |
-
|
1425 |
-
$listeners[$className] = $className;
|
1426 |
-
|
1427 |
-
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
1428 |
-
echo "Registered $className".PHP_EOL;
|
1429 |
-
}
|
1430 |
-
}//end foreach
|
1431 |
-
|
1432 |
-
$this->sniffs = $listeners;
|
1433 |
-
|
1434 |
-
}//end registerSniffs()
|
1435 |
-
|
1436 |
-
|
1437 |
-
/**
|
1438 |
-
* Populates the array of PHP_CodeSniffer_Sniff's for this file.
|
1439 |
-
*
|
1440 |
-
* @return void
|
1441 |
-
* @throws PHP_CodeSniffer_Exception If sniff registration fails.
|
1442 |
-
*/
|
1443 |
-
public function populateTokenListeners()
|
1444 |
-
{
|
1445 |
-
// Construct a list of listeners indexed by token being listened for.
|
1446 |
-
$this->_tokenListeners = array();
|
1447 |
-
|
1448 |
-
foreach ($this->sniffs as $listenerClass) {
|
1449 |
-
// Work out the internal code for this sniff. Detect usage of namespace
|
1450 |
-
// separators instead of underscores to support PHP namespaces.
|
1451 |
-
if (strstr($listenerClass, '\\') === false) {
|
1452 |
-
$parts = explode('_', $listenerClass);
|
1453 |
-
} else {
|
1454 |
-
$parts = explode('\\', $listenerClass);
|
1455 |
-
}
|
1456 |
-
|
1457 |
-
$code = $parts[0].'.'.$parts[2].'.'.$parts[3];
|
1458 |
-
$code = substr($code, 0, -5);
|
1459 |
-
|
1460 |
-
$this->listeners[$listenerClass] = new $listenerClass();
|
1461 |
-
$this->sniffCodes[$code] = $listenerClass;
|
1462 |
-
|
1463 |
-
// Set custom properties.
|
1464 |
-
if (isset($this->ruleset[$code]['properties']) === true) {
|
1465 |
-
foreach ($this->ruleset[$code]['properties'] as $name => $value) {
|
1466 |
-
$this->setSniffProperty($listenerClass, $name, $value);
|
1467 |
-
}
|
1468 |
-
}
|
1469 |
-
|
1470 |
-
$tokenizers = array();
|
1471 |
-
$vars = get_class_vars($listenerClass);
|
1472 |
-
if (isset($vars['supportedTokenizers']) === true) {
|
1473 |
-
foreach ($vars['supportedTokenizers'] as $tokenizer) {
|
1474 |
-
$tokenizers[$tokenizer] = $tokenizer;
|
1475 |
-
}
|
1476 |
-
} else {
|
1477 |
-
$tokenizers = array('PHP' => 'PHP');
|
1478 |
-
}
|
1479 |
-
|
1480 |
-
$tokens = $this->listeners[$listenerClass]->register();
|
1481 |
-
if (is_array($tokens) === false) {
|
1482 |
-
$msg = "Sniff $listenerClass register() method must return an array";
|
1483 |
-
throw new PHP_CodeSniffer_Exception($msg);
|
1484 |
-
}
|
1485 |
-
|
1486 |
-
$parts = explode('_', str_replace('\\', '_', $listenerClass));
|
1487 |
-
$listenerSource = $parts[0].'.'.$parts[2].'.'.substr($parts[3], 0, -5);
|
1488 |
-
$ignorePatterns = array();
|
1489 |
-
$patterns = $this->getIgnorePatterns($listenerSource);
|
1490 |
-
foreach ($patterns as $pattern => $type) {
|
1491 |
-
// While there is support for a type of each pattern
|
1492 |
-
// (absolute or relative) we don't actually support it here.
|
1493 |
-
$replacements = array(
|
1494 |
-
'\\,' => ',',
|
1495 |
-
'*' => '.*',
|
1496 |
-
);
|
1497 |
-
|
1498 |
-
$ignorePatterns[] = strtr($pattern, $replacements);
|
1499 |
-
}
|
1500 |
-
|
1501 |
-
foreach ($tokens as $token) {
|
1502 |
-
if (isset($this->_tokenListeners[$token]) === false) {
|
1503 |
-
$this->_tokenListeners[$token] = array();
|
1504 |
-
}
|
1505 |
-
|
1506 |
-
if (isset($this->_tokenListeners[$token][$listenerClass]) === false) {
|
1507 |
-
$this->_tokenListeners[$token][$listenerClass] = array(
|
1508 |
-
'class' => $listenerClass,
|
1509 |
-
'source' => $listenerSource,
|
1510 |
-
'tokenizers' => $tokenizers,
|
1511 |
-
'ignore' => $ignorePatterns,
|
1512 |
-
);
|
1513 |
-
}
|
1514 |
-
}
|
1515 |
-
}//end foreach
|
1516 |
-
|
1517 |
-
}//end populateTokenListeners()
|
1518 |
-
|
1519 |
-
|
1520 |
-
/**
|
1521 |
-
* Set a single property for a sniff.
|
1522 |
-
*
|
1523 |
-
* @param string $listenerClass The class name of the sniff.
|
1524 |
-
* @param string $name The name of the property to change.
|
1525 |
-
* @param string $value The new value of the property.
|
1526 |
-
*
|
1527 |
-
* @return void
|
1528 |
-
*/
|
1529 |
-
public function setSniffProperty($listenerClass, $name, $value)
|
1530 |
-
{
|
1531 |
-
// Setting a property for a sniff we are not using.
|
1532 |
-
if (isset($this->listeners[$listenerClass]) === false) {
|
1533 |
-
return;
|
1534 |
-
}
|
1535 |
-
|
1536 |
-
$name = trim($name);
|
1537 |
-
if (is_string($value) === true) {
|
1538 |
-
$value = trim($value);
|
1539 |
-
}
|
1540 |
-
|
1541 |
-
// Special case for booleans.
|
1542 |
-
if ($value === 'true') {
|
1543 |
-
$value = true;
|
1544 |
-
} else if ($value === 'false') {
|
1545 |
-
$value = false;
|
1546 |
-
}
|
1547 |
-
|
1548 |
-
$this->listeners[$listenerClass]->$name = $value;
|
1549 |
-
|
1550 |
-
}//end setSniffProperty()
|
1551 |
-
|
1552 |
-
|
1553 |
-
/**
|
1554 |
-
* Get a list of files that will be processed.
|
1555 |
-
*
|
1556 |
-
* If passed directories, this method will find all files within them.
|
1557 |
-
* The method will also perform file extension and ignore pattern filtering.
|
1558 |
-
*
|
1559 |
-
* @param string $paths A list of file or directory paths to process.
|
1560 |
-
* @param boolean $local If true, only process 1 level of files in directories
|
1561 |
-
*
|
1562 |
-
* @return array
|
1563 |
-
* @throws Exception If there was an error opening a directory.
|
1564 |
-
* @see shouldProcessFile()
|
1565 |
-
*/
|
1566 |
-
public function getFilesToProcess($paths, $local=false)
|
1567 |
-
{
|
1568 |
-
$files = array();
|
1569 |
-
|
1570 |
-
foreach ($paths as $path) {
|
1571 |
-
if (is_dir($path) === true || self::isPharFile($path) === true) {
|
1572 |
-
if (self::isPharFile($path) === true) {
|
1573 |
-
$path = 'phar://'.$path;
|
1574 |
-
}
|
1575 |
-
|
1576 |
-
if ($local === true) {
|
1577 |
-
$di = new DirectoryIterator($path);
|
1578 |
-
} else {
|
1579 |
-
$di = new RecursiveIteratorIterator(
|
1580 |
-
new RecursiveDirectoryIterator($path),
|
1581 |
-
0,
|
1582 |
-
RecursiveIteratorIterator::CATCH_GET_CHILD
|
1583 |
-
);
|
1584 |
-
}
|
1585 |
-
|
1586 |
-
foreach ($di as $file) {
|
1587 |
-
// Check if the file exists after all symlinks are resolved.
|
1588 |
-
$filePath = self::realpath($file->getPathname());
|
1589 |
-
if ($filePath === false) {
|
1590 |
-
continue;
|
1591 |
-
}
|
1592 |
-
|
1593 |
-
if (is_dir($filePath) === true) {
|
1594 |
-
continue;
|
1595 |
-
}
|
1596 |
-
|
1597 |
-
if ($this->shouldProcessFile($file->getPathname(), $path) === false) {
|
1598 |
-
continue;
|
1599 |
-
}
|
1600 |
-
|
1601 |
-
$files[] = $file->getPathname();
|
1602 |
-
}//end foreach
|
1603 |
-
} else {
|
1604 |
-
if ($this->shouldIgnoreFile($path, dirname($path)) === true) {
|
1605 |
-
continue;
|
1606 |
-
}
|
1607 |
-
|
1608 |
-
$files[] = $path;
|
1609 |
-
}//end if
|
1610 |
-
}//end foreach
|
1611 |
-
|
1612 |
-
return $files;
|
1613 |
-
|
1614 |
-
}//end getFilesToProcess()
|
1615 |
-
|
1616 |
-
|
1617 |
-
/**
|
1618 |
-
* Checks filtering rules to see if a file should be checked.
|
1619 |
-
*
|
1620 |
-
* Checks both file extension filters and path ignore filters.
|
1621 |
-
*
|
1622 |
-
* @param string $path The path to the file being checked.
|
1623 |
-
* @param string $basedir The directory to use for relative path checks.
|
1624 |
-
*
|
1625 |
-
* @return bool
|
1626 |
-
*/
|
1627 |
-
public function shouldProcessFile($path, $basedir)
|
1628 |
-
{
|
1629 |
-
// Check that the file's extension is one we are checking.
|
1630 |
-
// We are strict about checking the extension and we don't
|
1631 |
-
// let files through with no extension or that start with a dot.
|
1632 |
-
$fileName = basename($path);
|
1633 |
-
$fileParts = explode('.', $fileName);
|
1634 |
-
if ($fileParts[0] === $fileName || $fileParts[0] === '') {
|
1635 |
-
return false;
|
1636 |
-
}
|
1637 |
-
|
1638 |
-
// Checking multi-part file extensions, so need to create a
|
1639 |
-
// complete extension list and make sure one is allowed.
|
1640 |
-
$extensions = array();
|
1641 |
-
array_shift($fileParts);
|
1642 |
-
foreach ($fileParts as $part) {
|
1643 |
-
$extensions[implode('.', $fileParts)] = 1;
|
1644 |
-
array_shift($fileParts);
|
1645 |
-
}
|
1646 |
-
|
1647 |
-
$matches = array_intersect_key($extensions, $this->allowedFileExtensions);
|
1648 |
-
if (empty($matches) === true) {
|
1649 |
-
return false;
|
1650 |
-
}
|
1651 |
-
|
1652 |
-
// If the file's path matches one of our ignore patterns, skip it.
|
1653 |
-
if ($this->shouldIgnoreFile($path, $basedir) === true) {
|
1654 |
-
return false;
|
1655 |
-
}
|
1656 |
-
|
1657 |
-
return true;
|
1658 |
-
|
1659 |
-
}//end shouldProcessFile()
|
1660 |
-
|
1661 |
-
|
1662 |
-
/**
|
1663 |
-
* Checks filtering rules to see if a file should be ignored.
|
1664 |
-
*
|
1665 |
-
* @param string $path The path to the file being checked.
|
1666 |
-
* @param string $basedir The directory to use for relative path checks.
|
1667 |
-
*
|
1668 |
-
* @return bool
|
1669 |
-
*/
|
1670 |
-
public function shouldIgnoreFile($path, $basedir)
|
1671 |
-
{
|
1672 |
-
$relativePath = $path;
|
1673 |
-
if (strpos($path, $basedir) === 0) {
|
1674 |
-
// The +1 cuts off the directory separator as well.
|
1675 |
-
$relativePath = substr($path, (strlen($basedir) + 1));
|
1676 |
-
}
|
1677 |
-
|
1678 |
-
foreach ($this->ignorePatterns as $pattern => $type) {
|
1679 |
-
if (is_array($type) === true) {
|
1680 |
-
// A sniff specific ignore pattern.
|
1681 |
-
continue;
|
1682 |
-
}
|
1683 |
-
|
1684 |
-
// Maintains backwards compatibility in case the ignore pattern does
|
1685 |
-
// not have a relative/absolute value.
|
1686 |
-
if (is_int($pattern) === true) {
|
1687 |
-
$pattern = $type;
|
1688 |
-
$type = 'absolute';
|
1689 |
-
}
|
1690 |
-
|
1691 |
-
$replacements = array(
|
1692 |
-
'\\,' => ',',
|
1693 |
-
'*' => '.*',
|
1694 |
-
);
|
1695 |
-
|
1696 |
-
// We assume a / directory separator, as do the exclude rules
|
1697 |
-
// most developers write, so we need a special case for any system
|
1698 |
-
// that is different.
|
1699 |
-
if (DIRECTORY_SEPARATOR === '\\') {
|
1700 |
-
$replacements['/'] = '\\\\';
|
1701 |
-
}
|
1702 |
-
|
1703 |
-
$pattern = strtr($pattern, $replacements);
|
1704 |
-
|
1705 |
-
if ($type === 'relative') {
|
1706 |
-
$testPath = $relativePath;
|
1707 |
-
} else {
|
1708 |
-
$testPath = $path;
|
1709 |
-
}
|
1710 |
-
|
1711 |
-
$pattern = '`'.$pattern.'`i';
|
1712 |
-
if (preg_match($pattern, $testPath) === 1) {
|
1713 |
-
return true;
|
1714 |
-
}
|
1715 |
-
}//end foreach
|
1716 |
-
|
1717 |
-
return false;
|
1718 |
-
|
1719 |
-
}//end shouldIgnoreFile()
|
1720 |
-
|
1721 |
-
|
1722 |
-
/**
|
1723 |
-
* Run the code sniffs over a single given file.
|
1724 |
-
*
|
1725 |
-
* Processes the file and runs the PHP_CodeSniffer sniffs to verify that it
|
1726 |
-
* conforms with the standard. Returns the processed file object, or NULL
|
1727 |
-
* if no file was processed due to error.
|
1728 |
-
*
|
1729 |
-
* @param string $file The file to process.
|
1730 |
-
* @param string $contents The contents to parse. If NULL, the content
|
1731 |
-
* is taken from the file system.
|
1732 |
-
*
|
1733 |
-
* @return PHP_CodeSniffer_File
|
1734 |
-
* @throws PHP_CodeSniffer_Exception If the file could not be processed.
|
1735 |
-
* @see _processFile()
|
1736 |
-
*/
|
1737 |
-
public function processFile($file, $contents=null)
|
1738 |
-
{
|
1739 |
-
if ($contents === null && file_exists($file) === false) {
|
1740 |
-
throw new PHP_CodeSniffer_Exception("Source file $file does not exist");
|
1741 |
-
}
|
1742 |
-
|
1743 |
-
$filePath = self::realpath($file);
|
1744 |
-
if ($filePath === false) {
|
1745 |
-
$filePath = $file;
|
1746 |
-
}
|
1747 |
-
|
1748 |
-
// Before we go and spend time tokenizing this file, just check
|
1749 |
-
// to see if there is a tag up top to indicate that the whole
|
1750 |
-
// file should be ignored. It must be on one of the first two lines.
|
1751 |
-
$firstContent = $contents;
|
1752 |
-
if ($contents === null && is_readable($filePath) === true) {
|
1753 |
-
$handle = fopen($filePath, 'r');
|
1754 |
-
stream_set_blocking($handle, true);
|
1755 |
-
if ($handle !== false) {
|
1756 |
-
$firstContent = fgets($handle);
|
1757 |
-
$firstContent .= fgets($handle);
|
1758 |
-
fclose($handle);
|
1759 |
-
|
1760 |
-
if (strpos($firstContent, '@codingStandardsIgnoreFile') !== false) {
|
1761 |
-
// We are ignoring the whole file.
|
1762 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0) {
|
1763 |
-
echo 'Ignoring '.basename($filePath).PHP_EOL;
|
1764 |
-
}
|
1765 |
-
|
1766 |
-
return null;
|
1767 |
-
}
|
1768 |
-
}
|
1769 |
-
}//end if
|
1770 |
-
|
1771 |
-
try {
|
1772 |
-
$phpcsFile = $this->_processFile($file, $contents);
|
1773 |
-
} catch (Exception $e) {
|
1774 |
-
$trace = $e->getTrace();
|
1775 |
-
|
1776 |
-
$filename = $trace[0]['args'][0];
|
1777 |
-
if (is_object($filename) === true
|
1778 |
-
&& get_class($filename) === 'PHP_CodeSniffer_File'
|
1779 |
-
) {
|
1780 |
-
$filename = $filename->getFilename();
|
1781 |
-
} else if (is_numeric($filename) === true) {
|
1782 |
-
// See if we can find the PHP_CodeSniffer_File object.
|
1783 |
-
foreach ($trace as $data) {
|
1784 |
-
if (isset($data['args'][0]) === true
|
1785 |
-
&& ($data['args'][0] instanceof PHP_CodeSniffer_File) === true
|
1786 |
-
) {
|
1787 |
-
$filename = $data['args'][0]->getFilename();
|
1788 |
-
}
|
1789 |
-
}
|
1790 |
-
} else if (is_string($filename) === false) {
|
1791 |
-
$filename = (string) $filename;
|
1792 |
-
}
|
1793 |
-
|
1794 |
-
$errorMessage = '"'.$e->getMessage().'" at '.$e->getFile().':'.$e->getLine();
|
1795 |
-
$error = "An error occurred during processing; checking has been aborted. The error message was: $errorMessage";
|
1796 |
-
|
1797 |
-
$phpcsFile = new PHP_CodeSniffer_File(
|
1798 |
-
$filename,
|
1799 |
-
$this->_tokenListeners,
|
1800 |
-
$this->ruleset,
|
1801 |
-
$this
|
1802 |
-
);
|
1803 |
-
|
1804 |
-
$phpcsFile->addError($error, null, 'Internal.Exception');
|
1805 |
-
}//end try
|
1806 |
-
|
1807 |
-
$cliValues = $this->cli->getCommandLineValues();
|
1808 |
-
|
1809 |
-
if (PHP_CODESNIFFER_INTERACTIVE === false) {
|
1810 |
-
// Cache the report data for this file so we can unset it to save memory.
|
1811 |
-
$this->reporting->cacheFileReport($phpcsFile, $cliValues);
|
1812 |
-
$phpcsFile->cleanUp();
|
1813 |
-
return $phpcsFile;
|
1814 |
-
}
|
1815 |
-
|
1816 |
-
/*
|
1817 |
-
Running interactively.
|
1818 |
-
Print the error report for the current file and then wait for user input.
|
1819 |
-
*/
|
1820 |
-
|
1821 |
-
// Get current violations and then clear the list to make sure
|
1822 |
-
// we only print violations for a single file each time.
|
1823 |
-
$numErrors = null;
|
1824 |
-
while ($numErrors !== 0) {
|
1825 |
-
$numErrors = ($phpcsFile->getErrorCount() + $phpcsFile->getWarningCount());
|
1826 |
-
if ($numErrors === 0) {
|
1827 |
-
continue;
|
1828 |
-
}
|
1829 |
-
|
1830 |
-
$reportClass = $this->reporting->factory('full');
|
1831 |
-
$reportData = $this->reporting->prepareFileReport($phpcsFile);
|
1832 |
-
$reportClass->generateFileReport($reportData, $phpcsFile, $cliValues['showSources'], $cliValues['reportWidth']);
|
1833 |
-
|
1834 |
-
echo '<ENTER> to recheck, [s] to skip or [q] to quit : ';
|
1835 |
-
$input = fgets(STDIN);
|
1836 |
-
$input = trim($input);
|
1837 |
-
|
1838 |
-
switch ($input) {
|
1839 |
-
case 's':
|
1840 |
-
break(2);
|
1841 |
-
case 'q':
|
1842 |
-
exit(0);
|
1843 |
-
break;
|
1844 |
-
default:
|
1845 |
-
// Repopulate the sniffs because some of them save their state
|
1846 |
-
// and only clear it when the file changes, but we are rechecking
|
1847 |
-
// the same file.
|
1848 |
-
$this->populateTokenListeners();
|
1849 |
-
$phpcsFile = $this->_processFile($file, $contents);
|
1850 |
-
break;
|
1851 |
-
}
|
1852 |
-
}//end while
|
1853 |
-
|
1854 |
-
return $phpcsFile;
|
1855 |
-
|
1856 |
-
}//end processFile()
|
1857 |
-
|
1858 |
-
|
1859 |
-
/**
|
1860 |
-
* Process the sniffs for a single file.
|
1861 |
-
*
|
1862 |
-
* Does raw processing only. No interactive support or error checking.
|
1863 |
-
*
|
1864 |
-
* @param string $file The file to process.
|
1865 |
-
* @param string $contents The contents to parse. If NULL, the content
|
1866 |
-
* is taken from the file system.
|
1867 |
-
*
|
1868 |
-
* @return PHP_CodeSniffer_File
|
1869 |
-
* @see processFile()
|
1870 |
-
*/
|
1871 |
-
private function _processFile($file, $contents)
|
1872 |
-
{
|
1873 |
-
$stdin = false;
|
1874 |
-
$cliValues = $this->cli->getCommandLineValues();
|
1875 |
-
if (empty($cliValues['files']) === true) {
|
1876 |
-
$stdin = true;
|
1877 |
-
}
|
1878 |
-
|
1879 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0 || (PHP_CODESNIFFER_CBF === true && $stdin === false)) {
|
1880 |
-
$startTime = microtime(true);
|
1881 |
-
echo 'Processing '.basename($file).' ';
|
1882 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1883 |
-
echo PHP_EOL;
|
1884 |
-
}
|
1885 |
-
}
|
1886 |
-
|
1887 |
-
$phpcsFile = new PHP_CodeSniffer_File(
|
1888 |
-
$file,
|
1889 |
-
$this->_tokenListeners,
|
1890 |
-
$this->ruleset,
|
1891 |
-
$this
|
1892 |
-
);
|
1893 |
-
|
1894 |
-
$phpcsFile->start($contents);
|
1895 |
-
|
1896 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0 || (PHP_CODESNIFFER_CBF === true && $stdin === false)) {
|
1897 |
-
$timeTaken = ((microtime(true) - $startTime) * 1000);
|
1898 |
-
if ($timeTaken < 1000) {
|
1899 |
-
$timeTaken = round($timeTaken);
|
1900 |
-
echo "DONE in {$timeTaken}ms";
|
1901 |
-
} else {
|
1902 |
-
$timeTaken = round(($timeTaken / 1000), 2);
|
1903 |
-
echo "DONE in $timeTaken secs";
|
1904 |
-
}
|
1905 |
-
|
1906 |
-
if (PHP_CODESNIFFER_CBF === true) {
|
1907 |
-
$errors = $phpcsFile->getFixableCount();
|
1908 |
-
echo " ($errors fixable violations)".PHP_EOL;
|
1909 |
-
} else {
|
1910 |
-
$errors = $phpcsFile->getErrorCount();
|
1911 |
-
$warnings = $phpcsFile->getWarningCount();
|
1912 |
-
echo " ($errors errors, $warnings warnings)".PHP_EOL;
|
1913 |
-
}
|
1914 |
-
}
|
1915 |
-
|
1916 |
-
return $phpcsFile;
|
1917 |
-
|
1918 |
-
}//end _processFile()
|
1919 |
-
|
1920 |
-
|
1921 |
-
/**
|
1922 |
-
* Generates documentation for a coding standard.
|
1923 |
-
*
|
1924 |
-
* @param string $standard The standard to generate docs for
|
1925 |
-
* @param array $sniffs A list of sniffs to limit the docs to.
|
1926 |
-
* @param string $generator The name of the generator class to use.
|
1927 |
-
*
|
1928 |
-
* @return void
|
1929 |
-
*/
|
1930 |
-
public function generateDocs($standard, array $sniffs=array(), $generator='Text')
|
1931 |
-
{
|
1932 |
-
if (class_exists('PHP_CodeSniffer_DocGenerators_'.$generator, true) === false) {
|
1933 |
-
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_DocGenerators_'.$generator.' not found');
|
1934 |
-
}
|
1935 |
-
|
1936 |
-
$class = "PHP_CodeSniffer_DocGenerators_$generator";
|
1937 |
-
$generator = new $class($standard, $sniffs);
|
1938 |
-
|
1939 |
-
$generator->generate();
|
1940 |
-
|
1941 |
-
}//end generateDocs()
|
1942 |
-
|
1943 |
-
|
1944 |
-
/**
|
1945 |
-
* Gets the array of PHP_CodeSniffer_Sniff's.
|
1946 |
-
*
|
1947 |
-
* @return PHP_CodeSniffer_Sniff[]
|
1948 |
-
*/
|
1949 |
-
public function getSniffs()
|
1950 |
-
{
|
1951 |
-
return $this->listeners;
|
1952 |
-
|
1953 |
-
}//end getSniffs()
|
1954 |
-
|
1955 |
-
|
1956 |
-
/**
|
1957 |
-
* Gets the array of PHP_CodeSniffer_Sniff's indexed by token type.
|
1958 |
-
*
|
1959 |
-
* @return array
|
1960 |
-
*/
|
1961 |
-
public function getTokenSniffs()
|
1962 |
-
{
|
1963 |
-
return $this->_tokenListeners;
|
1964 |
-
|
1965 |
-
}//end getTokenSniffs()
|
1966 |
-
|
1967 |
-
|
1968 |
-
/**
|
1969 |
-
* Returns true if the specified string is in the camel caps format.
|
1970 |
-
*
|
1971 |
-
* @param string $string The string the verify.
|
1972 |
-
* @param boolean $classFormat If true, check to see if the string is in the
|
1973 |
-
* class format. Class format strings must start
|
1974 |
-
* with a capital letter and contain no
|
1975 |
-
* underscores.
|
1976 |
-
* @param boolean $public If true, the first character in the string
|
1977 |
-
* must be an a-z character. If false, the
|
1978 |
-
* character must be an underscore. This
|
1979 |
-
* argument is only applicable if $classFormat
|
1980 |
-
* is false.
|
1981 |
-
* @param boolean $strict If true, the string must not have two capital
|
1982 |
-
* letters next to each other. If false, a
|
1983 |
-
* relaxed camel caps policy is used to allow
|
1984 |
-
* for acronyms.
|
1985 |
-
*
|
1986 |
-
* @return boolean
|
1987 |
-
*/
|
1988 |
-
public static function isCamelCaps(
|
1989 |
-
$string,
|
1990 |
-
$classFormat=false,
|
1991 |
-
$public=true,
|
1992 |
-
$strict=true
|
1993 |
-
) {
|
1994 |
-
// Check the first character first.
|
1995 |
-
if ($classFormat === false) {
|
1996 |
-
$legalFirstChar = '';
|
1997 |
-
if ($public === false) {
|
1998 |
-
$legalFirstChar = '[_]';
|
1999 |
-
}
|
2000 |
-
|
2001 |
-
if ($strict === false) {
|
2002 |
-
// Can either start with a lowercase letter, or multiple uppercase
|
2003 |
-
// in a row, representing an acronym.
|
2004 |
-
$legalFirstChar .= '([A-Z]{2,}|[a-z])';
|
2005 |
-
} else {
|
2006 |
-
$legalFirstChar .= '[a-z]';
|
2007 |
-
}
|
2008 |
-
} else {
|
2009 |
-
$legalFirstChar = '[A-Z]';
|
2010 |
-
}
|
2011 |
-
|
2012 |
-
if (preg_match("/^$legalFirstChar/", $string) === 0) {
|
2013 |
-
return false;
|
2014 |
-
}
|
2015 |
-
|
2016 |
-
// Check that the name only contains legal characters.
|
2017 |
-
$legalChars = 'a-zA-Z0-9';
|
2018 |
-
if (preg_match("|[^$legalChars]|", substr($string, 1)) > 0) {
|
2019 |
-
return false;
|
2020 |
-
}
|
2021 |
-
|
2022 |
-
if ($strict === true) {
|
2023 |
-
// Check that there are not two capital letters next to each other.
|
2024 |
-
$length = strlen($string);
|
2025 |
-
$lastCharWasCaps = $classFormat;
|
2026 |
-
|
2027 |
-
for ($i = 1; $i < $length; $i++) {
|
2028 |
-
$ascii = ord($string{$i});
|
2029 |
-
if ($ascii >= 48 && $ascii <= 57) {
|
2030 |
-
// The character is a number, so it cant be a capital.
|
2031 |
-
$isCaps = false;
|
2032 |
-
} else {
|
2033 |
-
if (strtoupper($string{$i}) === $string{$i}) {
|
2034 |
-
$isCaps = true;
|
2035 |
-
} else {
|
2036 |
-
$isCaps = false;
|
2037 |
-
}
|
2038 |
-
}
|
2039 |
-
|
2040 |
-
if ($isCaps === true && $lastCharWasCaps === true) {
|
2041 |
-
return false;
|
2042 |
-
}
|
2043 |
-
|
2044 |
-
$lastCharWasCaps = $isCaps;
|
2045 |
-
}
|
2046 |
-
}//end if
|
2047 |
-
|
2048 |
-
return true;
|
2049 |
-
|
2050 |
-
}//end isCamelCaps()
|
2051 |
-
|
2052 |
-
|
2053 |
-
/**
|
2054 |
-
* Returns true if the specified string is in the underscore caps format.
|
2055 |
-
*
|
2056 |
-
* @param string $string The string to verify.
|
2057 |
-
*
|
2058 |
-
* @return boolean
|
2059 |
-
*/
|
2060 |
-
public static function isUnderscoreName($string)
|
2061 |
-
{
|
2062 |
-
// If there are space in the name, it can't be valid.
|
2063 |
-
if (strpos($string, ' ') !== false) {
|
2064 |
-
return false;
|
2065 |
-
}
|
2066 |
-
|
2067 |
-
$validName = true;
|
2068 |
-
$nameBits = explode('_', $string);
|
2069 |
-
|
2070 |
-
if (preg_match('|^[A-Z]|', $string) === 0) {
|
2071 |
-
// Name does not begin with a capital letter.
|
2072 |
-
$validName = false;
|
2073 |
-
} else {
|
2074 |
-
foreach ($nameBits as $bit) {
|
2075 |
-
if ($bit === '') {
|
2076 |
-
continue;
|
2077 |
-
}
|
2078 |
-
|
2079 |
-
if ($bit{0} !== strtoupper($bit{0})) {
|
2080 |
-
$validName = false;
|
2081 |
-
break;
|
2082 |
-
}
|
2083 |
-
}
|
2084 |
-
}
|
2085 |
-
|
2086 |
-
return $validName;
|
2087 |
-
|
2088 |
-
}//end isUnderscoreName()
|
2089 |
-
|
2090 |
-
|
2091 |
-
/**
|
2092 |
-
* Returns a valid variable type for param/var tag.
|
2093 |
-
*
|
2094 |
-
* If type is not one of the standard type, it must be a custom type.
|
2095 |
-
* Returns the correct type name suggestion if type name is invalid.
|
2096 |
-
*
|
2097 |
-
* @param string $varType The variable type to process.
|
2098 |
-
*
|
2099 |
-
* @return string
|
2100 |
-
*/
|
2101 |
-
public static function suggestType($varType)
|
2102 |
-
{
|
2103 |
-
if ($varType === '') {
|
2104 |
-
return '';
|
2105 |
-
}
|
2106 |
-
|
2107 |
-
if (in_array($varType, self::$allowedTypes) === true) {
|
2108 |
-
return $varType;
|
2109 |
-
} else {
|
2110 |
-
$lowerVarType = strtolower($varType);
|
2111 |
-
switch ($lowerVarType) {
|
2112 |
-
case 'bool':
|
2113 |
-
case 'boolean':
|
2114 |
-
return 'boolean';
|
2115 |
-
case 'double':
|
2116 |
-
case 'real':
|
2117 |
-
case 'float':
|
2118 |
-
return 'float';
|
2119 |
-
case 'int':
|
2120 |
-
case 'integer':
|
2121 |
-
return 'integer';
|
2122 |
-
case 'array()':
|
2123 |
-
case 'array':
|
2124 |
-
return 'array';
|
2125 |
-
}//end switch
|
2126 |
-
|
2127 |
-
if (strpos($lowerVarType, 'array(') !== false) {
|
2128 |
-
// Valid array declaration:
|
2129 |
-
// array, array(type), array(type1 => type2).
|
2130 |
-
$matches = array();
|
2131 |
-
$pattern = '/^array\(\s*([^\s^=^>]*)(\s*=>\s*(.*))?\s*\)/i';
|
2132 |
-
if (preg_match($pattern, $varType, $matches) !== 0) {
|
2133 |
-
$type1 = '';
|
2134 |
-
if (isset($matches[1]) === true) {
|
2135 |
-
$type1 = $matches[1];
|
2136 |
-
}
|
2137 |
-
|
2138 |
-
$type2 = '';
|
2139 |
-
if (isset($matches[3]) === true) {
|
2140 |
-
$type2 = $matches[3];
|
2141 |
-
}
|
2142 |
-
|
2143 |
-
$type1 = self::suggestType($type1);
|
2144 |
-
$type2 = self::suggestType($type2);
|
2145 |
-
if ($type2 !== '') {
|
2146 |
-
$type2 = ' => '.$type2;
|
2147 |
-
}
|
2148 |
-
|
2149 |
-
return "array($type1$type2)";
|
2150 |
-
} else {
|
2151 |
-
return 'array';
|
2152 |
-
}//end if
|
2153 |
-
} else if (in_array($lowerVarType, self::$allowedTypes) === true) {
|
2154 |
-
// A valid type, but not lower cased.
|
2155 |
-
return $lowerVarType;
|
2156 |
-
} else {
|
2157 |
-
// Must be a custom type name.
|
2158 |
-
return $varType;
|
2159 |
-
}//end if
|
2160 |
-
}//end if
|
2161 |
-
|
2162 |
-
}//end suggestType()
|
2163 |
-
|
2164 |
-
|
2165 |
-
/**
|
2166 |
-
* Prepares token content for output to screen.
|
2167 |
-
*
|
2168 |
-
* Replaces invisible characters so they are visible. On non-Windows
|
2169 |
-
* OSes it will also colour the invisible characters.
|
2170 |
-
*
|
2171 |
-
* @param string $content The content to prepare.
|
2172 |
-
*
|
2173 |
-
* @return string
|
2174 |
-
*/
|
2175 |
-
public static function prepareForOutput($content)
|
2176 |
-
{
|
2177 |
-
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
2178 |
-
$content = str_replace("\r", '\r', $content);
|
2179 |
-
$content = str_replace("\n", '\n', $content);
|
2180 |
-
$content = str_replace("\t", '\t', $content);
|
2181 |
-
} else {
|
2182 |
-
$content = str_replace("\r", "\033[30;1m\\r\033[0m", $content);
|
2183 |
-
$content = str_replace("\n", "\033[30;1m\\n\033[0m", $content);
|
2184 |
-
$content = str_replace("\t", "\033[30;1m\\t\033[0m", $content);
|
2185 |
-
$content = str_replace(' ', "\033[30;1m·\033[0m", $content);
|
2186 |
-
}
|
2187 |
-
|
2188 |
-
return $content;
|
2189 |
-
|
2190 |
-
}//end prepareForOutput()
|
2191 |
-
|
2192 |
-
|
2193 |
-
/**
|
2194 |
-
* Get a list paths where standards are installed.
|
2195 |
-
*
|
2196 |
-
* @return array
|
2197 |
-
*/
|
2198 |
-
public static function getInstalledStandardPaths()
|
2199 |
-
{
|
2200 |
-
$installedPaths = array(dirname(__FILE__).DIRECTORY_SEPARATOR.'CodeSniffer'.DIRECTORY_SEPARATOR.'Standards');
|
2201 |
-
$configPaths = PHP_CodeSniffer::getConfigData('installed_paths');
|
2202 |
-
if ($configPaths !== null) {
|
2203 |
-
$installedPaths = array_merge($installedPaths, explode(',', $configPaths));
|
2204 |
-
}
|
2205 |
-
|
2206 |
-
$resolvedInstalledPaths = array();
|
2207 |
-
foreach ($installedPaths as $installedPath) {
|
2208 |
-
if (substr($installedPath, 0, 1) === '.') {
|
2209 |
-
$installedPath = dirname(__FILE__).DIRECTORY_SEPARATOR.$installedPath;
|
2210 |
-
}
|
2211 |
-
|
2212 |
-
$resolvedInstalledPaths[] = $installedPath;
|
2213 |
-
}
|
2214 |
-
|
2215 |
-
return $resolvedInstalledPaths;
|
2216 |
-
|
2217 |
-
}//end getInstalledStandardPaths()
|
2218 |
-
|
2219 |
-
|
2220 |
-
/**
|
2221 |
-
* Get a list of all coding standards installed.
|
2222 |
-
*
|
2223 |
-
* Coding standards are directories located in the
|
2224 |
-
* CodeSniffer/Standards directory. Valid coding standards
|
2225 |
-
* include a Sniffs subdirectory.
|
2226 |
-
*
|
2227 |
-
* @param boolean $includeGeneric If true, the special "Generic"
|
2228 |
-
* coding standard will be included
|
2229 |
-
* if installed.
|
2230 |
-
* @param string $standardsDir A specific directory to look for standards
|
2231 |
-
* in. If not specified, PHP_CodeSniffer will
|
2232 |
-
* look in its default locations.
|
2233 |
-
*
|
2234 |
-
* @return array
|
2235 |
-
* @see isInstalledStandard()
|
2236 |
-
*/
|
2237 |
-
public static function getInstalledStandards(
|
2238 |
-
$includeGeneric=false,
|
2239 |
-
$standardsDir=''
|
2240 |
-
) {
|
2241 |
-
$installedStandards = array();
|
2242 |
-
|
2243 |
-
if ($standardsDir === '') {
|
2244 |
-
$installedPaths = self::getInstalledStandardPaths();
|
2245 |
-
} else {
|
2246 |
-
$installedPaths = array($standardsDir);
|
2247 |
-
}
|
2248 |
-
|
2249 |
-
foreach ($installedPaths as $standardsDir) {
|
2250 |
-
$di = new DirectoryIterator($standardsDir);
|
2251 |
-
foreach ($di as $file) {
|
2252 |
-
if ($file->isDir() === true && $file->isDot() === false) {
|
2253 |
-
$filename = $file->getFilename();
|
2254 |
-
|
2255 |
-
// Ignore the special "Generic" standard.
|
2256 |
-
if ($includeGeneric === false && $filename === 'Generic') {
|
2257 |
-
continue;
|
2258 |
-
}
|
2259 |
-
|
2260 |
-
// Valid coding standard dirs include a ruleset.
|
2261 |
-
$csFile = $file->getPathname().'/ruleset.xml';
|
2262 |
-
if (is_file($csFile) === true) {
|
2263 |
-
$installedStandards[] = $filename;
|
2264 |
-
}
|
2265 |
-
}
|
2266 |
-
}
|
2267 |
-
}//end foreach
|
2268 |
-
|
2269 |
-
return $installedStandards;
|
2270 |
-
|
2271 |
-
}//end getInstalledStandards()
|
2272 |
-
|
2273 |
-
|
2274 |
-
/**
|
2275 |
-
* Determine if a standard is installed.
|
2276 |
-
*
|
2277 |
-
* Coding standards are directories located in the
|
2278 |
-
* CodeSniffer/Standards directory. Valid coding standards
|
2279 |
-
* include a ruleset.xml file.
|
2280 |
-
*
|
2281 |
-
* @param string $standard The name of the coding standard.
|
2282 |
-
*
|
2283 |
-
* @return boolean
|
2284 |
-
* @see getInstalledStandards()
|
2285 |
-
*/
|
2286 |
-
public static function isInstalledStandard($standard)
|
2287 |
-
{
|
2288 |
-
$path = self::getInstalledStandardPath($standard);
|
2289 |
-
if ($path !== null && strpos($path, 'ruleset.xml') !== false) {
|
2290 |
-
return true;
|
2291 |
-
} else {
|
2292 |
-
// This could be a custom standard, installed outside our
|
2293 |
-
// standards directory.
|
2294 |
-
$standard = self::realPath($standard);
|
2295 |
-
|
2296 |
-
// Might be an actual ruleset file itself.
|
2297 |
-
// If it has an XML extension, let's at least try it.
|
2298 |
-
if (is_file($standard) === true
|
2299 |
-
&& (substr(strtolower($standard), -4) === '.xml'
|
2300 |
-
|| substr(strtolower($standard), -9) === '.xml.dist')
|
2301 |
-
) {
|
2302 |
-
return true;
|
2303 |
-
}
|
2304 |
-
|
2305 |
-
// If it is a directory with a ruleset.xml file in it,
|
2306 |
-
// it is a standard.
|
2307 |
-
$ruleset = rtrim($standard, ' /\\').DIRECTORY_SEPARATOR.'ruleset.xml';
|
2308 |
-
if (is_file($ruleset) === true) {
|
2309 |
-
return true;
|
2310 |
-
}
|
2311 |
-
}//end if
|
2312 |
-
|
2313 |
-
return false;
|
2314 |
-
|
2315 |
-
}//end isInstalledStandard()
|
2316 |
-
|
2317 |
-
|
2318 |
-
/**
|
2319 |
-
* Return the path of an installed coding standard.
|
2320 |
-
*
|
2321 |
-
* Coding standards are directories located in the
|
2322 |
-
* CodeSniffer/Standards directory. Valid coding standards
|
2323 |
-
* include a ruleset.xml file.
|
2324 |
-
*
|
2325 |
-
* @param string $standard The name of the coding standard.
|
2326 |
-
*
|
2327 |
-
* @return string|null
|
2328 |
-
*/
|
2329 |
-
public static function getInstalledStandardPath($standard)
|
2330 |
-
{
|
2331 |
-
$installedPaths = self::getInstalledStandardPaths();
|
2332 |
-
foreach ($installedPaths as $installedPath) {
|
2333 |
-
$standardPath = $installedPath.DIRECTORY_SEPARATOR.$standard;
|
2334 |
-
$path = self::realpath($standardPath.DIRECTORY_SEPARATOR.'ruleset.xml');
|
2335 |
-
if (is_file($path) === true) {
|
2336 |
-
return $path;
|
2337 |
-
} else if (self::isPharFile($standardPath) === true) {
|
2338 |
-
$path = self::realpath($standardPath);
|
2339 |
-
if ($path !== false) {
|
2340 |
-
return $path;
|
2341 |
-
}
|
2342 |
-
}
|
2343 |
-
}
|
2344 |
-
|
2345 |
-
return null;
|
2346 |
-
|
2347 |
-
}//end getInstalledStandardPath()
|
2348 |
-
|
2349 |
-
|
2350 |
-
/**
|
2351 |
-
* Get a single config value.
|
2352 |
-
*
|
2353 |
-
* Config data is stored in the data dir, in a file called
|
2354 |
-
* CodeSniffer.conf. It is a simple PHP array.
|
2355 |
-
*
|
2356 |
-
* @param string $key The name of the config value.
|
2357 |
-
*
|
2358 |
-
* @return string|null
|
2359 |
-
* @see setConfigData()
|
2360 |
-
* @see getAllConfigData()
|
2361 |
-
*/
|
2362 |
-
public static function getConfigData($key)
|
2363 |
-
{
|
2364 |
-
$phpCodeSnifferConfig = self::getAllConfigData();
|
2365 |
-
|
2366 |
-
if ($phpCodeSnifferConfig === null) {
|
2367 |
-
return null;
|
2368 |
-
}
|
2369 |
-
|
2370 |
-
if (isset($phpCodeSnifferConfig[$key]) === false) {
|
2371 |
-
return null;
|
2372 |
-
}
|
2373 |
-
|
2374 |
-
return $phpCodeSnifferConfig[$key];
|
2375 |
-
|
2376 |
-
}//end getConfigData()
|
2377 |
-
|
2378 |
-
|
2379 |
-
/**
|
2380 |
-
* Set a single config value.
|
2381 |
-
*
|
2382 |
-
* Config data is stored in the data dir, in a file called
|
2383 |
-
* CodeSniffer.conf. It is a simple PHP array.
|
2384 |
-
*
|
2385 |
-
* @param string $key The name of the config value.
|
2386 |
-
* @param string|null $value The value to set. If null, the config
|
2387 |
-
* entry is deleted, reverting it to the
|
2388 |
-
* default value.
|
2389 |
-
* @param boolean $temp Set this config data temporarily for this
|
2390 |
-
* script run. This will not write the config
|
2391 |
-
* data to the config file.
|
2392 |
-
*
|
2393 |
-
* @return boolean
|
2394 |
-
* @see getConfigData()
|
2395 |
-
* @throws PHP_CodeSniffer_Exception If the config file can not be written.
|
2396 |
-
*/
|
2397 |
-
public static function setConfigData($key, $value, $temp=false)
|
2398 |
-
{
|
2399 |
-
if ($temp === false) {
|
2400 |
-
$path = '';
|
2401 |
-
if (is_callable('Phar::running') === true) {
|
2402 |
-
$path = Phar::running(false);
|
2403 |
-
}
|
2404 |
-
|
2405 |
-
if ($path !== '') {
|
2406 |
-
$configFile = dirname($path).'/CodeSniffer.conf';
|
2407 |
-
} else {
|
2408 |
-
$configFile = dirname(__FILE__).'/CodeSniffer.conf';
|
2409 |
-
if (is_file($configFile) === false
|
2410 |
-
&& strpos('@data_dir@', '@data_dir') === false
|
2411 |
-
) {
|
2412 |
-
// If data_dir was replaced, this is a PEAR install and we can
|
2413 |
-
// use the PEAR data dir to store the conf file.
|
2414 |
-
$configFile = '@data_dir@/PHP_CodeSniffer/CodeSniffer.conf';
|
2415 |
-
}
|
2416 |
-
}
|
2417 |
-
|
2418 |
-
if (is_file($configFile) === true
|
2419 |
-
&& is_writable($configFile) === false
|
2420 |
-
) {
|
2421 |
-
$error = 'Config file '.$configFile.' is not writable';
|
2422 |
-
throw new PHP_CodeSniffer_Exception($error);
|
2423 |
-
}
|
2424 |
-
}//end if
|
2425 |
-
|
2426 |
-
$phpCodeSnifferConfig = self::getAllConfigData();
|
2427 |
-
|
2428 |
-
if ($value === null) {
|
2429 |
-
if (isset($phpCodeSnifferConfig[$key]) === true) {
|
2430 |
-
unset($phpCodeSnifferConfig[$key]);
|
2431 |
-
}
|
2432 |
-
} else {
|
2433 |
-
$phpCodeSnifferConfig[$key] = $value;
|
2434 |
-
}
|
2435 |
-
|
2436 |
-
if ($temp === false) {
|
2437 |
-
$output = '<'.'?php'."\n".' $phpCodeSnifferConfig = ';
|
2438 |
-
$output .= var_export($phpCodeSnifferConfig, true);
|
2439 |
-
$output .= "\n?".'>';
|
2440 |
-
|
2441 |
-
if (file_put_contents($configFile, $output) === false) {
|
2442 |
-
return false;
|
2443 |
-
}
|
2444 |
-
}
|
2445 |
-
|
2446 |
-
$GLOBALS['PHP_CODESNIFFER_CONFIG_DATA'] = $phpCodeSnifferConfig;
|
2447 |
-
|
2448 |
-
return true;
|
2449 |
-
|
2450 |
-
}//end setConfigData()
|
2451 |
-
|
2452 |
-
|
2453 |
-
/**
|
2454 |
-
* Get all config data in an array.
|
2455 |
-
*
|
2456 |
-
* @return array<string, string>
|
2457 |
-
* @see getConfigData()
|
2458 |
-
*/
|
2459 |
-
public static function getAllConfigData()
|
2460 |
-
{
|
2461 |
-
if (isset($GLOBALS['PHP_CODESNIFFER_CONFIG_DATA']) === true) {
|
2462 |
-
return $GLOBALS['PHP_CODESNIFFER_CONFIG_DATA'];
|
2463 |
-
}
|
2464 |
-
|
2465 |
-
$path = '';
|
2466 |
-
if (is_callable('Phar::running') === true) {
|
2467 |
-
$path = Phar::running(false);
|
2468 |
-
}
|
2469 |
-
|
2470 |
-
if ($path !== '') {
|
2471 |
-
$configFile = dirname($path).'/CodeSniffer.conf';
|
2472 |
-
} else {
|
2473 |
-
$configFile = dirname(__FILE__).'/CodeSniffer.conf';
|
2474 |
-
if (is_file($configFile) === false) {
|
2475 |
-
$configFile = '@data_dir@/PHP_CodeSniffer/CodeSniffer.conf';
|
2476 |
-
}
|
2477 |
-
}
|
2478 |
-
|
2479 |
-
if (is_file($configFile) === false) {
|
2480 |
-
$GLOBALS['PHP_CODESNIFFER_CONFIG_DATA'] = array();
|
2481 |
-
return array();
|
2482 |
-
}
|
2483 |
-
|
2484 |
-
include $configFile;
|
2485 |
-
$GLOBALS['PHP_CODESNIFFER_CONFIG_DATA'] = $phpCodeSnifferConfig;
|
2486 |
-
return $GLOBALS['PHP_CODESNIFFER_CONFIG_DATA'];
|
2487 |
-
|
2488 |
-
}//end getAllConfigData()
|
2489 |
-
|
2490 |
-
|
2491 |
-
/**
|
2492 |
-
* Return TRUE, if the path is a phar file.
|
2493 |
-
*
|
2494 |
-
* @param string $path The path to use.
|
2495 |
-
*
|
2496 |
-
* @return mixed
|
2497 |
-
*/
|
2498 |
-
public static function isPharFile($path)
|
2499 |
-
{
|
2500 |
-
if (strpos($path, 'phar://') === 0) {
|
2501 |
-
return true;
|
2502 |
-
}
|
2503 |
-
|
2504 |
-
return false;
|
2505 |
-
|
2506 |
-
}//end isPharFile()
|
2507 |
-
|
2508 |
-
|
2509 |
-
/**
|
2510 |
-
* CodeSniffer alternative for realpath.
|
2511 |
-
*
|
2512 |
-
* Allows for phar support.
|
2513 |
-
*
|
2514 |
-
* @param string $path The path to use.
|
2515 |
-
*
|
2516 |
-
* @return mixed
|
2517 |
-
*/
|
2518 |
-
public static function realpath($path)
|
2519 |
-
{
|
2520 |
-
// Support the path replacement of ~ with the user's home directory.
|
2521 |
-
if (substr($path, 0, 2) === '~/') {
|
2522 |
-
$homeDir = getenv('HOME');
|
2523 |
-
if ($homeDir !== false) {
|
2524 |
-
$path = $homeDir.substr($path, 1);
|
2525 |
-
}
|
2526 |
-
}
|
2527 |
-
|
2528 |
-
// No extra work needed if this is not a phar file.
|
2529 |
-
if (self::isPharFile($path) === false) {
|
2530 |
-
return realpath($path);
|
2531 |
-
}
|
2532 |
-
|
2533 |
-
// Before trying to break down the file path,
|
2534 |
-
// check if it exists first because it will mostly not
|
2535 |
-
// change after running the below code.
|
2536 |
-
if (file_exists($path) === true) {
|
2537 |
-
return $path;
|
2538 |
-
}
|
2539 |
-
|
2540 |
-
$phar = Phar::running(false);
|
2541 |
-
$extra = str_replace('phar://'.$phar, '', $path);
|
2542 |
-
$path = realpath($phar);
|
2543 |
-
if ($path === false) {
|
2544 |
-
return false;
|
2545 |
-
}
|
2546 |
-
|
2547 |
-
$path = 'phar://'.$path.$extra;
|
2548 |
-
if (file_exists($path) === true) {
|
2549 |
-
return $path;
|
2550 |
-
}
|
2551 |
-
|
2552 |
-
return false;
|
2553 |
-
|
2554 |
-
}//end realpath()
|
2555 |
-
|
2556 |
-
|
2557 |
-
/**
|
2558 |
-
* CodeSniffer alternative for chdir().
|
2559 |
-
*
|
2560 |
-
* Allows for phar support.
|
2561 |
-
*
|
2562 |
-
* @param string $path The path to use.
|
2563 |
-
*
|
2564 |
-
* @return void
|
2565 |
-
*/
|
2566 |
-
public static function chdir($path)
|
2567 |
-
{
|
2568 |
-
if (self::isPharFile($path) === true) {
|
2569 |
-
$phar = Phar::running(false);
|
2570 |
-
chdir(dirname($phar));
|
2571 |
-
} else {
|
2572 |
-
chdir($path);
|
2573 |
-
}
|
2574 |
-
|
2575 |
-
}//end chdir()
|
2576 |
-
|
2577 |
-
|
2578 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/CLI.php
DELETED
@@ -1,1444 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A class to process command line phpcs scripts.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
10 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
11 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
12 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
13 |
-
*/
|
14 |
-
|
15 |
-
error_reporting(E_ALL | E_STRICT);
|
16 |
-
|
17 |
-
// Make sure version id constant is available.
|
18 |
-
if (defined('PHP_VERSION_ID') === false) {
|
19 |
-
$version = explode('.', PHP_VERSION);
|
20 |
-
define('PHP_VERSION_ID', (int) (($version[0] * 10000) + ($version[1] * 100) + $version[2]));
|
21 |
-
unset($version);
|
22 |
-
}
|
23 |
-
|
24 |
-
// Make sure that we autoload all dependencies if running via Composer.
|
25 |
-
if (PHP_VERSION_ID >= 50302) {
|
26 |
-
if (file_exists($a = dirname(__FILE__).'/../../../autoload.php') === true) {
|
27 |
-
include_once $a;
|
28 |
-
} else if (file_exists($a = dirname(__FILE__).'/../vendor/autoload.php') === true) {
|
29 |
-
include_once $a;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
if (file_exists($a = dirname(__FILE__).'/../CodeSniffer.php') === true) {
|
34 |
-
// Running from a git clone.
|
35 |
-
include_once $a;
|
36 |
-
} else {
|
37 |
-
// PEAR installed.
|
38 |
-
include_once 'PHP/CodeSniffer.php';
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* A class to process command line phpcs scripts.
|
43 |
-
*
|
44 |
-
* @category PHP
|
45 |
-
* @package PHP_CodeSniffer
|
46 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
47 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
48 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
49 |
-
* @version Release: @package_version@
|
50 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
51 |
-
*/
|
52 |
-
class PHP_CodeSniffer_CLI
|
53 |
-
{
|
54 |
-
|
55 |
-
/**
|
56 |
-
* An array of all values specified on the command line.
|
57 |
-
*
|
58 |
-
* @var array
|
59 |
-
*/
|
60 |
-
protected $values = array();
|
61 |
-
|
62 |
-
/**
|
63 |
-
* The minimum severity level errors must have to be displayed.
|
64 |
-
*
|
65 |
-
* @var bool
|
66 |
-
*/
|
67 |
-
public $errorSeverity = 0;
|
68 |
-
|
69 |
-
/**
|
70 |
-
* The minimum severity level warnings must have to be displayed.
|
71 |
-
*
|
72 |
-
* @var bool
|
73 |
-
*/
|
74 |
-
public $warningSeverity = 0;
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Whether or not to kill the process when an unknown command line arg is found.
|
78 |
-
*
|
79 |
-
* If FALSE, arguments that are not command line options or file/directory paths
|
80 |
-
* will be ignored and execution will continue.
|
81 |
-
*
|
82 |
-
* @var bool
|
83 |
-
*/
|
84 |
-
public $dieOnUnknownArg = true;
|
85 |
-
|
86 |
-
/**
|
87 |
-
* An array of the current command line arguments we are processing.
|
88 |
-
*
|
89 |
-
* @var array
|
90 |
-
*/
|
91 |
-
private $_cliArgs = array();
|
92 |
-
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Run the PHPCS script.
|
96 |
-
*
|
97 |
-
* @return array
|
98 |
-
*/
|
99 |
-
public function runphpcs()
|
100 |
-
{
|
101 |
-
if (defined('PHP_CODESNIFFER_CBF') === false) {
|
102 |
-
define('PHP_CODESNIFFER_CBF', false);
|
103 |
-
}
|
104 |
-
|
105 |
-
if (is_file(dirname(__FILE__).'/../CodeSniffer/Reporting.php') === true) {
|
106 |
-
include_once dirname(__FILE__).'/../CodeSniffer/Reporting.php';
|
107 |
-
} else {
|
108 |
-
include_once 'PHP/CodeSniffer/Reporting.php';
|
109 |
-
}
|
110 |
-
|
111 |
-
PHP_CodeSniffer_Reporting::startTiming();
|
112 |
-
$this->checkRequirements();
|
113 |
-
$numErrors = $this->process();
|
114 |
-
if ($numErrors === 0) {
|
115 |
-
exit(0);
|
116 |
-
} else {
|
117 |
-
exit(1);
|
118 |
-
}
|
119 |
-
|
120 |
-
}//end runphpcs()
|
121 |
-
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Run the PHPCBF script.
|
125 |
-
*
|
126 |
-
* @return array
|
127 |
-
*/
|
128 |
-
public function runphpcbf()
|
129 |
-
{
|
130 |
-
if (defined('PHP_CODESNIFFER_CBF') === false) {
|
131 |
-
define('PHP_CODESNIFFER_CBF', true);
|
132 |
-
}
|
133 |
-
|
134 |
-
if (is_file(dirname(__FILE__).'/../CodeSniffer/Reporting.php') === true) {
|
135 |
-
include_once dirname(__FILE__).'/../CodeSniffer/Reporting.php';
|
136 |
-
} else {
|
137 |
-
include_once 'PHP/CodeSniffer/Reporting.php';
|
138 |
-
}
|
139 |
-
|
140 |
-
PHP_CodeSniffer_Reporting::startTiming();
|
141 |
-
$this->checkRequirements();
|
142 |
-
|
143 |
-
$this->dieOnUnknownArg = false;
|
144 |
-
|
145 |
-
// Override some of the command line settings that might break the fixes.
|
146 |
-
$cliValues = $this->getCommandLineValues();
|
147 |
-
$cliValues['verbosity'] = 0;
|
148 |
-
$cliValues['showProgress'] = false;
|
149 |
-
$cliValues['generator'] = '';
|
150 |
-
$cliValues['explain'] = false;
|
151 |
-
$cliValues['interactive'] = false;
|
152 |
-
$cliValues['showSources'] = false;
|
153 |
-
$cliValues['reportFile'] = null;
|
154 |
-
$cliValues['reports'] = array();
|
155 |
-
|
156 |
-
$suffix = '';
|
157 |
-
if (isset($cliValues['suffix']) === true) {
|
158 |
-
$suffix = $cliValues['suffix'];
|
159 |
-
}
|
160 |
-
|
161 |
-
$allowPatch = true;
|
162 |
-
if (isset($cliValues['no-patch']) === true || empty($cliValues['files']) === true) {
|
163 |
-
// They either asked for this,
|
164 |
-
// or they are using STDIN, which can't use diff.
|
165 |
-
$allowPatch = false;
|
166 |
-
}
|
167 |
-
|
168 |
-
if ($suffix === '' && $allowPatch === true) {
|
169 |
-
// Using the diff/patch tools.
|
170 |
-
$diffFile = getcwd().'/phpcbf-fixed.diff';
|
171 |
-
$cliValues['reports'] = array('diff' => $diffFile);
|
172 |
-
if (file_exists($diffFile) === true) {
|
173 |
-
unlink($diffFile);
|
174 |
-
}
|
175 |
-
} else {
|
176 |
-
// Replace the file without the patch command
|
177 |
-
// or writing to a file with a new suffix.
|
178 |
-
$cliValues['reports'] = array('cbf' => null);
|
179 |
-
$cliValues['phpcbf-suffix'] = $suffix;
|
180 |
-
}
|
181 |
-
|
182 |
-
$numErrors = $this->process($cliValues);
|
183 |
-
|
184 |
-
if ($suffix === '' && $allowPatch === true) {
|
185 |
-
if (file_exists($diffFile) === false) {
|
186 |
-
// Nothing to fix.
|
187 |
-
if ($numErrors === 0) {
|
188 |
-
// And no errors reported.
|
189 |
-
$exit = 0;
|
190 |
-
} else {
|
191 |
-
// Errors we can't fix.
|
192 |
-
$exit = 2;
|
193 |
-
}
|
194 |
-
} else {
|
195 |
-
if (filesize($diffFile) < 10) {
|
196 |
-
// Empty or bad diff file.
|
197 |
-
if ($numErrors === 0) {
|
198 |
-
// And no errors reported.
|
199 |
-
$exit = 0;
|
200 |
-
} else {
|
201 |
-
// Errors we can't fix.
|
202 |
-
$exit = 2;
|
203 |
-
}
|
204 |
-
} else {
|
205 |
-
$cmd = "patch -p0 -ui \"$diffFile\"";
|
206 |
-
$output = array();
|
207 |
-
$retVal = null;
|
208 |
-
exec($cmd, $output, $retVal);
|
209 |
-
|
210 |
-
if ($retVal === 0) {
|
211 |
-
// Everything went well.
|
212 |
-
$filesPatched = count($output);
|
213 |
-
echo "Patched $filesPatched file";
|
214 |
-
if ($filesPatched > 1) {
|
215 |
-
echo 's';
|
216 |
-
}
|
217 |
-
|
218 |
-
echo PHP_EOL;
|
219 |
-
$exit = 1;
|
220 |
-
} else {
|
221 |
-
print_r($output);
|
222 |
-
echo "Returned: $retVal".PHP_EOL;
|
223 |
-
$exit = 3;
|
224 |
-
}
|
225 |
-
}//end if
|
226 |
-
|
227 |
-
unlink($diffFile);
|
228 |
-
}//end if
|
229 |
-
} else {
|
230 |
-
// File are being patched manually, so we can't tell
|
231 |
-
// how many errors were fixed.
|
232 |
-
$exit = 1;
|
233 |
-
}//end if
|
234 |
-
|
235 |
-
if ($exit === 0) {
|
236 |
-
echo 'No fixable errors were found'.PHP_EOL;
|
237 |
-
} else if ($exit === 2) {
|
238 |
-
echo 'PHPCBF could not fix all the errors found'.PHP_EOL;
|
239 |
-
}
|
240 |
-
|
241 |
-
PHP_CodeSniffer_Reporting::printRunTime();
|
242 |
-
exit($exit);
|
243 |
-
|
244 |
-
}//end runphpcbf()
|
245 |
-
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Exits if the minimum requirements of PHP_CodSniffer are not met.
|
249 |
-
*
|
250 |
-
* @return array
|
251 |
-
*/
|
252 |
-
public function checkRequirements()
|
253 |
-
{
|
254 |
-
// Check the PHP version.
|
255 |
-
if (PHP_VERSION_ID < 50102) {
|
256 |
-
echo 'ERROR: PHP_CodeSniffer requires PHP version 5.1.2 or greater.'.PHP_EOL;
|
257 |
-
exit(2);
|
258 |
-
}
|
259 |
-
|
260 |
-
if (extension_loaded('tokenizer') === false) {
|
261 |
-
echo 'ERROR: PHP_CodeSniffer requires the tokenizer extension to be enabled.'.PHP_EOL;
|
262 |
-
exit(2);
|
263 |
-
}
|
264 |
-
|
265 |
-
}//end checkRequirements()
|
266 |
-
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Get a list of default values for all possible command line arguments.
|
270 |
-
*
|
271 |
-
* @return array
|
272 |
-
*/
|
273 |
-
public function getDefaults()
|
274 |
-
{
|
275 |
-
if (defined('PHP_CODESNIFFER_IN_TESTS') === true) {
|
276 |
-
return array();
|
277 |
-
}
|
278 |
-
|
279 |
-
// The default values for config settings.
|
280 |
-
$defaults['files'] = array();
|
281 |
-
$defaults['standard'] = null;
|
282 |
-
$defaults['verbosity'] = 0;
|
283 |
-
$defaults['interactive'] = false;
|
284 |
-
$defaults['colors'] = false;
|
285 |
-
$defaults['explain'] = false;
|
286 |
-
$defaults['local'] = false;
|
287 |
-
$defaults['showSources'] = false;
|
288 |
-
$defaults['extensions'] = array();
|
289 |
-
$defaults['sniffs'] = array();
|
290 |
-
$defaults['exclude'] = array();
|
291 |
-
$defaults['ignored'] = array();
|
292 |
-
$defaults['reportFile'] = null;
|
293 |
-
$defaults['generator'] = '';
|
294 |
-
$defaults['reports'] = array();
|
295 |
-
$defaults['bootstrap'] = array();
|
296 |
-
$defaults['errorSeverity'] = null;
|
297 |
-
$defaults['warningSeverity'] = null;
|
298 |
-
$defaults['stdin'] = null;
|
299 |
-
$defaults['stdinPath'] = '';
|
300 |
-
|
301 |
-
$reportFormat = PHP_CodeSniffer::getConfigData('report_format');
|
302 |
-
if ($reportFormat !== null) {
|
303 |
-
$defaults['reports'][$reportFormat] = null;
|
304 |
-
}
|
305 |
-
|
306 |
-
$tabWidth = PHP_CodeSniffer::getConfigData('tab_width');
|
307 |
-
if ($tabWidth === null) {
|
308 |
-
$defaults['tabWidth'] = 0;
|
309 |
-
} else {
|
310 |
-
$defaults['tabWidth'] = (int) $tabWidth;
|
311 |
-
}
|
312 |
-
|
313 |
-
$encoding = PHP_CodeSniffer::getConfigData('encoding');
|
314 |
-
if ($encoding === null) {
|
315 |
-
$defaults['encoding'] = 'iso-8859-1';
|
316 |
-
} else {
|
317 |
-
$defaults['encoding'] = strtolower($encoding);
|
318 |
-
}
|
319 |
-
|
320 |
-
$severity = PHP_CodeSniffer::getConfigData('severity');
|
321 |
-
if ($severity !== null) {
|
322 |
-
$defaults['errorSeverity'] = (int) $severity;
|
323 |
-
$defaults['warningSeverity'] = (int) $severity;
|
324 |
-
}
|
325 |
-
|
326 |
-
$severity = PHP_CodeSniffer::getConfigData('error_severity');
|
327 |
-
if ($severity !== null) {
|
328 |
-
$defaults['errorSeverity'] = (int) $severity;
|
329 |
-
}
|
330 |
-
|
331 |
-
$severity = PHP_CodeSniffer::getConfigData('warning_severity');
|
332 |
-
if ($severity !== null) {
|
333 |
-
$defaults['warningSeverity'] = (int) $severity;
|
334 |
-
}
|
335 |
-
|
336 |
-
$showWarnings = PHP_CodeSniffer::getConfigData('show_warnings');
|
337 |
-
if ($showWarnings !== null) {
|
338 |
-
$showWarnings = (bool) $showWarnings;
|
339 |
-
if ($showWarnings === false) {
|
340 |
-
$defaults['warningSeverity'] = 0;
|
341 |
-
}
|
342 |
-
}
|
343 |
-
|
344 |
-
$reportWidth = PHP_CodeSniffer::getConfigData('report_width');
|
345 |
-
if ($reportWidth !== null) {
|
346 |
-
$defaults['reportWidth'] = $this->_validateReportWidth($reportWidth);
|
347 |
-
} else {
|
348 |
-
// Use function defaults.
|
349 |
-
$defaults['reportWidth'] = null;
|
350 |
-
}
|
351 |
-
|
352 |
-
$showProgress = PHP_CodeSniffer::getConfigData('show_progress');
|
353 |
-
if ($showProgress === null) {
|
354 |
-
$defaults['showProgress'] = false;
|
355 |
-
} else {
|
356 |
-
$defaults['showProgress'] = (bool) $showProgress;
|
357 |
-
}
|
358 |
-
|
359 |
-
$quiet = PHP_CodeSniffer::getConfigData('quiet');
|
360 |
-
if ($quiet === null) {
|
361 |
-
$defaults['quiet'] = false;
|
362 |
-
} else {
|
363 |
-
$defaults['quiet'] = (bool) $quiet;
|
364 |
-
}
|
365 |
-
|
366 |
-
$colors = PHP_CodeSniffer::getConfigData('colors');
|
367 |
-
if ($colors === null) {
|
368 |
-
$defaults['colors'] = false;
|
369 |
-
} else {
|
370 |
-
$defaults['colors'] = (bool) $colors;
|
371 |
-
}
|
372 |
-
|
373 |
-
if (PHP_CodeSniffer::isPharFile(dirname(dirname(__FILE__))) === true) {
|
374 |
-
// If this is a phar file, check for the standard in the config.
|
375 |
-
$standard = PHP_CodeSniffer::getConfigData('standard');
|
376 |
-
if ($standard !== null) {
|
377 |
-
$defaults['standard'] = $standard;
|
378 |
-
}
|
379 |
-
}
|
380 |
-
|
381 |
-
return $defaults;
|
382 |
-
|
383 |
-
}//end getDefaults()
|
384 |
-
|
385 |
-
|
386 |
-
/**
|
387 |
-
* Gets the processed command line values.
|
388 |
-
*
|
389 |
-
* If the values have not yet been set, the values will be sourced
|
390 |
-
* from the command line arguments.
|
391 |
-
*
|
392 |
-
* @return array
|
393 |
-
*/
|
394 |
-
public function getCommandLineValues()
|
395 |
-
{
|
396 |
-
if (empty($this->values) === false) {
|
397 |
-
return $this->values;
|
398 |
-
}
|
399 |
-
|
400 |
-
$args = $_SERVER['argv'];
|
401 |
-
array_shift($args);
|
402 |
-
|
403 |
-
$this->setCommandLineValues($args);
|
404 |
-
|
405 |
-
// Check for content on STDIN.
|
406 |
-
$handle = fopen('php://stdin', 'r');
|
407 |
-
if (stream_set_blocking($handle, false) === true) {
|
408 |
-
$fileContents = '';
|
409 |
-
while (($line = fgets($handle)) !== false) {
|
410 |
-
$fileContents .= $line;
|
411 |
-
usleep(10);
|
412 |
-
}
|
413 |
-
|
414 |
-
stream_set_blocking($handle, true);
|
415 |
-
fclose($handle);
|
416 |
-
if (trim($fileContents) !== '') {
|
417 |
-
$this->values['stdin'] = $fileContents;
|
418 |
-
}
|
419 |
-
}
|
420 |
-
|
421 |
-
return $this->values;
|
422 |
-
|
423 |
-
}//end getCommandLineValues()
|
424 |
-
|
425 |
-
|
426 |
-
/**
|
427 |
-
* Set the command line values.
|
428 |
-
*
|
429 |
-
* @param array $args An array of command line arguments to process.
|
430 |
-
*
|
431 |
-
* @return void
|
432 |
-
*/
|
433 |
-
public function setCommandLineValues($args)
|
434 |
-
{
|
435 |
-
if (defined('PHP_CODESNIFFER_IN_TESTS') === true) {
|
436 |
-
$this->values = array(
|
437 |
-
'stdin' => null,
|
438 |
-
'quiet' => true,
|
439 |
-
);
|
440 |
-
} else if (empty($this->values) === true) {
|
441 |
-
$this->values = $this->getDefaults();
|
442 |
-
}
|
443 |
-
|
444 |
-
$this->_cliArgs = $args;
|
445 |
-
$numArgs = count($args);
|
446 |
-
|
447 |
-
for ($i = 0; $i < $numArgs; $i++) {
|
448 |
-
$arg = $this->_cliArgs[$i];
|
449 |
-
if ($arg === '') {
|
450 |
-
continue;
|
451 |
-
}
|
452 |
-
|
453 |
-
if ($arg{0} === '-') {
|
454 |
-
if ($arg === '-' || $arg === '--') {
|
455 |
-
// Empty argument, ignore it.
|
456 |
-
continue;
|
457 |
-
}
|
458 |
-
|
459 |
-
if ($arg{1} === '-') {
|
460 |
-
$this->processLongArgument(substr($arg, 2), $i);
|
461 |
-
} else {
|
462 |
-
$switches = str_split($arg);
|
463 |
-
foreach ($switches as $switch) {
|
464 |
-
if ($switch === '-') {
|
465 |
-
continue;
|
466 |
-
}
|
467 |
-
|
468 |
-
$this->processShortArgument($switch, $i);
|
469 |
-
}
|
470 |
-
}
|
471 |
-
} else {
|
472 |
-
$this->processUnknownArgument($arg, $i);
|
473 |
-
}//end if
|
474 |
-
}//end for
|
475 |
-
|
476 |
-
}//end setCommandLineValues()
|
477 |
-
|
478 |
-
|
479 |
-
/**
|
480 |
-
* Processes a short (-e) command line argument.
|
481 |
-
*
|
482 |
-
* @param string $arg The command line argument.
|
483 |
-
* @param int $pos The position of the argument on the command line.
|
484 |
-
*
|
485 |
-
* @return void
|
486 |
-
*/
|
487 |
-
public function processShortArgument($arg, $pos)
|
488 |
-
{
|
489 |
-
switch ($arg) {
|
490 |
-
case 'h':
|
491 |
-
case '?':
|
492 |
-
$this->printUsage();
|
493 |
-
exit(0);
|
494 |
-
case 'i' :
|
495 |
-
$this->printInstalledStandards();
|
496 |
-
exit(0);
|
497 |
-
case 'v' :
|
498 |
-
if ($this->values['quiet'] === true) {
|
499 |
-
// Ignore when quiet mode is enabled.
|
500 |
-
break;
|
501 |
-
}
|
502 |
-
|
503 |
-
if (isset($this->values['verbosity']) === false) {
|
504 |
-
$this->values['verbosity'] = 1;
|
505 |
-
} else {
|
506 |
-
$this->values['verbosity']++;
|
507 |
-
}
|
508 |
-
break;
|
509 |
-
case 'l' :
|
510 |
-
$this->values['local'] = true;
|
511 |
-
break;
|
512 |
-
case 's' :
|
513 |
-
$this->values['showSources'] = true;
|
514 |
-
break;
|
515 |
-
case 'a' :
|
516 |
-
$this->values['interactive'] = true;
|
517 |
-
break;
|
518 |
-
case 'e':
|
519 |
-
$this->values['explain'] = true;
|
520 |
-
break;
|
521 |
-
case 'p' :
|
522 |
-
if ($this->values['quiet'] === true) {
|
523 |
-
// Ignore when quiet mode is enabled.
|
524 |
-
break;
|
525 |
-
}
|
526 |
-
|
527 |
-
$this->values['showProgress'] = true;
|
528 |
-
break;
|
529 |
-
case 'q' :
|
530 |
-
// Quiet mode disables a few other settings as well.
|
531 |
-
$this->values['quiet'] = true;
|
532 |
-
$this->values['showProgress'] = false;
|
533 |
-
$this->values['verbosity'] = 0;
|
534 |
-
break;
|
535 |
-
case 'd' :
|
536 |
-
$ini = explode('=', $this->_cliArgs[($pos + 1)]);
|
537 |
-
$this->_cliArgs[($pos + 1)] = '';
|
538 |
-
if (isset($ini[1]) === true) {
|
539 |
-
ini_set($ini[0], $ini[1]);
|
540 |
-
} else {
|
541 |
-
ini_set($ini[0], true);
|
542 |
-
}
|
543 |
-
break;
|
544 |
-
case 'n' :
|
545 |
-
$this->values['warningSeverity'] = 0;
|
546 |
-
break;
|
547 |
-
case 'w' :
|
548 |
-
$this->values['warningSeverity'] = null;
|
549 |
-
break;
|
550 |
-
default:
|
551 |
-
if ($this->dieOnUnknownArg === false) {
|
552 |
-
$this->values[$arg] = $arg;
|
553 |
-
} else {
|
554 |
-
$this->processUnknownArgument('-'.$arg, $pos);
|
555 |
-
}
|
556 |
-
}//end switch
|
557 |
-
|
558 |
-
}//end processShortArgument()
|
559 |
-
|
560 |
-
|
561 |
-
/**
|
562 |
-
* Processes a long (--example) command line argument.
|
563 |
-
*
|
564 |
-
* @param string $arg The command line argument.
|
565 |
-
* @param int $pos The position of the argument on the command line.
|
566 |
-
*
|
567 |
-
* @return void
|
568 |
-
*/
|
569 |
-
public function processLongArgument($arg, $pos)
|
570 |
-
{
|
571 |
-
switch ($arg) {
|
572 |
-
case 'help':
|
573 |
-
$this->printUsage();
|
574 |
-
exit(0);
|
575 |
-
case 'version':
|
576 |
-
echo 'PHP_CodeSniffer version '.PHP_CodeSniffer::VERSION.' ('.PHP_CodeSniffer::STABILITY.') ';
|
577 |
-
echo 'by Squiz (http://www.squiz.net)'.PHP_EOL;
|
578 |
-
exit(0);
|
579 |
-
case 'colors':
|
580 |
-
$this->values['colors'] = true;
|
581 |
-
break;
|
582 |
-
case 'no-colors':
|
583 |
-
$this->values['colors'] = false;
|
584 |
-
break;
|
585 |
-
case 'config-set':
|
586 |
-
if (isset($this->_cliArgs[($pos + 1)]) === false
|
587 |
-
|| isset($this->_cliArgs[($pos + 2)]) === false
|
588 |
-
) {
|
589 |
-
echo 'ERROR: Setting a config option requires a name and value'.PHP_EOL.PHP_EOL;
|
590 |
-
$this->printUsage();
|
591 |
-
exit(0);
|
592 |
-
}
|
593 |
-
|
594 |
-
$key = $this->_cliArgs[($pos + 1)];
|
595 |
-
$value = $this->_cliArgs[($pos + 2)];
|
596 |
-
$current = PHP_CodeSniffer::getConfigData($key);
|
597 |
-
|
598 |
-
try {
|
599 |
-
PHP_CodeSniffer::setConfigData($key, $value);
|
600 |
-
} catch (Exception $e) {
|
601 |
-
echo $e->getMessage().PHP_EOL;
|
602 |
-
exit(2);
|
603 |
-
}
|
604 |
-
|
605 |
-
if ($current === null) {
|
606 |
-
echo "Config value \"$key\" added successfully".PHP_EOL;
|
607 |
-
} else {
|
608 |
-
echo "Config value \"$key\" updated successfully; old value was \"$current\"".PHP_EOL;
|
609 |
-
}
|
610 |
-
exit(0);
|
611 |
-
case 'config-delete':
|
612 |
-
if (isset($this->_cliArgs[($pos + 1)]) === false) {
|
613 |
-
echo 'ERROR: Deleting a config option requires the name of the option'.PHP_EOL.PHP_EOL;
|
614 |
-
$this->printUsage();
|
615 |
-
exit(0);
|
616 |
-
}
|
617 |
-
|
618 |
-
$key = $this->_cliArgs[($pos + 1)];
|
619 |
-
$current = PHP_CodeSniffer::getConfigData($key);
|
620 |
-
if ($current === null) {
|
621 |
-
echo "Config value \"$key\" has not been set".PHP_EOL;
|
622 |
-
} else {
|
623 |
-
try {
|
624 |
-
PHP_CodeSniffer::setConfigData($key, null);
|
625 |
-
} catch (Exception $e) {
|
626 |
-
echo $e->getMessage().PHP_EOL;
|
627 |
-
exit(2);
|
628 |
-
}
|
629 |
-
|
630 |
-
echo "Config value \"$key\" removed successfully; old value was \"$current\"".PHP_EOL;
|
631 |
-
}
|
632 |
-
exit(0);
|
633 |
-
case 'config-show':
|
634 |
-
$data = PHP_CodeSniffer::getAllConfigData();
|
635 |
-
$this->printConfigData($data);
|
636 |
-
exit(0);
|
637 |
-
case 'runtime-set':
|
638 |
-
if (isset($this->_cliArgs[($pos + 1)]) === false
|
639 |
-
|| isset($this->_cliArgs[($pos + 2)]) === false
|
640 |
-
) {
|
641 |
-
echo 'ERROR: Setting a runtime config option requires a name and value'.PHP_EOL.PHP_EOL;
|
642 |
-
$this->printUsage();
|
643 |
-
exit(0);
|
644 |
-
}
|
645 |
-
|
646 |
-
$key = $this->_cliArgs[($pos + 1)];
|
647 |
-
$value = $this->_cliArgs[($pos + 2)];
|
648 |
-
$this->_cliArgs[($pos + 1)] = '';
|
649 |
-
$this->_cliArgs[($pos + 2)] = '';
|
650 |
-
PHP_CodeSniffer::setConfigData($key, $value, true);
|
651 |
-
break;
|
652 |
-
default:
|
653 |
-
if (substr($arg, 0, 7) === 'sniffs=') {
|
654 |
-
$sniffs = explode(',', substr($arg, 7));
|
655 |
-
foreach ($sniffs as $sniff) {
|
656 |
-
if (substr_count($sniff, '.') !== 2) {
|
657 |
-
echo 'ERROR: The specified sniff code "'.$sniff.'" is invalid'.PHP_EOL.PHP_EOL;
|
658 |
-
$this->printUsage();
|
659 |
-
exit(2);
|
660 |
-
}
|
661 |
-
}
|
662 |
-
|
663 |
-
$this->values['sniffs'] = $sniffs;
|
664 |
-
} else if (substr($arg, 0, 8) === 'exclude=') {
|
665 |
-
$sniffs = explode(',', substr($arg, 8));
|
666 |
-
foreach ($sniffs as $sniff) {
|
667 |
-
if (substr_count($sniff, '.') !== 2) {
|
668 |
-
echo 'ERROR: The specified sniff code "'.$sniff.'" is invalid'.PHP_EOL.PHP_EOL;
|
669 |
-
$this->printUsage();
|
670 |
-
exit(2);
|
671 |
-
}
|
672 |
-
}
|
673 |
-
|
674 |
-
$this->values['exclude'] = $sniffs;
|
675 |
-
} else if (substr($arg, 0, 10) === 'bootstrap=') {
|
676 |
-
$files = explode(',', substr($arg, 10));
|
677 |
-
foreach ($files as $file) {
|
678 |
-
$path = PHP_CodeSniffer::realpath($file);
|
679 |
-
if ($path === false) {
|
680 |
-
echo 'ERROR: The specified bootstrap file "'.$file.'" does not exist'.PHP_EOL.PHP_EOL;
|
681 |
-
$this->printUsage();
|
682 |
-
exit(2);
|
683 |
-
}
|
684 |
-
|
685 |
-
$this->values['bootstrap'][] = $path;
|
686 |
-
}
|
687 |
-
} else if (substr($arg, 0, 10) === 'file-list=') {
|
688 |
-
$fileList = substr($arg, 10);
|
689 |
-
$path = PHP_CodeSniffer::realpath($fileList);
|
690 |
-
if ($path === false) {
|
691 |
-
echo 'ERROR: The specified file list "'.$file.'" does not exist'.PHP_EOL.PHP_EOL;
|
692 |
-
$this->printUsage();
|
693 |
-
exit(2);
|
694 |
-
}
|
695 |
-
|
696 |
-
$files = file($path);
|
697 |
-
foreach ($files as $inputFile) {
|
698 |
-
$inputFile = trim($inputFile);
|
699 |
-
|
700 |
-
// Skip empty lines.
|
701 |
-
if ($inputFile === '') {
|
702 |
-
continue;
|
703 |
-
}
|
704 |
-
|
705 |
-
$realFile = PHP_CodeSniffer::realpath($inputFile);
|
706 |
-
if ($realFile === false) {
|
707 |
-
echo 'ERROR: The specified file "'.$inputFile.'" does not exist'.PHP_EOL.PHP_EOL;
|
708 |
-
$this->printUsage();
|
709 |
-
exit(2);
|
710 |
-
}
|
711 |
-
|
712 |
-
$this->values['files'][] = $realFile;
|
713 |
-
}
|
714 |
-
} else if (substr($arg, 0, 11) === 'stdin-path=') {
|
715 |
-
$this->values['stdinPath'] = PHP_CodeSniffer::realpath(substr($arg, 11));
|
716 |
-
|
717 |
-
// It may not exist and return false instead, so just use whatever they gave us.
|
718 |
-
if ($this->values['stdinPath'] === false) {
|
719 |
-
$this->values['stdinPath'] = trim(substr($arg, 11));
|
720 |
-
}
|
721 |
-
} else if (substr($arg, 0, 12) === 'report-file=') {
|
722 |
-
$this->values['reportFile'] = PHP_CodeSniffer::realpath(substr($arg, 12));
|
723 |
-
|
724 |
-
// It may not exist and return false instead.
|
725 |
-
if ($this->values['reportFile'] === false) {
|
726 |
-
$this->values['reportFile'] = substr($arg, 12);
|
727 |
-
|
728 |
-
$dir = dirname($this->values['reportFile']);
|
729 |
-
if (is_dir($dir) === false) {
|
730 |
-
echo 'ERROR: The specified report file path "'.$this->values['reportFile'].'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
|
731 |
-
$this->printUsage();
|
732 |
-
exit(2);
|
733 |
-
}
|
734 |
-
|
735 |
-
if ($dir === '.') {
|
736 |
-
// Passed report file is a file in the current directory.
|
737 |
-
$this->values['reportFile'] = getcwd().'/'.basename($this->values['reportFile']);
|
738 |
-
} else {
|
739 |
-
if ($dir{0} === '/') {
|
740 |
-
// An absolute path.
|
741 |
-
$dir = PHP_CodeSniffer::realpath($dir);
|
742 |
-
} else {
|
743 |
-
$dir = PHP_CodeSniffer::realpath(getcwd().'/'.$dir);
|
744 |
-
}
|
745 |
-
|
746 |
-
if ($dir !== false) {
|
747 |
-
// Report file path is relative.
|
748 |
-
$this->values['reportFile'] = $dir.'/'.basename($this->values['reportFile']);
|
749 |
-
}
|
750 |
-
}
|
751 |
-
}//end if
|
752 |
-
|
753 |
-
if (is_dir($this->values['reportFile']) === true) {
|
754 |
-
echo 'ERROR: The specified report file path "'.$this->values['reportFile'].'" is a directory'.PHP_EOL.PHP_EOL;
|
755 |
-
$this->printUsage();
|
756 |
-
exit(2);
|
757 |
-
}
|
758 |
-
} else if (substr($arg, 0, 13) === 'report-width=') {
|
759 |
-
$this->values['reportWidth'] = $this->_validateReportWidth(substr($arg, 13));
|
760 |
-
} else if (substr($arg, 0, 7) === 'report='
|
761 |
-
|| substr($arg, 0, 7) === 'report-'
|
762 |
-
) {
|
763 |
-
if ($arg[6] === '-') {
|
764 |
-
// This is a report with file output.
|
765 |
-
$split = strpos($arg, '=');
|
766 |
-
if ($split === false) {
|
767 |
-
$report = substr($arg, 7);
|
768 |
-
$output = null;
|
769 |
-
} else {
|
770 |
-
$report = substr($arg, 7, ($split - 7));
|
771 |
-
$output = substr($arg, ($split + 1));
|
772 |
-
if ($output === false) {
|
773 |
-
$output = null;
|
774 |
-
} else {
|
775 |
-
$dir = dirname($output);
|
776 |
-
if ($dir === '.') {
|
777 |
-
// Passed report file is a filename in the current directory.
|
778 |
-
$output = getcwd().'/'.basename($output);
|
779 |
-
} else {
|
780 |
-
if ($dir{0} === '/') {
|
781 |
-
// An absolute path.
|
782 |
-
$dir = PHP_CodeSniffer::realpath($dir);
|
783 |
-
} else {
|
784 |
-
$dir = PHP_CodeSniffer::realpath(getcwd().'/'.$dir);
|
785 |
-
}
|
786 |
-
|
787 |
-
if ($dir !== false) {
|
788 |
-
// Report file path is relative.
|
789 |
-
$output = $dir.'/'.basename($output);
|
790 |
-
}
|
791 |
-
}
|
792 |
-
}//end if
|
793 |
-
}//end if
|
794 |
-
} else {
|
795 |
-
// This is a single report.
|
796 |
-
$report = substr($arg, 7);
|
797 |
-
$output = null;
|
798 |
-
}//end if
|
799 |
-
|
800 |
-
$this->values['reports'][$report] = $output;
|
801 |
-
} else if (substr($arg, 0, 9) === 'standard=') {
|
802 |
-
$standards = trim(substr($arg, 9));
|
803 |
-
if ($standards !== '') {
|
804 |
-
$this->values['standard'] = explode(',', $standards);
|
805 |
-
}
|
806 |
-
} else if (substr($arg, 0, 11) === 'extensions=') {
|
807 |
-
if (isset($this->values['extensions']) === false) {
|
808 |
-
$this->values['extensions'] = array();
|
809 |
-
}
|
810 |
-
|
811 |
-
$this->values['extensions'] = array_merge($this->values['extensions'], explode(',', substr($arg, 11)));
|
812 |
-
} else if (substr($arg, 0, 9) === 'severity=') {
|
813 |
-
$this->values['errorSeverity'] = (int) substr($arg, 9);
|
814 |
-
$this->values['warningSeverity'] = $this->values['errorSeverity'];
|
815 |
-
} else if (substr($arg, 0, 15) === 'error-severity=') {
|
816 |
-
$this->values['errorSeverity'] = (int) substr($arg, 15);
|
817 |
-
} else if (substr($arg, 0, 17) === 'warning-severity=') {
|
818 |
-
$this->values['warningSeverity'] = (int) substr($arg, 17);
|
819 |
-
} else if (substr($arg, 0, 7) === 'ignore=') {
|
820 |
-
// Split the ignore string on commas, unless the comma is escaped
|
821 |
-
// using 1 or 3 slashes (\, or \\\,).
|
822 |
-
$ignored = preg_split(
|
823 |
-
'/(?<=(?<!\\\\)\\\\\\\\),|(?<!\\\\),/',
|
824 |
-
substr($arg, 7)
|
825 |
-
);
|
826 |
-
foreach ($ignored as $pattern) {
|
827 |
-
$pattern = trim($pattern);
|
828 |
-
if ($pattern === '') {
|
829 |
-
continue;
|
830 |
-
}
|
831 |
-
|
832 |
-
$this->values['ignored'][$pattern] = 'absolute';
|
833 |
-
}
|
834 |
-
} else if (substr($arg, 0, 10) === 'generator=') {
|
835 |
-
$this->values['generator'] = substr($arg, 10);
|
836 |
-
} else if (substr($arg, 0, 9) === 'encoding=') {
|
837 |
-
$this->values['encoding'] = strtolower(substr($arg, 9));
|
838 |
-
} else if (substr($arg, 0, 10) === 'tab-width=') {
|
839 |
-
$this->values['tabWidth'] = (int) substr($arg, 10);
|
840 |
-
} else {
|
841 |
-
if ($this->dieOnUnknownArg === false) {
|
842 |
-
$eqPos = strpos($arg, '=');
|
843 |
-
if ($eqPos === false) {
|
844 |
-
$this->values[$arg] = $arg;
|
845 |
-
} else {
|
846 |
-
$value = substr($arg, ($eqPos + 1));
|
847 |
-
$arg = substr($arg, 0, $eqPos);
|
848 |
-
$this->values[$arg] = $value;
|
849 |
-
}
|
850 |
-
} else {
|
851 |
-
$this->processUnknownArgument('--'.$arg, $pos);
|
852 |
-
}
|
853 |
-
}//end if
|
854 |
-
|
855 |
-
break;
|
856 |
-
}//end switch
|
857 |
-
|
858 |
-
}//end processLongArgument()
|
859 |
-
|
860 |
-
|
861 |
-
/**
|
862 |
-
* Processes an unknown command line argument.
|
863 |
-
*
|
864 |
-
* Assumes all unknown arguments are files and folders to check.
|
865 |
-
*
|
866 |
-
* @param string $arg The command line argument.
|
867 |
-
* @param int $pos The position of the argument on the command line.
|
868 |
-
*
|
869 |
-
* @return void
|
870 |
-
*/
|
871 |
-
public function processUnknownArgument($arg, $pos)
|
872 |
-
{
|
873 |
-
// We don't know about any additional switches; just files.
|
874 |
-
if ($arg{0} === '-') {
|
875 |
-
if ($this->dieOnUnknownArg === false) {
|
876 |
-
return;
|
877 |
-
}
|
878 |
-
|
879 |
-
echo 'ERROR: option "'.$arg.'" not known.'.PHP_EOL.PHP_EOL;
|
880 |
-
$this->printUsage();
|
881 |
-
exit(2);
|
882 |
-
}
|
883 |
-
|
884 |
-
$file = PHP_CodeSniffer::realpath($arg);
|
885 |
-
if (file_exists($file) === false) {
|
886 |
-
if ($this->dieOnUnknownArg === false) {
|
887 |
-
return;
|
888 |
-
}
|
889 |
-
|
890 |
-
echo 'ERROR: The file "'.$arg.'" does not exist.'.PHP_EOL.PHP_EOL;
|
891 |
-
$this->printUsage();
|
892 |
-
exit(2);
|
893 |
-
} else {
|
894 |
-
$this->values['files'][] = $file;
|
895 |
-
}
|
896 |
-
|
897 |
-
}//end processUnknownArgument()
|
898 |
-
|
899 |
-
|
900 |
-
/**
|
901 |
-
* Runs PHP_CodeSniffer over files and directories.
|
902 |
-
*
|
903 |
-
* @param array $values An array of values determined from CLI args.
|
904 |
-
*
|
905 |
-
* @return int The number of error and warning messages shown.
|
906 |
-
* @see getCommandLineValues()
|
907 |
-
*/
|
908 |
-
public function process($values=array())
|
909 |
-
{
|
910 |
-
if (empty($values) === true) {
|
911 |
-
$values = $this->getCommandLineValues();
|
912 |
-
} else {
|
913 |
-
$values = array_merge($this->getDefaults(), $values);
|
914 |
-
$this->values = $values;
|
915 |
-
}
|
916 |
-
|
917 |
-
if ($values['generator'] !== '') {
|
918 |
-
$phpcs = new PHP_CodeSniffer($values['verbosity']);
|
919 |
-
if ($values['standard'] === null) {
|
920 |
-
$values['standard'] = $this->validateStandard(null);
|
921 |
-
}
|
922 |
-
|
923 |
-
foreach ($values['standard'] as $standard) {
|
924 |
-
$phpcs->generateDocs(
|
925 |
-
$standard,
|
926 |
-
$values['sniffs'],
|
927 |
-
$values['generator']
|
928 |
-
);
|
929 |
-
}
|
930 |
-
|
931 |
-
exit(0);
|
932 |
-
}
|
933 |
-
|
934 |
-
// If no standard is supplied, get the default.
|
935 |
-
$values['standard'] = $this->validateStandard($values['standard']);
|
936 |
-
foreach ($values['standard'] as $standard) {
|
937 |
-
if (PHP_CodeSniffer::isInstalledStandard($standard) === false) {
|
938 |
-
// They didn't select a valid coding standard, so help them
|
939 |
-
// out by letting them know which standards are installed.
|
940 |
-
echo 'ERROR: the "'.$standard.'" coding standard is not installed. ';
|
941 |
-
$this->printInstalledStandards();
|
942 |
-
exit(2);
|
943 |
-
}
|
944 |
-
}
|
945 |
-
|
946 |
-
if ($values['explain'] === true) {
|
947 |
-
foreach ($values['standard'] as $standard) {
|
948 |
-
$this->explainStandard($standard);
|
949 |
-
}
|
950 |
-
|
951 |
-
exit(0);
|
952 |
-
}
|
953 |
-
|
954 |
-
$phpcs = new PHP_CodeSniffer($values['verbosity'], null, null, null);
|
955 |
-
$phpcs->setCli($this);
|
956 |
-
$phpcs->initStandard($values['standard'], $values['sniffs'], $values['exclude']);
|
957 |
-
$values = $this->values;
|
958 |
-
|
959 |
-
$phpcs->setTabWidth($values['tabWidth']);
|
960 |
-
$phpcs->setEncoding($values['encoding']);
|
961 |
-
$phpcs->setInteractive($values['interactive']);
|
962 |
-
|
963 |
-
// Set file extensions if they were specified. Otherwise,
|
964 |
-
// let PHP_CodeSniffer decide on the defaults.
|
965 |
-
if (empty($values['extensions']) === false) {
|
966 |
-
$phpcs->setAllowedFileExtensions($values['extensions']);
|
967 |
-
}
|
968 |
-
|
969 |
-
// Set ignore patterns if they were specified.
|
970 |
-
if (empty($values['ignored']) === false) {
|
971 |
-
$ignorePatterns = array_merge($phpcs->getIgnorePatterns(), $values['ignored']);
|
972 |
-
$phpcs->setIgnorePatterns($ignorePatterns);
|
973 |
-
}
|
974 |
-
|
975 |
-
// Set some convenience member vars.
|
976 |
-
if ($values['errorSeverity'] === null) {
|
977 |
-
$this->errorSeverity = PHPCS_DEFAULT_ERROR_SEV;
|
978 |
-
} else {
|
979 |
-
$this->errorSeverity = $values['errorSeverity'];
|
980 |
-
}
|
981 |
-
|
982 |
-
if ($values['warningSeverity'] === null) {
|
983 |
-
$this->warningSeverity = PHPCS_DEFAULT_WARN_SEV;
|
984 |
-
} else {
|
985 |
-
$this->warningSeverity = $values['warningSeverity'];
|
986 |
-
}
|
987 |
-
|
988 |
-
if (empty($values['reports']) === true) {
|
989 |
-
$values['reports']['full'] = $values['reportFile'];
|
990 |
-
$this->values['reports'] = $values['reports'];
|
991 |
-
}
|
992 |
-
|
993 |
-
// Include bootstrap files.
|
994 |
-
foreach ($values['bootstrap'] as $bootstrap) {
|
995 |
-
include $bootstrap;
|
996 |
-
}
|
997 |
-
|
998 |
-
$phpcs->processFiles($values['files'], $values['local']);
|
999 |
-
|
1000 |
-
if (empty($values['files']) === true || $values['stdin'] !== null) {
|
1001 |
-
$fileContents = $values['stdin'];
|
1002 |
-
if ($fileContents === null) {
|
1003 |
-
// Check if they are passing in the file contents.
|
1004 |
-
$handle = fopen('php://stdin', 'r');
|
1005 |
-
stream_set_blocking($handle, true);
|
1006 |
-
$fileContents = stream_get_contents($handle);
|
1007 |
-
fclose($handle);
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
if ($fileContents === '') {
|
1011 |
-
// No files and no content passed in.
|
1012 |
-
echo 'ERROR: You must supply at least one file or directory to process.'.PHP_EOL.PHP_EOL;
|
1013 |
-
$this->printUsage();
|
1014 |
-
exit(2);
|
1015 |
-
} else {
|
1016 |
-
$this->values['stdin'] = $fileContents;
|
1017 |
-
$phpcs->processFile('STDIN', $fileContents);
|
1018 |
-
}
|
1019 |
-
}
|
1020 |
-
|
1021 |
-
// Interactive runs don't require a final report and it doesn't really
|
1022 |
-
// matter what the retun value is because we know it isn't being read
|
1023 |
-
// by a script.
|
1024 |
-
if ($values['interactive'] === true) {
|
1025 |
-
return 0;
|
1026 |
-
}
|
1027 |
-
|
1028 |
-
return $this->printErrorReport(
|
1029 |
-
$phpcs,
|
1030 |
-
$values['reports'],
|
1031 |
-
$values['showSources'],
|
1032 |
-
$values['reportFile'],
|
1033 |
-
$values['reportWidth']
|
1034 |
-
);
|
1035 |
-
|
1036 |
-
}//end process()
|
1037 |
-
|
1038 |
-
|
1039 |
-
/**
|
1040 |
-
* Prints the error report for the run.
|
1041 |
-
*
|
1042 |
-
* Note that this function may actually print multiple reports
|
1043 |
-
* as the user may have specified a number of output formats.
|
1044 |
-
*
|
1045 |
-
* @param PHP_CodeSniffer $phpcs The PHP_CodeSniffer object containing
|
1046 |
-
* the errors.
|
1047 |
-
* @param array $reports A list of reports to print.
|
1048 |
-
* @param bool $showSources TRUE if report should show error sources
|
1049 |
-
* (not used by all reports).
|
1050 |
-
* @param string $reportFile A default file to log report output to.
|
1051 |
-
* @param int $reportWidth How wide the screen reports should be.
|
1052 |
-
*
|
1053 |
-
* @return int The number of error and warning messages shown.
|
1054 |
-
*/
|
1055 |
-
public function printErrorReport(
|
1056 |
-
PHP_CodeSniffer $phpcs,
|
1057 |
-
$reports,
|
1058 |
-
$showSources,
|
1059 |
-
$reportFile,
|
1060 |
-
$reportWidth
|
1061 |
-
) {
|
1062 |
-
if (empty($reports) === true) {
|
1063 |
-
$reports['full'] = $reportFile;
|
1064 |
-
}
|
1065 |
-
|
1066 |
-
$errors = 0;
|
1067 |
-
$warnings = 0;
|
1068 |
-
$toScreen = false;
|
1069 |
-
|
1070 |
-
foreach ($reports as $report => $output) {
|
1071 |
-
if ($output === null) {
|
1072 |
-
$output = $reportFile;
|
1073 |
-
}
|
1074 |
-
|
1075 |
-
if ($reportFile === null) {
|
1076 |
-
$toScreen = true;
|
1077 |
-
}
|
1078 |
-
|
1079 |
-
// We don't add errors here because the number of
|
1080 |
-
// errors reported by each report type will always be the
|
1081 |
-
// same, so we really just need 1 number.
|
1082 |
-
$result = $phpcs->reporting->printReport(
|
1083 |
-
$report,
|
1084 |
-
$showSources,
|
1085 |
-
$this->values,
|
1086 |
-
$output,
|
1087 |
-
$reportWidth
|
1088 |
-
);
|
1089 |
-
|
1090 |
-
$errors = $result['errors'];
|
1091 |
-
$warnings = $result['warnings'];
|
1092 |
-
}//end foreach
|
1093 |
-
|
1094 |
-
// Only print timer output if no reports were
|
1095 |
-
// printed to the screen so we don't put additional output
|
1096 |
-
// in something like an XML report. If we are printing to screen,
|
1097 |
-
// the report types would have already worked out who should
|
1098 |
-
// print the timer info.
|
1099 |
-
if (PHP_CODESNIFFER_INTERACTIVE === false
|
1100 |
-
&& ($toScreen === false
|
1101 |
-
|| (($errors + $warnings) === 0 && $this->values['showProgress'] === true))
|
1102 |
-
) {
|
1103 |
-
PHP_CodeSniffer_Reporting::printRunTime();
|
1104 |
-
}
|
1105 |
-
|
1106 |
-
// They should all return the same value, so it
|
1107 |
-
// doesn't matter which return value we end up using.
|
1108 |
-
$ignoreWarnings = PHP_CodeSniffer::getConfigData('ignore_warnings_on_exit');
|
1109 |
-
$ignoreErrors = PHP_CodeSniffer::getConfigData('ignore_errors_on_exit');
|
1110 |
-
|
1111 |
-
$return = ($errors + $warnings);
|
1112 |
-
if ($ignoreErrors !== null) {
|
1113 |
-
$ignoreErrors = (bool) $ignoreErrors;
|
1114 |
-
if ($ignoreErrors === true) {
|
1115 |
-
$return -= $errors;
|
1116 |
-
}
|
1117 |
-
}
|
1118 |
-
|
1119 |
-
if ($ignoreWarnings !== null) {
|
1120 |
-
$ignoreWarnings = (bool) $ignoreWarnings;
|
1121 |
-
if ($ignoreWarnings === true) {
|
1122 |
-
$return -= $warnings;
|
1123 |
-
}
|
1124 |
-
}
|
1125 |
-
|
1126 |
-
return $return;
|
1127 |
-
|
1128 |
-
}//end printErrorReport()
|
1129 |
-
|
1130 |
-
|
1131 |
-
/**
|
1132 |
-
* Convert the passed standards into valid standards.
|
1133 |
-
*
|
1134 |
-
* Checks things like default values and case.
|
1135 |
-
*
|
1136 |
-
* @param array $standards The standards to validate.
|
1137 |
-
*
|
1138 |
-
* @return array
|
1139 |
-
*/
|
1140 |
-
public function validateStandard($standards)
|
1141 |
-
{
|
1142 |
-
if ($standards === null) {
|
1143 |
-
// They did not supply a standard to use.
|
1144 |
-
// Look for a default ruleset in the current directory or higher.
|
1145 |
-
$currentDir = getcwd();
|
1146 |
-
|
1147 |
-
do {
|
1148 |
-
$default = $currentDir.DIRECTORY_SEPARATOR.'phpcs.xml';
|
1149 |
-
if (is_file($default) === true) {
|
1150 |
-
return array($default);
|
1151 |
-
}
|
1152 |
-
|
1153 |
-
$default = $currentDir.DIRECTORY_SEPARATOR.'phpcs.xml.dist';
|
1154 |
-
if (is_file($default) === true) {
|
1155 |
-
return array($default);
|
1156 |
-
}
|
1157 |
-
|
1158 |
-
$lastDir = $currentDir;
|
1159 |
-
$currentDir = dirname($currentDir);
|
1160 |
-
} while ($currentDir !== '.' && $currentDir !== $lastDir);
|
1161 |
-
|
1162 |
-
// Try to get the default from the config system.
|
1163 |
-
$standard = PHP_CodeSniffer::getConfigData('default_standard');
|
1164 |
-
if ($standard === null) {
|
1165 |
-
// Product default standard.
|
1166 |
-
$standard = 'PEAR';
|
1167 |
-
}
|
1168 |
-
|
1169 |
-
return explode(',', $standard);
|
1170 |
-
}//end if
|
1171 |
-
|
1172 |
-
$cleaned = array();
|
1173 |
-
$standards = (array) $standards;
|
1174 |
-
|
1175 |
-
// Check if the standard name is valid, or if the case is invalid.
|
1176 |
-
$installedStandards = PHP_CodeSniffer::getInstalledStandards();
|
1177 |
-
foreach ($standards as $standard) {
|
1178 |
-
foreach ($installedStandards as $validStandard) {
|
1179 |
-
if (strtolower($standard) === strtolower($validStandard)) {
|
1180 |
-
$standard = $validStandard;
|
1181 |
-
break;
|
1182 |
-
}
|
1183 |
-
}
|
1184 |
-
|
1185 |
-
$cleaned[] = $standard;
|
1186 |
-
}
|
1187 |
-
|
1188 |
-
return $cleaned;
|
1189 |
-
|
1190 |
-
}//end validateStandard()
|
1191 |
-
|
1192 |
-
|
1193 |
-
/**
|
1194 |
-
* Prints a report showing the sniffs contained in a standard.
|
1195 |
-
*
|
1196 |
-
* @param string $standard The standard to validate.
|
1197 |
-
*
|
1198 |
-
* @return void
|
1199 |
-
*/
|
1200 |
-
public function explainStandard($standard)
|
1201 |
-
{
|
1202 |
-
$phpcs = new PHP_CodeSniffer();
|
1203 |
-
$phpcs->process(array(), $standard);
|
1204 |
-
$sniffs = $phpcs->getSniffs();
|
1205 |
-
$sniffs = array_keys($sniffs);
|
1206 |
-
sort($sniffs);
|
1207 |
-
|
1208 |
-
ob_start();
|
1209 |
-
|
1210 |
-
$lastStandard = '';
|
1211 |
-
$lastCount = '';
|
1212 |
-
$sniffCount = count($sniffs);
|
1213 |
-
$sniffs[] = '___';
|
1214 |
-
|
1215 |
-
echo PHP_EOL."The $standard standard contains $sniffCount sniffs".PHP_EOL;
|
1216 |
-
|
1217 |
-
ob_start();
|
1218 |
-
|
1219 |
-
foreach ($sniffs as $sniff) {
|
1220 |
-
$parts = explode('_', str_replace('\\', '_', $sniff));
|
1221 |
-
if ($lastStandard === '') {
|
1222 |
-
$lastStandard = $parts[0];
|
1223 |
-
}
|
1224 |
-
|
1225 |
-
if ($parts[0] !== $lastStandard) {
|
1226 |
-
$sniffList = ob_get_contents();
|
1227 |
-
ob_end_clean();
|
1228 |
-
|
1229 |
-
echo PHP_EOL.$lastStandard.' ('.$lastCount.' sniffs)'.PHP_EOL;
|
1230 |
-
echo str_repeat('-', (strlen($lastStandard.$lastCount) + 10));
|
1231 |
-
echo PHP_EOL;
|
1232 |
-
echo $sniffList;
|
1233 |
-
|
1234 |
-
$lastStandard = $parts[0];
|
1235 |
-
$lastCount = 0;
|
1236 |
-
|
1237 |
-
ob_start();
|
1238 |
-
}
|
1239 |
-
|
1240 |
-
echo ' '.$parts[0].'.'.$parts[2].'.'.substr($parts[3], 0, -5).PHP_EOL;
|
1241 |
-
$lastCount++;
|
1242 |
-
}//end foreach
|
1243 |
-
|
1244 |
-
ob_end_clean();
|
1245 |
-
|
1246 |
-
}//end explainStandard()
|
1247 |
-
|
1248 |
-
|
1249 |
-
/**
|
1250 |
-
* Prints out the gathered config data.
|
1251 |
-
*
|
1252 |
-
* @param array $data The config data to print.
|
1253 |
-
*
|
1254 |
-
* @return void
|
1255 |
-
*/
|
1256 |
-
public function printConfigData($data)
|
1257 |
-
{
|
1258 |
-
$max = 0;
|
1259 |
-
$keys = array_keys($data);
|
1260 |
-
foreach ($keys as $key) {
|
1261 |
-
$len = strlen($key);
|
1262 |
-
if (strlen($key) > $max) {
|
1263 |
-
$max = $len;
|
1264 |
-
}
|
1265 |
-
}
|
1266 |
-
|
1267 |
-
if ($max === 0) {
|
1268 |
-
return;
|
1269 |
-
}
|
1270 |
-
|
1271 |
-
$max += 2;
|
1272 |
-
ksort($data);
|
1273 |
-
foreach ($data as $name => $value) {
|
1274 |
-
echo str_pad($name.': ', $max).$value.PHP_EOL;
|
1275 |
-
}
|
1276 |
-
|
1277 |
-
}//end printConfigData()
|
1278 |
-
|
1279 |
-
|
1280 |
-
/**
|
1281 |
-
* Prints out the usage information for this script.
|
1282 |
-
*
|
1283 |
-
* @return void
|
1284 |
-
*/
|
1285 |
-
public function printUsage()
|
1286 |
-
{
|
1287 |
-
if (PHP_CODESNIFFER_CBF === true) {
|
1288 |
-
$this->printPHPCBFUsage();
|
1289 |
-
} else {
|
1290 |
-
$this->printPHPCSUsage();
|
1291 |
-
}
|
1292 |
-
|
1293 |
-
}//end printUsage()
|
1294 |
-
|
1295 |
-
|
1296 |
-
/**
|
1297 |
-
* Prints out the usage information for PHPCS.
|
1298 |
-
*
|
1299 |
-
* @return void
|
1300 |
-
*/
|
1301 |
-
public function printPHPCSUsage()
|
1302 |
-
{
|
1303 |
-
echo 'Usage: phpcs [-nwlsaepqvi] [-d key[=value]] [--colors] [--no-colors] [--stdin-path=<stdinPath>]'.PHP_EOL;
|
1304 |
-
echo ' [--report=<report>] [--report-file=<reportFile>] [--report-<report>=<reportFile>] ...'.PHP_EOL;
|
1305 |
-
echo ' [--report-width=<reportWidth>] [--generator=<generator>] [--tab-width=<tabWidth>]'.PHP_EOL;
|
1306 |
-
echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]'.PHP_EOL;
|
1307 |
-
echo ' [--runtime-set key value] [--config-set key value] [--config-delete key] [--config-show]'.PHP_EOL;
|
1308 |
-
echo ' [--standard=<standard>] [--sniffs=<sniffs>] [--exclude=<sniffs>] [--encoding=<encoding>]'.PHP_EOL;
|
1309 |
-
echo ' [--extensions=<extensions>] [--ignore=<patterns>] [--bootstrap=<bootstrap>]'.PHP_EOL;
|
1310 |
-
echo ' [--file-list=<fileList>] <file> ...'.PHP_EOL;
|
1311 |
-
echo ' Set runtime value (see --config-set) '.PHP_EOL;
|
1312 |
-
echo ' -n Do not print warnings (shortcut for --warning-severity=0)'.PHP_EOL;
|
1313 |
-
echo ' -w Print both warnings and errors (this is the default)'.PHP_EOL;
|
1314 |
-
echo ' -l Local directory only, no recursion'.PHP_EOL;
|
1315 |
-
echo ' -s Show sniff codes in all reports'.PHP_EOL;
|
1316 |
-
echo ' -a Run interactively'.PHP_EOL;
|
1317 |
-
echo ' -e Explain a standard by showing the sniffs it includes'.PHP_EOL;
|
1318 |
-
echo ' -p Show progress of the run'.PHP_EOL;
|
1319 |
-
echo ' -q Quiet mode; disables progress and verbose output'.PHP_EOL;
|
1320 |
-
echo ' -v[v][v] Print verbose output'.PHP_EOL;
|
1321 |
-
echo ' -i Show a list of installed coding standards'.PHP_EOL;
|
1322 |
-
echo ' -d Set the [key] php.ini value to [value] or [true] if value is omitted'.PHP_EOL;
|
1323 |
-
echo ' --help Print this help message'.PHP_EOL;
|
1324 |
-
echo ' --version Print version information'.PHP_EOL;
|
1325 |
-
echo ' --colors Use colors in output'.PHP_EOL;
|
1326 |
-
echo ' --no-colors Do not use colors in output (this is the default)'.PHP_EOL;
|
1327 |
-
echo ' <file> One or more files and/or directories to check'.PHP_EOL;
|
1328 |
-
echo ' <fileList> A file containing a list of files and/or directories to check (one per line)'.PHP_EOL;
|
1329 |
-
echo ' <stdinPath> If processing STDIN, the file path that STDIN will be processed as '.PHP_EOL;
|
1330 |
-
echo ' <bootstrap> A comma separated list of files to run before processing starts'.PHP_EOL;
|
1331 |
-
echo ' <encoding> The encoding of the files being checked (default is iso-8859-1)'.PHP_EOL;
|
1332 |
-
echo ' <extensions> A comma separated list of file extensions to check'.PHP_EOL;
|
1333 |
-
echo ' (extension filtering only valid when checking a directory)'.PHP_EOL;
|
1334 |
-
echo ' The type of the file can be specified using: ext/type'.PHP_EOL;
|
1335 |
-
echo ' e.g., module/php,es/js'.PHP_EOL;
|
1336 |
-
echo ' <generator> Uses either the "HTML", "Markdown" or "Text" generator'.PHP_EOL;
|
1337 |
-
echo ' (forces documentation generation instead of checking)'.PHP_EOL;
|
1338 |
-
echo ' <patterns> A comma separated list of patterns to ignore files and directories'.PHP_EOL;
|
1339 |
-
echo ' <report> Print either the "full", "xml", "checkstyle", "csv"'.PHP_EOL;
|
1340 |
-
echo ' "json", "emacs", "source", "summary", "diff", "junit"'.PHP_EOL;
|
1341 |
-
echo ' "svnblame", "gitblame", "hgblame" or "notifysend" report'.PHP_EOL;
|
1342 |
-
echo ' (the "full" report is printed by default)'.PHP_EOL;
|
1343 |
-
echo ' <reportFile> Write the report to the specified file path'.PHP_EOL;
|
1344 |
-
echo ' <reportWidth> How many columns wide screen reports should be printed'.PHP_EOL;
|
1345 |
-
echo ' or set to "auto" to use current screen width, where supported'.PHP_EOL;
|
1346 |
-
echo ' <sniffs> A comma separated list of sniff codes to include or exclude during checking'.PHP_EOL;
|
1347 |
-
echo ' (all sniffs must be part of the specified standard)'.PHP_EOL;
|
1348 |
-
echo ' <severity> The minimum severity required to display an error or warning'.PHP_EOL;
|
1349 |
-
echo ' <standard> The name or path of the coding standard to use'.PHP_EOL;
|
1350 |
-
echo ' <tabWidth> The number of spaces each tab represents'.PHP_EOL;
|
1351 |
-
|
1352 |
-
}//end printPHPCSUsage()
|
1353 |
-
|
1354 |
-
|
1355 |
-
/**
|
1356 |
-
* Prints out the usage information for PHPCBF.
|
1357 |
-
*
|
1358 |
-
* @return void
|
1359 |
-
*/
|
1360 |
-
public function printPHPCBFUsage()
|
1361 |
-
{
|
1362 |
-
echo 'Usage: phpcbf [-nwli] [-d key[=value]] [--stdin-path=<stdinPath>]'.PHP_EOL;
|
1363 |
-
echo ' [--standard=<standard>] [--sniffs=<sniffs>] [--exclude=<sniffs>] [--suffix=<suffix>]'.PHP_EOL;
|
1364 |
-
echo ' [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]'.PHP_EOL;
|
1365 |
-
echo ' [--tab-width=<tabWidth>] [--encoding=<encoding>]'.PHP_EOL;
|
1366 |
-
echo ' [--extensions=<extensions>] [--ignore=<patterns>] [--bootstrap=<bootstrap>]'.PHP_EOL;
|
1367 |
-
echo ' [--file-list=<fileList>] <file> ...'.PHP_EOL;
|
1368 |
-
echo ' -n Do not fix warnings (shortcut for --warning-severity=0)'.PHP_EOL;
|
1369 |
-
echo ' -w Fix both warnings and errors (on by default)'.PHP_EOL;
|
1370 |
-
echo ' -l Local directory only, no recursion'.PHP_EOL;
|
1371 |
-
echo ' -i Show a list of installed coding standards'.PHP_EOL;
|
1372 |
-
echo ' -d Set the [key] php.ini value to [value] or [true] if value is omitted'.PHP_EOL;
|
1373 |
-
echo ' --help Print this help message'.PHP_EOL;
|
1374 |
-
echo ' --version Print version information'.PHP_EOL;
|
1375 |
-
echo ' --no-patch Do not make use of the "diff" or "patch" programs'.PHP_EOL;
|
1376 |
-
echo ' <file> One or more files and/or directories to fix'.PHP_EOL;
|
1377 |
-
echo ' <fileList> A file containing a list of files and/or directories to fix (one per line)'.PHP_EOL;
|
1378 |
-
echo ' <stdinPath> If processing STDIN, the file path that STDIN will be processed as '.PHP_EOL;
|
1379 |
-
echo ' <bootstrap> A comma separated list of files to run before processing starts'.PHP_EOL;
|
1380 |
-
echo ' <encoding> The encoding of the files being fixed (default is iso-8859-1)'.PHP_EOL;
|
1381 |
-
echo ' <extensions> A comma separated list of file extensions to fix'.PHP_EOL;
|
1382 |
-
echo ' (extension filtering only valid when checking a directory)'.PHP_EOL;
|
1383 |
-
echo ' The type of the file can be specified using: ext/type'.PHP_EOL;
|
1384 |
-
echo ' e.g., module/php,es/js'.PHP_EOL;
|
1385 |
-
echo ' <patterns> A comma separated list of patterns to ignore files and directories'.PHP_EOL;
|
1386 |
-
echo ' <sniffs> A comma separated list of sniff codes to include or exclude during fixing'.PHP_EOL;
|
1387 |
-
echo ' (all sniffs must be part of the specified standard)'.PHP_EOL;
|
1388 |
-
echo ' <severity> The minimum severity required to fix an error or warning'.PHP_EOL;
|
1389 |
-
echo ' <standard> The name or path of the coding standard to use'.PHP_EOL;
|
1390 |
-
echo ' <suffix> Write modified files to a filename using this suffix'.PHP_EOL;
|
1391 |
-
echo ' ("diff" and "patch" are not used in this mode)'.PHP_EOL;
|
1392 |
-
echo ' <tabWidth> The number of spaces each tab represents'.PHP_EOL;
|
1393 |
-
|
1394 |
-
}//end printPHPCBFUsage()
|
1395 |
-
|
1396 |
-
|
1397 |
-
/**
|
1398 |
-
* Prints out a list of installed coding standards.
|
1399 |
-
*
|
1400 |
-
* @return void
|
1401 |
-
*/
|
1402 |
-
public function printInstalledStandards()
|
1403 |
-
{
|
1404 |
-
$installedStandards = PHP_CodeSniffer::getInstalledStandards();
|
1405 |
-
$numStandards = count($installedStandards);
|
1406 |
-
|
1407 |
-
if ($numStandards === 0) {
|
1408 |
-
echo 'No coding standards are installed.'.PHP_EOL;
|
1409 |
-
} else {
|
1410 |
-
$lastStandard = array_pop($installedStandards);
|
1411 |
-
if ($numStandards === 1) {
|
1412 |
-
echo "The only coding standard installed is $lastStandard".PHP_EOL;
|
1413 |
-
} else {
|
1414 |
-
$standardList = implode(', ', $installedStandards);
|
1415 |
-
$standardList .= ' and '.$lastStandard;
|
1416 |
-
echo 'The installed coding standards are '.$standardList.PHP_EOL;
|
1417 |
-
}
|
1418 |
-
}
|
1419 |
-
|
1420 |
-
}//end printInstalledStandards()
|
1421 |
-
|
1422 |
-
|
1423 |
-
/**
|
1424 |
-
* Set report width based on terminal width.
|
1425 |
-
*
|
1426 |
-
* @param int $width The width of the report. If "auto" then will
|
1427 |
-
* be replaced by the terminal width.
|
1428 |
-
*
|
1429 |
-
* @return int
|
1430 |
-
*/
|
1431 |
-
private function _validateReportWidth($width)
|
1432 |
-
{
|
1433 |
-
if ($width === 'auto'
|
1434 |
-
&& preg_match('|\d+ (\d+)|', shell_exec('stty size 2>&1'), $matches) === 1
|
1435 |
-
) {
|
1436 |
-
return (int) $matches[1];
|
1437 |
-
}
|
1438 |
-
|
1439 |
-
return (int) $width;
|
1440 |
-
|
1441 |
-
}//end _validateReportWidth()
|
1442 |
-
|
1443 |
-
|
1444 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators/Generator.php
DELETED
@@ -1,184 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* The base class for all PHP_CodeSniffer documentation generators.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
10 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
11 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
12 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
13 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
14 |
-
*/
|
15 |
-
|
16 |
-
/**
|
17 |
-
* The base class for all PHP_CodeSniffer documentation generators.
|
18 |
-
*
|
19 |
-
* Documentation generators are used to print documentation about code sniffs
|
20 |
-
* in a standard.
|
21 |
-
*
|
22 |
-
* @category PHP
|
23 |
-
* @package PHP_CodeSniffer
|
24 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
25 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
26 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
27 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
28 |
-
* @version Release: @package_version@
|
29 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
30 |
-
*/
|
31 |
-
abstract class PHP_CodeSniffer_DocGenerators_Generator
|
32 |
-
{
|
33 |
-
|
34 |
-
/**
|
35 |
-
* The name of the coding standard we are generating docs for.
|
36 |
-
*
|
37 |
-
* @var string
|
38 |
-
*/
|
39 |
-
private $_standard = '';
|
40 |
-
|
41 |
-
/**
|
42 |
-
* An array of sniffs that we are limiting the generated docs to.
|
43 |
-
*
|
44 |
-
* If this array is empty, docs are generated for all sniffs in the
|
45 |
-
* supplied coding standard.
|
46 |
-
*
|
47 |
-
* @var string
|
48 |
-
*/
|
49 |
-
private $_sniffs = array();
|
50 |
-
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Constructs a PHP_CodeSniffer_DocGenerators_Generator object.
|
54 |
-
*
|
55 |
-
* @param string $standard The name of the coding standard to generate
|
56 |
-
* docs for.
|
57 |
-
* @param array $sniffs An array of sniffs that we are limiting the
|
58 |
-
* generated docs to.
|
59 |
-
*
|
60 |
-
* @see generate()
|
61 |
-
*/
|
62 |
-
public function __construct($standard, array $sniffs=array())
|
63 |
-
{
|
64 |
-
$this->_standard = $standard;
|
65 |
-
$this->_sniffs = $sniffs;
|
66 |
-
|
67 |
-
}//end __construct()
|
68 |
-
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Retrieves the title of the sniff from the DOMNode supplied.
|
72 |
-
*
|
73 |
-
* @param DOMNode $doc The DOMNode object for the sniff.
|
74 |
-
* It represents the "documentation" tag in the XML
|
75 |
-
* standard file.
|
76 |
-
*
|
77 |
-
* @return string
|
78 |
-
*/
|
79 |
-
protected function getTitle(DOMNode $doc)
|
80 |
-
{
|
81 |
-
return $doc->getAttribute('title');
|
82 |
-
|
83 |
-
}//end getTitle()
|
84 |
-
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Retrieves the name of the standard we are generating docs for.
|
88 |
-
*
|
89 |
-
* @return string
|
90 |
-
*/
|
91 |
-
protected function getStandard()
|
92 |
-
{
|
93 |
-
return $this->_standard;
|
94 |
-
|
95 |
-
}//end getStandard()
|
96 |
-
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Generates the documentation for a standard.
|
100 |
-
*
|
101 |
-
* It's probably wise for doc generators to override this method so they
|
102 |
-
* have control over how the docs are produced. Otherwise, the processSniff
|
103 |
-
* method should be overridden to output content for each sniff.
|
104 |
-
*
|
105 |
-
* @return void
|
106 |
-
* @see processSniff()
|
107 |
-
*/
|
108 |
-
public function generate()
|
109 |
-
{
|
110 |
-
$standardFiles = $this->getStandardFiles();
|
111 |
-
|
112 |
-
foreach ($standardFiles as $standard) {
|
113 |
-
$doc = new DOMDocument();
|
114 |
-
$doc->load($standard);
|
115 |
-
$documentation = $doc->getElementsByTagName('documentation')->item(0);
|
116 |
-
$this->processSniff($documentation);
|
117 |
-
}
|
118 |
-
|
119 |
-
}//end generate()
|
120 |
-
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Returns a list of paths to XML standard files for all sniffs in a standard.
|
124 |
-
*
|
125 |
-
* Any sniffs that do not have an XML standard file are obviously not included
|
126 |
-
* in the returned array. If documentation is only being generated for some
|
127 |
-
* sniffs (ie. $this->_sniffs is not empty) then all others sniffs will
|
128 |
-
* be filtered from the results as well.
|
129 |
-
*
|
130 |
-
* @return string[]
|
131 |
-
*/
|
132 |
-
protected function getStandardFiles()
|
133 |
-
{
|
134 |
-
$phpcs = new PHP_CodeSniffer();
|
135 |
-
$phpcs->process(array(), $this->_standard);
|
136 |
-
$sniffs = $phpcs->getSniffs();
|
137 |
-
|
138 |
-
$standardFiles = array();
|
139 |
-
foreach ($sniffs as $className => $sniffClass) {
|
140 |
-
$object = new ReflectionObject($sniffClass);
|
141 |
-
$sniff = $object->getFilename();
|
142 |
-
if (empty($this->_sniffs) === false) {
|
143 |
-
// We are limiting the docs to certain sniffs only, so filter
|
144 |
-
// out any unwanted sniffs.
|
145 |
-
$parts = explode('_', $className);
|
146 |
-
$sniffName = $parts[0].'.'.$parts[2].'.'.substr($parts[3], 0, -5);
|
147 |
-
if (in_array($sniffName, $this->_sniffs) === false) {
|
148 |
-
continue;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
$standardFile = str_replace(
|
153 |
-
DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR,
|
154 |
-
DIRECTORY_SEPARATOR.'Docs'.DIRECTORY_SEPARATOR,
|
155 |
-
$sniff
|
156 |
-
);
|
157 |
-
$standardFile = str_replace('Sniff.php', 'Standard.xml', $standardFile);
|
158 |
-
|
159 |
-
if (is_file($standardFile) === true) {
|
160 |
-
$standardFiles[] = $standardFile;
|
161 |
-
}
|
162 |
-
}//end foreach
|
163 |
-
|
164 |
-
return $standardFiles;
|
165 |
-
|
166 |
-
}//end getStandardFiles()
|
167 |
-
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Process the documentation for a single sniff.
|
171 |
-
*
|
172 |
-
* Doc generators must implement this function to produce output.
|
173 |
-
*
|
174 |
-
* @param DOMNode $doc The DOMNode object for the sniff.
|
175 |
-
* It represents the "documentation" tag in the XML
|
176 |
-
* standard file.
|
177 |
-
*
|
178 |
-
* @return void
|
179 |
-
* @see generate()
|
180 |
-
*/
|
181 |
-
protected abstract function processSniff(DOMNode $doc);
|
182 |
-
|
183 |
-
|
184 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators/HTML.php
DELETED
@@ -1,292 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A doc generator that outputs documentation in one big HTML file.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
10 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
11 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
12 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
13 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
14 |
-
*/
|
15 |
-
|
16 |
-
if (class_exists('PHP_CodeSniffer_DocGenerators_Generator', true) === false) {
|
17 |
-
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_DocGenerators_Generator not found');
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* A doc generator that outputs documentation in one big HTML file.
|
22 |
-
*
|
23 |
-
* Output is in one large HTML file and is designed for you to style with
|
24 |
-
* your own stylesheet. It contains a table of contents at the top with anchors
|
25 |
-
* to each sniff.
|
26 |
-
*
|
27 |
-
* @category PHP
|
28 |
-
* @package PHP_CodeSniffer
|
29 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
30 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
31 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
32 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
33 |
-
* @version Release: @package_version@
|
34 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
35 |
-
*/
|
36 |
-
class PHP_CodeSniffer_DocGenerators_HTML extends PHP_CodeSniffer_DocGenerators_Generator
|
37 |
-
{
|
38 |
-
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Generates the documentation for a standard.
|
42 |
-
*
|
43 |
-
* @return void
|
44 |
-
* @see processSniff()
|
45 |
-
*/
|
46 |
-
public function generate()
|
47 |
-
{
|
48 |
-
ob_start();
|
49 |
-
$this->printHeader();
|
50 |
-
|
51 |
-
$standardFiles = $this->getStandardFiles();
|
52 |
-
$this->printToc($standardFiles);
|
53 |
-
|
54 |
-
foreach ($standardFiles as $standard) {
|
55 |
-
$doc = new DOMDocument();
|
56 |
-
$doc->load($standard);
|
57 |
-
$documentation = $doc->getElementsByTagName('documentation')->item(0);
|
58 |
-
$this->processSniff($documentation);
|
59 |
-
}
|
60 |
-
|
61 |
-
$this->printFooter();
|
62 |
-
|
63 |
-
$content = ob_get_contents();
|
64 |
-
ob_end_clean();
|
65 |
-
|
66 |
-
echo $content;
|
67 |
-
|
68 |
-
}//end generate()
|
69 |
-
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Print the header of the HTML page.
|
73 |
-
*
|
74 |
-
* @return void
|
75 |
-
*/
|
76 |
-
protected function printHeader()
|
77 |
-
{
|
78 |
-
$standard = $this->getStandard();
|
79 |
-
echo '<html>'.PHP_EOL;
|
80 |
-
echo ' <head>'.PHP_EOL;
|
81 |
-
echo " <title>$standard Coding Standards</title>".PHP_EOL;
|
82 |
-
echo ' <style>
|
83 |
-
body {
|
84 |
-
background-color: #FFFFFF;
|
85 |
-
font-size: 14px;
|
86 |
-
font-family: Arial, Helvetica, sans-serif;
|
87 |
-
color: #000000;
|
88 |
-
}
|
89 |
-
|
90 |
-
h1 {
|
91 |
-
color: #666666;
|
92 |
-
font-size: 20px;
|
93 |
-
font-weight: bold;
|
94 |
-
margin-top: 0px;
|
95 |
-
background-color: #E6E7E8;
|
96 |
-
padding: 20px;
|
97 |
-
border: 1px solid #BBBBBB;
|
98 |
-
}
|
99 |
-
|
100 |
-
h2 {
|
101 |
-
color: #00A5E3;
|
102 |
-
font-size: 16px;
|
103 |
-
font-weight: normal;
|
104 |
-
margin-top: 50px;
|
105 |
-
}
|
106 |
-
|
107 |
-
.code-comparison {
|
108 |
-
width: 100%;
|
109 |
-
}
|
110 |
-
|
111 |
-
.code-comparison td {
|
112 |
-
border: 1px solid #CCCCCC;
|
113 |
-
}
|
114 |
-
|
115 |
-
.code-comparison-title, .code-comparison-code {
|
116 |
-
font-family: Arial, Helvetica, sans-serif;
|
117 |
-
font-size: 12px;
|
118 |
-
color: #000000;
|
119 |
-
vertical-align: top;
|
120 |
-
padding: 4px;
|
121 |
-
width: 50%;
|
122 |
-
background-color: #F1F1F1;
|
123 |
-
line-height: 15px;
|
124 |
-
}
|
125 |
-
|
126 |
-
.code-comparison-code {
|
127 |
-
font-family: Courier;
|
128 |
-
background-color: #F9F9F9;
|
129 |
-
}
|
130 |
-
|
131 |
-
.code-comparison-highlight {
|
132 |
-
background-color: #DDF1F7;
|
133 |
-
border: 1px solid #00A5E3;
|
134 |
-
line-height: 15px;
|
135 |
-
}
|
136 |
-
|
137 |
-
.tag-line {
|
138 |
-
text-align: center;
|
139 |
-
width: 100%;
|
140 |
-
margin-top: 30px;
|
141 |
-
font-size: 12px;
|
142 |
-
}
|
143 |
-
|
144 |
-
.tag-line a {
|
145 |
-
color: #000000;
|
146 |
-
}
|
147 |
-
</style>'.PHP_EOL;
|
148 |
-
echo ' </head>'.PHP_EOL;
|
149 |
-
echo ' <body>'.PHP_EOL;
|
150 |
-
echo " <h1>$standard Coding Standards</h1>".PHP_EOL;
|
151 |
-
|
152 |
-
}//end printHeader()
|
153 |
-
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Print the table of contents for the standard.
|
157 |
-
*
|
158 |
-
* The TOC is just an unordered list of bookmarks to sniffs on the page.
|
159 |
-
*
|
160 |
-
* @param array $standardFiles An array of paths to the XML standard files.
|
161 |
-
*
|
162 |
-
* @return void
|
163 |
-
*/
|
164 |
-
protected function printToc($standardFiles)
|
165 |
-
{
|
166 |
-
echo ' <h2>Table of Contents</h2>'.PHP_EOL;
|
167 |
-
echo ' <ul class="toc">'.PHP_EOL;
|
168 |
-
|
169 |
-
foreach ($standardFiles as $standard) {
|
170 |
-
$doc = new DOMDocument();
|
171 |
-
$doc->load($standard);
|
172 |
-
$documentation = $doc->getElementsByTagName('documentation')->item(0);
|
173 |
-
$title = $this->getTitle($documentation);
|
174 |
-
echo ' <li><a href="#'.str_replace(' ', '-', $title)."\">$title</a></li>".PHP_EOL;
|
175 |
-
}
|
176 |
-
|
177 |
-
echo ' </ul>'.PHP_EOL;
|
178 |
-
|
179 |
-
}//end printToc()
|
180 |
-
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Print the footer of the HTML page.
|
184 |
-
*
|
185 |
-
* @return void
|
186 |
-
*/
|
187 |
-
protected function printFooter()
|
188 |
-
{
|
189 |
-
// Turn off errors so we don't get timezone warnings if people
|
190 |
-
// don't have their timezone set.
|
191 |
-
$errorLevel = error_reporting(0);
|
192 |
-
echo ' <div class="tag-line">';
|
193 |
-
echo 'Documentation generated on '.date('r');
|
194 |
-
echo ' by <a href="https://github.com/squizlabs/PHP_CodeSniffer">PHP_CodeSniffer '.PHP_CodeSniffer::VERSION.'</a>';
|
195 |
-
echo '</div>'.PHP_EOL;
|
196 |
-
error_reporting($errorLevel);
|
197 |
-
|
198 |
-
echo ' </body>'.PHP_EOL;
|
199 |
-
echo '</html>'.PHP_EOL;
|
200 |
-
|
201 |
-
}//end printFooter()
|
202 |
-
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Process the documentation for a single sniff.
|
206 |
-
*
|
207 |
-
* @param DOMNode $doc The DOMNode object for the sniff.
|
208 |
-
* It represents the "documentation" tag in the XML
|
209 |
-
* standard file.
|
210 |
-
*
|
211 |
-
* @return void
|
212 |
-
*/
|
213 |
-
public function processSniff(DOMNode $doc)
|
214 |
-
{
|
215 |
-
$title = $this->getTitle($doc);
|
216 |
-
echo ' <a name="'.str_replace(' ', '-', $title).'" />'.PHP_EOL;
|
217 |
-
echo " <h2>$title</h2>".PHP_EOL;
|
218 |
-
|
219 |
-
foreach ($doc->childNodes as $node) {
|
220 |
-
if ($node->nodeName === 'standard') {
|
221 |
-
$this->printTextBlock($node);
|
222 |
-
} else if ($node->nodeName === 'code_comparison') {
|
223 |
-
$this->printCodeComparisonBlock($node);
|
224 |
-
}
|
225 |
-
}
|
226 |
-
|
227 |
-
}//end processSniff()
|
228 |
-
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Print a text block found in a standard.
|
232 |
-
*
|
233 |
-
* @param DOMNode $node The DOMNode object for the text block.
|
234 |
-
*
|
235 |
-
* @return void
|
236 |
-
*/
|
237 |
-
protected function printTextBlock($node)
|
238 |
-
{
|
239 |
-
$content = trim($node->nodeValue);
|
240 |
-
$content = htmlspecialchars($content);
|
241 |
-
|
242 |
-
// Allow em tags only.
|
243 |
-
$content = str_replace('<em>', '<em>', $content);
|
244 |
-
$content = str_replace('</em>', '</em>', $content);
|
245 |
-
|
246 |
-
echo " <p class=\"text\">$content</p>".PHP_EOL;
|
247 |
-
|
248 |
-
}//end printTextBlock()
|
249 |
-
|
250 |
-
|
251 |
-
/**
|
252 |
-
* Print a code comparison block found in a standard.
|
253 |
-
*
|
254 |
-
* @param DOMNode $node The DOMNode object for the code comparison block.
|
255 |
-
*
|
256 |
-
* @return void
|
257 |
-
*/
|
258 |
-
protected function printCodeComparisonBlock($node)
|
259 |
-
{
|
260 |
-
$codeBlocks = $node->getElementsByTagName('code');
|
261 |
-
|
262 |
-
$firstTitle = $codeBlocks->item(0)->getAttribute('title');
|
263 |
-
$first = trim($codeBlocks->item(0)->nodeValue);
|
264 |
-
$first = str_replace('<?php', '<?php', $first);
|
265 |
-
$first = str_replace("\n", '</br>', $first);
|
266 |
-
$first = str_replace(' ', ' ', $first);
|
267 |
-
$first = str_replace('<em>', '<span class="code-comparison-highlight">', $first);
|
268 |
-
$first = str_replace('</em>', '</span>', $first);
|
269 |
-
|
270 |
-
$secondTitle = $codeBlocks->item(1)->getAttribute('title');
|
271 |
-
$second = trim($codeBlocks->item(1)->nodeValue);
|
272 |
-
$second = str_replace('<?php', '<?php', $second);
|
273 |
-
$second = str_replace("\n", '</br>', $second);
|
274 |
-
$second = str_replace(' ', ' ', $second);
|
275 |
-
$second = str_replace('<em>', '<span class="code-comparison-highlight">', $second);
|
276 |
-
$second = str_replace('</em>', '</span>', $second);
|
277 |
-
|
278 |
-
echo ' <table class="code-comparison">'.PHP_EOL;
|
279 |
-
echo ' <tr>'.PHP_EOL;
|
280 |
-
echo " <td class=\"code-comparison-title\">$firstTitle</td>".PHP_EOL;
|
281 |
-
echo " <td class=\"code-comparison-title\">$secondTitle</td>".PHP_EOL;
|
282 |
-
echo ' </tr>'.PHP_EOL;
|
283 |
-
echo ' <tr>'.PHP_EOL;
|
284 |
-
echo " <td class=\"code-comparison-code\">$first</td>".PHP_EOL;
|
285 |
-
echo " <td class=\"code-comparison-code\">$second</td>".PHP_EOL;
|
286 |
-
echo ' </tr>'.PHP_EOL;
|
287 |
-
echo ' </table>'.PHP_EOL;
|
288 |
-
|
289 |
-
}//end printCodeComparisonBlock()
|
290 |
-
|
291 |
-
|
292 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators/Markdown.php
DELETED
@@ -1,179 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A doc generator that outputs documentation in Markdown format.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Stefano Kowalke <blueduck@gmx.net>
|
10 |
-
* @copyright 2014 Arroba IT
|
11 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
12 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
13 |
-
*/
|
14 |
-
|
15 |
-
if (class_exists('PHP_CodeSniffer_DocGenerators_Generator', true) === false) {
|
16 |
-
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_DocGenerators_Generator not found');
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* A doc generator that outputs documentation in Markdown format.
|
21 |
-
*
|
22 |
-
* @category PHP
|
23 |
-
* @package PHP_CodeSniffer
|
24 |
-
* @author Stefano Kowalke <blueduck@gmx.net>
|
25 |
-
* @copyright 2014 Arroba IT
|
26 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
27 |
-
* @version Release: @package_version@
|
28 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
29 |
-
*/
|
30 |
-
class PHP_CodeSniffer_DocGenerators_Markdown extends PHP_CodeSniffer_DocGenerators_Generator
|
31 |
-
{
|
32 |
-
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Generates the documentation for a standard.
|
36 |
-
*
|
37 |
-
* @return void
|
38 |
-
* @see processSniff()
|
39 |
-
*/
|
40 |
-
public function generate()
|
41 |
-
{
|
42 |
-
ob_start();
|
43 |
-
$this->printHeader();
|
44 |
-
|
45 |
-
$standardFiles = $this->getStandardFiles();
|
46 |
-
|
47 |
-
foreach ($standardFiles as $standard) {
|
48 |
-
$doc = new DOMDocument();
|
49 |
-
$doc->load($standard);
|
50 |
-
$documentation = $doc->getElementsByTagName('documentation')->item(0);
|
51 |
-
$this->processSniff($documentation);
|
52 |
-
}
|
53 |
-
|
54 |
-
$this->printFooter();
|
55 |
-
$content = ob_get_contents();
|
56 |
-
ob_end_clean();
|
57 |
-
|
58 |
-
echo $content;
|
59 |
-
|
60 |
-
}//end generate()
|
61 |
-
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Print the markdown header.
|
65 |
-
*
|
66 |
-
* @return void
|
67 |
-
*/
|
68 |
-
protected function printHeader()
|
69 |
-
{
|
70 |
-
$standard = $this->getStandard();
|
71 |
-
|
72 |
-
echo "# $standard Coding Standard".PHP_EOL;
|
73 |
-
|
74 |
-
}//end printHeader()
|
75 |
-
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Print the markdown footer.
|
79 |
-
*
|
80 |
-
* @return void
|
81 |
-
*/
|
82 |
-
protected function printFooter()
|
83 |
-
{
|
84 |
-
// Turn off errors so we don't get timezone warnings if people
|
85 |
-
// don't have their timezone set.
|
86 |
-
error_reporting(0);
|
87 |
-
echo 'Documentation generated on '.date('r');
|
88 |
-
echo ' by [PHP_CodeSniffer '.PHP_CodeSniffer::VERSION.'](https://github.com/squizlabs/PHP_CodeSniffer)';
|
89 |
-
|
90 |
-
}//end printFooter()
|
91 |
-
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Process the documentation for a single sniff.
|
95 |
-
*
|
96 |
-
* @param DOMNode $doc The DOMNode object for the sniff.
|
97 |
-
* It represents the "documentation" tag in the XML
|
98 |
-
* standard file.
|
99 |
-
*
|
100 |
-
* @return void
|
101 |
-
*/
|
102 |
-
protected function processSniff(DOMNode $doc)
|
103 |
-
{
|
104 |
-
$title = $this->getTitle($doc);
|
105 |
-
echo "## $title".PHP_EOL;
|
106 |
-
|
107 |
-
foreach ($doc->childNodes as $node) {
|
108 |
-
if ($node->nodeName === 'standard') {
|
109 |
-
$this->printTextBlock($node);
|
110 |
-
} else if ($node->nodeName === 'code_comparison') {
|
111 |
-
$this->printCodeComparisonBlock($node);
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
}//end processSniff()
|
116 |
-
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Print a text block found in a standard.
|
120 |
-
*
|
121 |
-
* @param DOMNode $node The DOMNode object for the text block.
|
122 |
-
*
|
123 |
-
* @return void
|
124 |
-
*/
|
125 |
-
protected function printTextBlock(DOMNode $node)
|
126 |
-
{
|
127 |
-
$content = trim($node->nodeValue);
|
128 |
-
$content = htmlspecialchars($content);
|
129 |
-
|
130 |
-
$content = str_replace('<em>', '*', $content);
|
131 |
-
$content = str_replace('</em>', '*', $content);
|
132 |
-
|
133 |
-
echo $content.PHP_EOL;
|
134 |
-
|
135 |
-
}//end printTextBlock()
|
136 |
-
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Print a code comparison block found in a standard.
|
140 |
-
*
|
141 |
-
* @param DOMNode $node The DOMNode object for the code comparison block.
|
142 |
-
*
|
143 |
-
* @return void
|
144 |
-
*/
|
145 |
-
protected function printCodeComparisonBlock(DOMNode $node)
|
146 |
-
{
|
147 |
-
$codeBlocks = $node->getElementsByTagName('code');
|
148 |
-
|
149 |
-
$firstTitle = $codeBlocks->item(0)->getAttribute('title');
|
150 |
-
$first = trim($codeBlocks->item(0)->nodeValue);
|
151 |
-
$first = str_replace("\n", "\n ", $first);
|
152 |
-
$first = str_replace('<em>', '', $first);
|
153 |
-
$first = str_replace('</em>', '', $first);
|
154 |
-
|
155 |
-
$secondTitle = $codeBlocks->item(1)->getAttribute('title');
|
156 |
-
$second = trim($codeBlocks->item(1)->nodeValue);
|
157 |
-
$second = str_replace("\n", "\n ", $second);
|
158 |
-
$second = str_replace('<em>', '', $second);
|
159 |
-
$second = str_replace('</em>', '', $second);
|
160 |
-
|
161 |
-
echo ' <table>'.PHP_EOL;
|
162 |
-
echo ' <tr>'.PHP_EOL;
|
163 |
-
echo " <th>$firstTitle</th>".PHP_EOL;
|
164 |
-
echo " <th>$secondTitle</th>".PHP_EOL;
|
165 |
-
echo ' </tr>'.PHP_EOL;
|
166 |
-
echo ' <tr>'.PHP_EOL;
|
167 |
-
echo '<td>'.PHP_EOL.PHP_EOL;
|
168 |
-
echo " $first".PHP_EOL.PHP_EOL;
|
169 |
-
echo '</td>'.PHP_EOL;
|
170 |
-
echo '<td>'.PHP_EOL.PHP_EOL;
|
171 |
-
echo " $second".PHP_EOL.PHP_EOL;
|
172 |
-
echo '</td>'.PHP_EOL;
|
173 |
-
echo ' </tr>'.PHP_EOL;
|
174 |
-
echo ' </table>'.PHP_EOL;
|
175 |
-
|
176 |
-
}//end printCodeComparisonBlock()
|
177 |
-
|
178 |
-
|
179 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/DocGenerators/Text.php
DELETED
@@ -1,265 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A doc generator that outputs text-based documentation.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
10 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
11 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
12 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
13 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
14 |
-
*/
|
15 |
-
|
16 |
-
if (class_exists('PHP_CodeSniffer_DocGenerators_Generator', true) === false) {
|
17 |
-
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_DocGenerators_Generator not found');
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* A doc generator that outputs text-based documentation.
|
22 |
-
*
|
23 |
-
* Output is designed to be displayed in a terminal and is wrapped to 100 characters.
|
24 |
-
*
|
25 |
-
* @category PHP
|
26 |
-
* @package PHP_CodeSniffer
|
27 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
28 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
29 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
30 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
31 |
-
* @version Release: @package_version@
|
32 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
33 |
-
*/
|
34 |
-
class PHP_CodeSniffer_DocGenerators_Text extends PHP_CodeSniffer_DocGenerators_Generator
|
35 |
-
{
|
36 |
-
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Process the documentation for a single sniff.
|
40 |
-
*
|
41 |
-
* @param DOMNode $doc The DOMNode object for the sniff.
|
42 |
-
* It represents the "documentation" tag in the XML
|
43 |
-
* standard file.
|
44 |
-
*
|
45 |
-
* @return void
|
46 |
-
*/
|
47 |
-
public function processSniff(DOMNode $doc)
|
48 |
-
{
|
49 |
-
$this->printTitle($doc);
|
50 |
-
|
51 |
-
foreach ($doc->childNodes as $node) {
|
52 |
-
if ($node->nodeName === 'standard') {
|
53 |
-
$this->printTextBlock($node);
|
54 |
-
} else if ($node->nodeName === 'code_comparison') {
|
55 |
-
$this->printCodeComparisonBlock($node);
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
}//end processSniff()
|
60 |
-
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Prints the title area for a single sniff.
|
64 |
-
*
|
65 |
-
* @param DOMNode $doc The DOMNode object for the sniff.
|
66 |
-
* It represents the "documentation" tag in the XML
|
67 |
-
* standard file.
|
68 |
-
*
|
69 |
-
* @return void
|
70 |
-
*/
|
71 |
-
protected function printTitle(DOMNode $doc)
|
72 |
-
{
|
73 |
-
$title = $this->getTitle($doc);
|
74 |
-
$standard = $this->getStandard();
|
75 |
-
|
76 |
-
echo PHP_EOL;
|
77 |
-
echo str_repeat('-', (strlen("$standard CODING STANDARD: $title") + 4));
|
78 |
-
echo strtoupper(PHP_EOL."| $standard CODING STANDARD: $title |".PHP_EOL);
|
79 |
-
echo str_repeat('-', (strlen("$standard CODING STANDARD: $title") + 4));
|
80 |
-
echo PHP_EOL.PHP_EOL;
|
81 |
-
|
82 |
-
}//end printTitle()
|
83 |
-
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Print a text block found in a standard.
|
87 |
-
*
|
88 |
-
* @param DOMNode $node The DOMNode object for the text block.
|
89 |
-
*
|
90 |
-
* @return void
|
91 |
-
*/
|
92 |
-
protected function printTextBlock($node)
|
93 |
-
{
|
94 |
-
$text = trim($node->nodeValue);
|
95 |
-
$text = str_replace('<em>', '*', $text);
|
96 |
-
$text = str_replace('</em>', '*', $text);
|
97 |
-
|
98 |
-
$lines = array();
|
99 |
-
$tempLine = '';
|
100 |
-
$words = explode(' ', $text);
|
101 |
-
|
102 |
-
foreach ($words as $word) {
|
103 |
-
if (strlen($tempLine.$word) >= 99) {
|
104 |
-
if (strlen($tempLine.$word) === 99) {
|
105 |
-
// Adding the extra space will push us to the edge
|
106 |
-
// so we are done.
|
107 |
-
$lines[] = $tempLine.$word;
|
108 |
-
$tempLine = '';
|
109 |
-
} else if (strlen($tempLine.$word) === 100) {
|
110 |
-
// We are already at the edge, so we are done.
|
111 |
-
$lines[] = $tempLine.$word;
|
112 |
-
$tempLine = '';
|
113 |
-
} else {
|
114 |
-
$lines[] = rtrim($tempLine);
|
115 |
-
$tempLine = $word.' ';
|
116 |
-
}
|
117 |
-
} else {
|
118 |
-
$tempLine .= $word.' ';
|
119 |
-
}
|
120 |
-
}//end foreach
|
121 |
-
|
122 |
-
if ($tempLine !== '') {
|
123 |
-
$lines[] = rtrim($tempLine);
|
124 |
-
}
|
125 |
-
|
126 |
-
echo implode(PHP_EOL, $lines).PHP_EOL.PHP_EOL;
|
127 |
-
|
128 |
-
}//end printTextBlock()
|
129 |
-
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Print a code comparison block found in a standard.
|
133 |
-
*
|
134 |
-
* @param DOMNode $node The DOMNode object for the code comparison block.
|
135 |
-
*
|
136 |
-
* @return void
|
137 |
-
*/
|
138 |
-
protected function printCodeComparisonBlock($node)
|
139 |
-
{
|
140 |
-
$codeBlocks = $node->getElementsByTagName('code');
|
141 |
-
$first = trim($codeBlocks->item(0)->nodeValue);
|
142 |
-
$firstTitle = $codeBlocks->item(0)->getAttribute('title');
|
143 |
-
|
144 |
-
$firstTitleLines = array();
|
145 |
-
$tempTitle = '';
|
146 |
-
$words = explode(' ', $firstTitle);
|
147 |
-
|
148 |
-
foreach ($words as $word) {
|
149 |
-
if (strlen($tempTitle.$word) >= 45) {
|
150 |
-
if (strlen($tempTitle.$word) === 45) {
|
151 |
-
// Adding the extra space will push us to the edge
|
152 |
-
// so we are done.
|
153 |
-
$firstTitleLines[] = $tempTitle.$word;
|
154 |
-
$tempTitle = '';
|
155 |
-
} else if (strlen($tempTitle.$word) === 46) {
|
156 |
-
// We are already at the edge, so we are done.
|
157 |
-
$firstTitleLines[] = $tempTitle.$word;
|
158 |
-
$tempTitle = '';
|
159 |
-
} else {
|
160 |
-
$firstTitleLines[] = $tempTitle;
|
161 |
-
$tempTitle = $word;
|
162 |
-
}
|
163 |
-
} else {
|
164 |
-
$tempTitle .= $word.' ';
|
165 |
-
}
|
166 |
-
}//end foreach
|
167 |
-
|
168 |
-
if ($tempTitle !== '') {
|
169 |
-
$firstTitleLines[] = $tempTitle;
|
170 |
-
}
|
171 |
-
|
172 |
-
$first = str_replace('<em>', '', $first);
|
173 |
-
$first = str_replace('</em>', '', $first);
|
174 |
-
$firstLines = explode("\n", $first);
|
175 |
-
|
176 |
-
$second = trim($codeBlocks->item(1)->nodeValue);
|
177 |
-
$secondTitle = $codeBlocks->item(1)->getAttribute('title');
|
178 |
-
|
179 |
-
$secondTitleLines = array();
|
180 |
-
$tempTitle = '';
|
181 |
-
$words = explode(' ', $secondTitle);
|
182 |
-
|
183 |
-
foreach ($words as $word) {
|
184 |
-
if (strlen($tempTitle.$word) >= 45) {
|
185 |
-
if (strlen($tempTitle.$word) === 45) {
|
186 |
-
// Adding the extra space will push us to the edge
|
187 |
-
// so we are done.
|
188 |
-
$secondTitleLines[] = $tempTitle.$word;
|
189 |
-
$tempTitle = '';
|
190 |
-
} else if (strlen($tempTitle.$word) === 46) {
|
191 |
-
// We are already at the edge, so we are done.
|
192 |
-
$secondTitleLines[] = $tempTitle.$word;
|
193 |
-
$tempTitle = '';
|
194 |
-
} else {
|
195 |
-
$secondTitleLines[] = $tempTitle;
|
196 |
-
$tempTitle = $word;
|
197 |
-
}
|
198 |
-
} else {
|
199 |
-
$tempTitle .= $word.' ';
|
200 |
-
}
|
201 |
-
}//end foreach
|
202 |
-
|
203 |
-
if ($tempTitle !== '') {
|
204 |
-
$secondTitleLines[] = $tempTitle;
|
205 |
-
}
|
206 |
-
|
207 |
-
$second = str_replace('<em>', '', $second);
|
208 |
-
$second = str_replace('</em>', '', $second);
|
209 |
-
$secondLines = explode("\n", $second);
|
210 |
-
|
211 |
-
$maxCodeLines = max(count($firstLines), count($secondLines));
|
212 |
-
$maxTitleLines = max(count($firstTitleLines), count($secondTitleLines));
|
213 |
-
|
214 |
-
echo str_repeat('-', 41);
|
215 |
-
echo ' CODE COMPARISON ';
|
216 |
-
echo str_repeat('-', 42).PHP_EOL;
|
217 |
-
|
218 |
-
for ($i = 0; $i < $maxTitleLines; $i++) {
|
219 |
-
if (isset($firstTitleLines[$i]) === true) {
|
220 |
-
$firstLineText = $firstTitleLines[$i];
|
221 |
-
} else {
|
222 |
-
$firstLineText = '';
|
223 |
-
}
|
224 |
-
|
225 |
-
if (isset($secondTitleLines[$i]) === true) {
|
226 |
-
$secondLineText = $secondTitleLines[$i];
|
227 |
-
} else {
|
228 |
-
$secondLineText = '';
|
229 |
-
}
|
230 |
-
|
231 |
-
echo '| ';
|
232 |
-
echo $firstLineText.str_repeat(' ', (46 - strlen($firstLineText)));
|
233 |
-
echo ' | ';
|
234 |
-
echo $secondLineText.str_repeat(' ', (47 - strlen($secondLineText)));
|
235 |
-
echo ' |'.PHP_EOL;
|
236 |
-
}//end for
|
237 |
-
|
238 |
-
echo str_repeat('-', 100).PHP_EOL;
|
239 |
-
|
240 |
-
for ($i = 0; $i < $maxCodeLines; $i++) {
|
241 |
-
if (isset($firstLines[$i]) === true) {
|
242 |
-
$firstLineText = $firstLines[$i];
|
243 |
-
} else {
|
244 |
-
$firstLineText = '';
|
245 |
-
}
|
246 |
-
|
247 |
-
if (isset($secondLines[$i]) === true) {
|
248 |
-
$secondLineText = $secondLines[$i];
|
249 |
-
} else {
|
250 |
-
$secondLineText = '';
|
251 |
-
}
|
252 |
-
|
253 |
-
echo '| ';
|
254 |
-
echo $firstLineText.str_repeat(' ', (47 - strlen($firstLineText)));
|
255 |
-
echo '| ';
|
256 |
-
echo $secondLineText.str_repeat(' ', (48 - strlen($secondLineText)));
|
257 |
-
echo '|'.PHP_EOL;
|
258 |
-
}//end for
|
259 |
-
|
260 |
-
echo str_repeat('-', 100).PHP_EOL.PHP_EOL;
|
261 |
-
|
262 |
-
}//end printCodeComparisonBlock()
|
263 |
-
|
264 |
-
|
265 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Exception.php
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* An exception thrown by PHP_CodeSniffer when it encounters an unrecoverable error.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
10 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
11 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
12 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
13 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
14 |
-
*/
|
15 |
-
|
16 |
-
/**
|
17 |
-
* An exception thrown by PHP_CodeSniffer when it encounters an unrecoverable error.
|
18 |
-
*
|
19 |
-
* @category PHP
|
20 |
-
* @package PHP_CodeSniffer
|
21 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
22 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
23 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
24 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
25 |
-
* @version Release: @package_version@
|
26 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
27 |
-
*/
|
28 |
-
class PHP_CodeSniffer_Exception extends Exception
|
29 |
-
{
|
30 |
-
|
31 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/File.php
DELETED
@@ -1,3814 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A PHP_CodeSniffer_File object represents a PHP source file and the tokens
|
4 |
-
* associated with it.
|
5 |
-
*
|
6 |
-
* PHP version 5
|
7 |
-
*
|
8 |
-
* @category PHP
|
9 |
-
* @package PHP_CodeSniffer
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* A PHP_CodeSniffer_File object represents a PHP source file and the tokens
|
19 |
-
* associated with it.
|
20 |
-
*
|
21 |
-
* It provides a means for traversing the token stack, along with
|
22 |
-
* other token related operations. If a PHP_CodeSniffer_Sniff finds and error or
|
23 |
-
* warning within a PHP_CodeSniffer_File, you can raise an error using the
|
24 |
-
* addError() or addWarning() methods.
|
25 |
-
*
|
26 |
-
* <b>Token Information</b>
|
27 |
-
*
|
28 |
-
* Each token within the stack contains information about itself:
|
29 |
-
*
|
30 |
-
* <code>
|
31 |
-
* array(
|
32 |
-
* 'code' => 301, // the token type code (see token_get_all())
|
33 |
-
* 'content' => 'if', // the token content
|
34 |
-
* 'type' => 'T_IF', // the token name
|
35 |
-
* 'line' => 56, // the line number when the token is located
|
36 |
-
* 'column' => 12, // the column in the line where this token
|
37 |
-
* // starts (starts from 1)
|
38 |
-
* 'level' => 2 // the depth a token is within the scopes open
|
39 |
-
* 'conditions' => array( // a list of scope condition token
|
40 |
-
* // positions => codes that
|
41 |
-
* 2 => 50, // opened the scopes that this token exists
|
42 |
-
* 9 => 353, // in (see conditional tokens section below)
|
43 |
-
* ),
|
44 |
-
* );
|
45 |
-
* </code>
|
46 |
-
*
|
47 |
-
* <b>Conditional Tokens</b>
|
48 |
-
*
|
49 |
-
* In addition to the standard token fields, conditions contain information to
|
50 |
-
* determine where their scope begins and ends:
|
51 |
-
*
|
52 |
-
* <code>
|
53 |
-
* array(
|
54 |
-
* 'scope_condition' => 38, // the token position of the condition
|
55 |
-
* 'scope_opener' => 41, // the token position that started the scope
|
56 |
-
* 'scope_closer' => 70, // the token position that ended the scope
|
57 |
-
* );
|
58 |
-
* </code>
|
59 |
-
*
|
60 |
-
* The condition, the scope opener and the scope closer each contain this
|
61 |
-
* information.
|
62 |
-
*
|
63 |
-
* <b>Parenthesis Tokens</b>
|
64 |
-
*
|
65 |
-
* Each parenthesis token (T_OPEN_PARENTHESIS and T_CLOSE_PARENTHESIS) has a
|
66 |
-
* reference to their opening and closing parenthesis, one being itself, the
|
67 |
-
* other being its opposite.
|
68 |
-
*
|
69 |
-
* <code>
|
70 |
-
* array(
|
71 |
-
* 'parenthesis_opener' => 34,
|
72 |
-
* 'parenthesis_closer' => 40,
|
73 |
-
* );
|
74 |
-
* </code>
|
75 |
-
*
|
76 |
-
* Some tokens can "own" a set of parenthesis. For example a T_FUNCTION token
|
77 |
-
* has parenthesis around its argument list. These tokens also have the
|
78 |
-
* parenthesis_opener and and parenthesis_closer indices. Not all parenthesis
|
79 |
-
* have owners, for example parenthesis used for arithmetic operations and
|
80 |
-
* function calls. The parenthesis tokens that have an owner have the following
|
81 |
-
* auxiliary array indices.
|
82 |
-
*
|
83 |
-
* <code>
|
84 |
-
* array(
|
85 |
-
* 'parenthesis_opener' => 34,
|
86 |
-
* 'parenthesis_closer' => 40,
|
87 |
-
* 'parenthesis_owner' => 33,
|
88 |
-
* );
|
89 |
-
* </code>
|
90 |
-
*
|
91 |
-
* Each token within a set of parenthesis also has an array index
|
92 |
-
* 'nested_parenthesis' which is an array of the
|
93 |
-
* left parenthesis => right parenthesis token positions.
|
94 |
-
*
|
95 |
-
* <code>
|
96 |
-
* 'nested_parenthesis' => array(
|
97 |
-
* 12 => 15
|
98 |
-
* 11 => 14
|
99 |
-
* );
|
100 |
-
* </code>
|
101 |
-
*
|
102 |
-
* <b>Extended Tokens</b>
|
103 |
-
*
|
104 |
-
* PHP_CodeSniffer extends and augments some of the tokens created by
|
105 |
-
* <i>token_get_all()</i>. A full list of these tokens can be seen in the
|
106 |
-
* <i>Tokens.php</i> file.
|
107 |
-
*
|
108 |
-
* @category PHP
|
109 |
-
* @package PHP_CodeSniffer
|
110 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
111 |
-
* @author Marc McIntyre <mmcintyre@squiz.net>
|
112 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
113 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
114 |
-
* @version Release: @package_version@
|
115 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
116 |
-
*/
|
117 |
-
class PHP_CodeSniffer_File
|
118 |
-
{
|
119 |
-
|
120 |
-
/**
|
121 |
-
* The absolute path to the file associated with this object.
|
122 |
-
*
|
123 |
-
* @var string
|
124 |
-
*/
|
125 |
-
private $_file = '';
|
126 |
-
|
127 |
-
/**
|
128 |
-
* The EOL character this file uses.
|
129 |
-
*
|
130 |
-
* @var string
|
131 |
-
*/
|
132 |
-
public $eolChar = '';
|
133 |
-
|
134 |
-
/**
|
135 |
-
* The PHP_CodeSniffer object controlling this run.
|
136 |
-
*
|
137 |
-
* @var PHP_CodeSniffer
|
138 |
-
*/
|
139 |
-
public $phpcs = null;
|
140 |
-
|
141 |
-
/**
|
142 |
-
* The Fixer object to control fixing errors.
|
143 |
-
*
|
144 |
-
* @var PHP_CodeSniffer_Fixer
|
145 |
-
*/
|
146 |
-
public $fixer = null;
|
147 |
-
|
148 |
-
/**
|
149 |
-
* The tokenizer being used for this file.
|
150 |
-
*
|
151 |
-
* @var object
|
152 |
-
*/
|
153 |
-
public $tokenizer = null;
|
154 |
-
|
155 |
-
/**
|
156 |
-
* The tokenizer being used for this file.
|
157 |
-
*
|
158 |
-
* @var string
|
159 |
-
*/
|
160 |
-
public $tokenizerType = 'PHP';
|
161 |
-
|
162 |
-
/**
|
163 |
-
* The number of tokens in this file.
|
164 |
-
*
|
165 |
-
* Stored here to save calling count() everywhere.
|
166 |
-
*
|
167 |
-
* @var int
|
168 |
-
*/
|
169 |
-
public $numTokens = 0;
|
170 |
-
|
171 |
-
/**
|
172 |
-
* The tokens stack map.
|
173 |
-
*
|
174 |
-
* Note that the tokens in this array differ in format to the tokens
|
175 |
-
* produced by token_get_all(). Tokens are initially produced with
|
176 |
-
* token_get_all(), then augmented so that it's easier to process them.
|
177 |
-
*
|
178 |
-
* @var array()
|
179 |
-
* @see Tokens.php
|
180 |
-
*/
|
181 |
-
private $_tokens = array();
|
182 |
-
|
183 |
-
/**
|
184 |
-
* The errors raised from PHP_CodeSniffer_Sniffs.
|
185 |
-
*
|
186 |
-
* @var array()
|
187 |
-
* @see getErrors()
|
188 |
-
*/
|
189 |
-
private $_errors = array();
|
190 |
-
|
191 |
-
/**
|
192 |
-
* The warnings raised from PHP_CodeSniffer_Sniffs.
|
193 |
-
*
|
194 |
-
* @var array()
|
195 |
-
* @see getWarnings()
|
196 |
-
*/
|
197 |
-
private $_warnings = array();
|
198 |
-
|
199 |
-
/**
|
200 |
-
* The metrics recorded from PHP_CodeSniffer_Sniffs.
|
201 |
-
*
|
202 |
-
* @var array()
|
203 |
-
* @see getMetrics()
|
204 |
-
*/
|
205 |
-
private $_metrics = array();
|
206 |
-
|
207 |
-
/**
|
208 |
-
* Record the errors and warnings raised.
|
209 |
-
*
|
210 |
-
* @var bool
|
211 |
-
*/
|
212 |
-
private $_recordErrors = true;
|
213 |
-
|
214 |
-
/**
|
215 |
-
* An array of lines that are being ignored.
|
216 |
-
*
|
217 |
-
* @var array()
|
218 |
-
*/
|
219 |
-
private static $_ignoredLines = array();
|
220 |
-
|
221 |
-
/**
|
222 |
-
* An array of sniffs that are being ignored.
|
223 |
-
*
|
224 |
-
* @var array()
|
225 |
-
*/
|
226 |
-
private $_ignoredListeners = array();
|
227 |
-
|
228 |
-
/**
|
229 |
-
* An array of message codes that are being ignored.
|
230 |
-
*
|
231 |
-
* @var array()
|
232 |
-
*/
|
233 |
-
private $_ignoredCodes = array();
|
234 |
-
|
235 |
-
/**
|
236 |
-
* The total number of errors raised.
|
237 |
-
*
|
238 |
-
* @var int
|
239 |
-
*/
|
240 |
-
private $_errorCount = 0;
|
241 |
-
|
242 |
-
/**
|
243 |
-
* The total number of warnings raised.
|
244 |
-
*
|
245 |
-
* @var int
|
246 |
-
*/
|
247 |
-
private $_warningCount = 0;
|
248 |
-
|
249 |
-
/**
|
250 |
-
* The total number of errors/warnings that can be fixed.
|
251 |
-
*
|
252 |
-
* @var int
|
253 |
-
*/
|
254 |
-
private $_fixableCount = 0;
|
255 |
-
|
256 |
-
/**
|
257 |
-
* An array of sniffs listening to this file's processing.
|
258 |
-
*
|
259 |
-
* @var array(PHP_CodeSniffer_Sniff)
|
260 |
-
*/
|
261 |
-
private $_listeners = array();
|
262 |
-
|
263 |
-
/**
|
264 |
-
* The class name of the sniff currently processing the file.
|
265 |
-
*
|
266 |
-
* @var string
|
267 |
-
*/
|
268 |
-
private $_activeListener = '';
|
269 |
-
|
270 |
-
/**
|
271 |
-
* An array of sniffs being processed and how long they took.
|
272 |
-
*
|
273 |
-
* @var array()
|
274 |
-
*/
|
275 |
-
private $_listenerTimes = array();
|
276 |
-
|
277 |
-
/**
|
278 |
-
* An array of rules from the ruleset.xml file.
|
279 |
-
*
|
280 |
-
* This value gets set by PHP_CodeSniffer when the object is created.
|
281 |
-
* It may be empty, indicating that the ruleset does not override
|
282 |
-
* any of the default sniff settings.
|
283 |
-
*
|
284 |
-
* @var array
|
285 |
-
*/
|
286 |
-
protected $ruleset = array();
|
287 |
-
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Constructs a PHP_CodeSniffer_File.
|
291 |
-
*
|
292 |
-
* @param string $file The absolute path to the file to process.
|
293 |
-
* @param array(string) $listeners The initial listeners listening to processing of this file.
|
294 |
-
* to processing of this file.
|
295 |
-
* @param array $ruleset An array of rules from the ruleset.xml file.
|
296 |
-
* ruleset.xml file.
|
297 |
-
* @param PHP_CodeSniffer $phpcs The PHP_CodeSniffer object controlling this run.
|
298 |
-
* this run.
|
299 |
-
*
|
300 |
-
* @throws PHP_CodeSniffer_Exception If the register() method does
|
301 |
-
* not return an array.
|
302 |
-
*/
|
303 |
-
public function __construct(
|
304 |
-
$file,
|
305 |
-
array $listeners,
|
306 |
-
array $ruleset,
|
307 |
-
PHP_CodeSniffer $phpcs
|
308 |
-
) {
|
309 |
-
$this->_file = trim($file);
|
310 |
-
$this->_listeners = $listeners;
|
311 |
-
$this->ruleset = $ruleset;
|
312 |
-
$this->phpcs = $phpcs;
|
313 |
-
$this->fixer = new PHP_CodeSniffer_Fixer();
|
314 |
-
|
315 |
-
if (PHP_CODESNIFFER_INTERACTIVE === false) {
|
316 |
-
$cliValues = $phpcs->cli->getCommandLineValues();
|
317 |
-
if (isset($cliValues['showSources']) === true
|
318 |
-
&& $cliValues['showSources'] !== true
|
319 |
-
) {
|
320 |
-
$recordErrors = false;
|
321 |
-
foreach ($cliValues['reports'] as $report => $output) {
|
322 |
-
$reportClass = $phpcs->reporting->factory($report);
|
323 |
-
if (property_exists($reportClass, 'recordErrors') === false
|
324 |
-
|| $reportClass->recordErrors === true
|
325 |
-
) {
|
326 |
-
$recordErrors = true;
|
327 |
-
break;
|
328 |
-
}
|
329 |
-
}
|
330 |
-
|
331 |
-
$this->_recordErrors = $recordErrors;
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
-
}//end __construct()
|
336 |
-
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Sets the name of the currently active sniff.
|
340 |
-
*
|
341 |
-
* @param string $activeListener The class name of the current sniff.
|
342 |
-
*
|
343 |
-
* @return void
|
344 |
-
*/
|
345 |
-
public function setActiveListener($activeListener)
|
346 |
-
{
|
347 |
-
$this->_activeListener = $activeListener;
|
348 |
-
|
349 |
-
}//end setActiveListener()
|
350 |
-
|
351 |
-
|
352 |
-
/**
|
353 |
-
* Adds a listener to the token stack that listens to the specific tokens.
|
354 |
-
*
|
355 |
-
* When PHP_CodeSniffer encounters on the the tokens specified in $tokens,
|
356 |
-
* it invokes the process method of the sniff.
|
357 |
-
*
|
358 |
-
* @param PHP_CodeSniffer_Sniff $listener The listener to add to the
|
359 |
-
* listener stack.
|
360 |
-
* @param array(int) $tokens The token types the listener wishes to
|
361 |
-
* listen to.
|
362 |
-
*
|
363 |
-
* @return void
|
364 |
-
*/
|
365 |
-
public function addTokenListener(PHP_CodeSniffer_Sniff $listener, array $tokens)
|
366 |
-
{
|
367 |
-
$class = get_class($listener);
|
368 |
-
foreach ($tokens as $token) {
|
369 |
-
if (isset($this->_listeners[$token]) === false) {
|
370 |
-
$this->_listeners[$token] = array();
|
371 |
-
}
|
372 |
-
|
373 |
-
if (isset($this->_listeners[$token][$class]) === false) {
|
374 |
-
$this->_listeners[$token][$class] = $listener;
|
375 |
-
}
|
376 |
-
}
|
377 |
-
|
378 |
-
}//end addTokenListener()
|
379 |
-
|
380 |
-
|
381 |
-
/**
|
382 |
-
* Removes a listener from listening from the specified tokens.
|
383 |
-
*
|
384 |
-
* @param PHP_CodeSniffer_Sniff $listener The listener to remove from the
|
385 |
-
* listener stack.
|
386 |
-
* @param array(int) $tokens The token types the listener wishes to
|
387 |
-
* stop listen to.
|
388 |
-
*
|
389 |
-
* @return void
|
390 |
-
*/
|
391 |
-
public function removeTokenListener(
|
392 |
-
PHP_CodeSniffer_Sniff $listener,
|
393 |
-
array $tokens
|
394 |
-
) {
|
395 |
-
$class = get_class($listener);
|
396 |
-
foreach ($tokens as $token) {
|
397 |
-
if (isset($this->_listeners[$token]) === false) {
|
398 |
-
continue;
|
399 |
-
}
|
400 |
-
|
401 |
-
unset($this->_listeners[$token][$class]);
|
402 |
-
}
|
403 |
-
|
404 |
-
}//end removeTokenListener()
|
405 |
-
|
406 |
-
|
407 |
-
/**
|
408 |
-
* Rebuilds the list of listeners to ensure their state is cleared.
|
409 |
-
*
|
410 |
-
* @return void
|
411 |
-
*/
|
412 |
-
public function refreshTokenListeners()
|
413 |
-
{
|
414 |
-
$this->phpcs->populateTokenListeners();
|
415 |
-
$this->_listeners = $this->phpcs->getTokenSniffs();
|
416 |
-
|
417 |
-
}//end refreshTokenListeners()
|
418 |
-
|
419 |
-
|
420 |
-
/**
|
421 |
-
* Returns the token stack for this file.
|
422 |
-
*
|
423 |
-
* @return array
|
424 |
-
*/
|
425 |
-
public function getTokens()
|
426 |
-
{
|
427 |
-
return $this->_tokens;
|
428 |
-
|
429 |
-
}//end getTokens()
|
430 |
-
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Starts the stack traversal and tells listeners when tokens are found.
|
434 |
-
*
|
435 |
-
* @param string $contents The contents to parse. If NULL, the content
|
436 |
-
* is taken from the file system.
|
437 |
-
*
|
438 |
-
* @return void
|
439 |
-
*/
|
440 |
-
public function start($contents=null)
|
441 |
-
{
|
442 |
-
$this->_errors = array();
|
443 |
-
$this->_warnings = array();
|
444 |
-
$this->_errorCount = 0;
|
445 |
-
$this->_warningCount = 0;
|
446 |
-
$this->_fixableCount = 0;
|
447 |
-
|
448 |
-
// Reset the ignored lines because lines numbers may have changed
|
449 |
-
// if we are fixing this file.
|
450 |
-
self::$_ignoredLines = array();
|
451 |
-
|
452 |
-
try {
|
453 |
-
$this->eolChar = self::detectLineEndings($this->_file, $contents);
|
454 |
-
} catch (PHP_CodeSniffer_Exception $e) {
|
455 |
-
$this->addWarning($e->getMessage(), null, 'Internal.DetectLineEndings');
|
456 |
-
return;
|
457 |
-
}
|
458 |
-
|
459 |
-
// If this is standard input, see if a filename was passed in as well.
|
460 |
-
// This is done by including: phpcs_input_file: [file path]
|
461 |
-
// as the first line of content.
|
462 |
-
if ($this->_file === 'STDIN') {
|
463 |
-
$cliValues = $this->phpcs->cli->getCommandLineValues();
|
464 |
-
if ($cliValues['stdinPath'] !== '') {
|
465 |
-
$this->_file = $cliValues['stdinPath'];
|
466 |
-
} else if ($contents !== null && substr($contents, 0, 17) === 'phpcs_input_file:') {
|
467 |
-
$eolPos = strpos($contents, $this->eolChar);
|
468 |
-
$filename = trim(substr($contents, 17, ($eolPos - 17)));
|
469 |
-
$contents = substr($contents, ($eolPos + strlen($this->eolChar)));
|
470 |
-
$this->_file = $filename;
|
471 |
-
}
|
472 |
-
}
|
473 |
-
|
474 |
-
$this->_parse($contents);
|
475 |
-
$this->fixer->startFile($this);
|
476 |
-
|
477 |
-
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
478 |
-
echo "\t*** START TOKEN PROCESSING ***".PHP_EOL;
|
479 |
-
}
|
480 |
-
|
481 |
-
$foundCode = false;
|
482 |
-
$listeners = $this->phpcs->getSniffs();
|
483 |
-
$listenerIgnoreTo = array();
|
484 |
-
$inTests = defined('PHP_CODESNIFFER_IN_TESTS');
|
485 |
-
|
486 |
-
// Foreach of the listeners that have registered to listen for this
|
487 |
-
// token, get them to process it.
|
488 |
-
foreach ($this->_tokens as $stackPtr => $token) {
|
489 |
-
// Check for ignored lines.
|
490 |
-
if ($token['code'] === T_COMMENT
|
491 |
-
|| $token['code'] === T_DOC_COMMENT_TAG
|
492 |
-
|| ($inTests === true && $token['code'] === T_INLINE_HTML)
|
493 |
-
) {
|
494 |
-
if (strpos($token['content'], '@codingStandards') !== false) {
|
495 |
-
if (strpos($token['content'], '@codingStandardsIgnoreFile') !== false) {
|
496 |
-
// Ignoring the whole file, just a little late.
|
497 |
-
$this->_errors = array();
|
498 |
-
$this->_warnings = array();
|
499 |
-
$this->_errorCount = 0;
|
500 |
-
$this->_warningCount = 0;
|
501 |
-
$this->_fixableCount = 0;
|
502 |
-
return;
|
503 |
-
} else if (strpos($token['content'], '@codingStandardsChangeSetting') !== false) {
|
504 |
-
$start = strpos($token['content'], '@codingStandardsChangeSetting');
|
505 |
-
$comment = substr($token['content'], ($start + 30));
|
506 |
-
$parts = explode(' ', $comment);
|
507 |
-
if (count($parts) >= 3
|
508 |
-
&& isset($this->phpcs->sniffCodes[$parts[0]]) === true
|
509 |
-
) {
|
510 |
-
$listenerCode = array_shift($parts);
|
511 |
-
$propertyCode = array_shift($parts);
|
512 |
-
$propertyValue = rtrim(implode(' ', $parts), " */\r\n");
|
513 |
-
$listenerClass = $this->phpcs->sniffCodes[$listenerCode];
|
514 |
-
$this->phpcs->setSniffProperty($listenerClass, $propertyCode, $propertyValue);
|
515 |
-
}
|
516 |
-
}//end if
|
517 |
-
}//end if
|
518 |
-
}//end if
|
519 |
-
|
520 |
-
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
521 |
-
$type = $token['type'];
|
522 |
-
$content = PHP_CodeSniffer::prepareForOutput($token['content']);
|
523 |
-
echo "\t\tProcess token $stackPtr: $type => $content".PHP_EOL;
|
524 |
-
}
|
525 |
-
|
526 |
-
if ($token['code'] !== T_INLINE_HTML) {
|
527 |
-
$foundCode = true;
|
528 |
-
}
|
529 |
-
|
530 |
-
if (isset($this->_listeners[$token['code']]) === false) {
|
531 |
-
continue;
|
532 |
-
}
|
533 |
-
|
534 |
-
foreach ($this->_listeners[$token['code']] as $listenerData) {
|
535 |
-
if (isset($this->_ignoredListeners[$listenerData['class']]) === true
|
536 |
-
|| (isset($listenerIgnoreTo[$listenerData['class']]) === true
|
537 |
-
&& $listenerIgnoreTo[$listenerData['class']] > $stackPtr)
|
538 |
-
) {
|
539 |
-
// This sniff is ignoring past this token, or the whole file.
|
540 |
-
continue;
|
541 |
-
}
|
542 |
-
|
543 |
-
// Make sure this sniff supports the tokenizer
|
544 |
-
// we are currently using.
|
545 |
-
$class = $listenerData['class'];
|
546 |
-
|
547 |
-
if (isset($listenerData['tokenizers'][$this->tokenizerType]) === false) {
|
548 |
-
continue;
|
549 |
-
}
|
550 |
-
|
551 |
-
// If the file path matches one of our ignore patterns, skip it.
|
552 |
-
// While there is support for a type of each pattern
|
553 |
-
// (absolute or relative) we don't actually support it here.
|
554 |
-
foreach ($listenerData['ignore'] as $pattern) {
|
555 |
-
// We assume a / directory separator, as do the exclude rules
|
556 |
-
// most developers write, so we need a special case for any system
|
557 |
-
// that is different.
|
558 |
-
if (DIRECTORY_SEPARATOR === '\\') {
|
559 |
-
$pattern = str_replace('/', '\\\\', $pattern);
|
560 |
-
}
|
561 |
-
|
562 |
-
$pattern = '`'.$pattern.'`i';
|
563 |
-
if (preg_match($pattern, $this->_file) === 1) {
|
564 |
-
$this->_ignoredListeners[$class] = true;
|
565 |
-
continue(2);
|
566 |
-
}
|
567 |
-
}
|
568 |
-
|
569 |
-
$this->_activeListener = $class;
|
570 |
-
|
571 |
-
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
572 |
-
$startTime = microtime(true);
|
573 |
-
echo "\t\t\tProcessing ".$this->_activeListener.'... ';
|
574 |
-
}
|
575 |
-
|
576 |
-
$ignoreTo = $listeners[$class]->process($this, $stackPtr);
|
577 |
-
if ($ignoreTo !== null) {
|
578 |
-
$listenerIgnoreTo[$this->_activeListener] = $ignoreTo;
|
579 |
-
}
|
580 |
-
|
581 |
-
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
582 |
-
$timeTaken = (microtime(true) - $startTime);
|
583 |
-
if (isset($this->_listenerTimes[$this->_activeListener]) === false) {
|
584 |
-
$this->_listenerTimes[$this->_activeListener] = 0;
|
585 |
-
}
|
586 |
-
|
587 |
-
$this->_listenerTimes[$this->_activeListener] += $timeTaken;
|
588 |
-
|
589 |
-
$timeTaken = round(($timeTaken), 4);
|
590 |
-
echo "DONE in $timeTaken seconds".PHP_EOL;
|
591 |
-
}
|
592 |
-
|
593 |
-
$this->_activeListener = '';
|
594 |
-
}//end foreach
|
595 |
-
}//end foreach
|
596 |
-
|
597 |
-
if ($this->_recordErrors === false) {
|
598 |
-
$this->_errors = array();
|
599 |
-
$this->_warnings = array();
|
600 |
-
}
|
601 |
-
|
602 |
-
// If short open tags are off but the file being checked uses
|
603 |
-
// short open tags, the whole content will be inline HTML
|
604 |
-
// and nothing will be checked. So try and handle this case.
|
605 |
-
// We don't show this error for STDIN because we can't be sure the content
|
606 |
-
// actually came directly from the user. It could be something like
|
607 |
-
// refs from a Git pre-push hook.
|
608 |
-
if ($foundCode === false && $this->tokenizerType === 'PHP' && $this->_file !== 'STDIN') {
|
609 |
-
$shortTags = (bool) ini_get('short_open_tag');
|
610 |
-
if ($shortTags === false) {
|
611 |
-
$error = 'No PHP code was found in this file and short open tags are not allowed by this install of PHP. This file may be using short open tags but PHP does not allow them.';
|
612 |
-
$this->addWarning($error, null, 'Internal.NoCodeFound');
|
613 |
-
}
|
614 |
-
}
|
615 |
-
|
616 |
-
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
617 |
-
echo "\t*** END TOKEN PROCESSING ***".PHP_EOL;
|
618 |
-
echo "\t*** START SNIFF PROCESSING REPORT ***".PHP_EOL;
|
619 |
-
|
620 |
-
asort($this->_listenerTimes, SORT_NUMERIC);
|
621 |
-
$this->_listenerTimes = array_reverse($this->_listenerTimes, true);
|
622 |
-
foreach ($this->_listenerTimes as $listener => $timeTaken) {
|
623 |
-
echo "\t$listener: ".round(($timeTaken), 4).' secs'.PHP_EOL;
|
624 |
-
}
|
625 |
-
|
626 |
-
echo "\t*** END SNIFF PROCESSING REPORT ***".PHP_EOL;
|
627 |
-
}
|
628 |
-
|
629 |
-
}//end start()
|
630 |
-
|
631 |
-
|
632 |
-
/**
|
633 |
-
* Remove vars stored in this file that are no longer required.
|
634 |
-
*
|
635 |
-
* @return void
|
636 |
-
*/
|
637 |
-
public function cleanUp()
|
638 |
-
{
|
639 |
-
$this->_tokens = null;
|
640 |
-
$this->_listeners = null;
|
641 |
-
|
642 |
-
}//end cleanUp()
|
643 |
-
|
644 |
-
|
645 |
-
/**
|
646 |
-
* Tokenizes the file and prepares it for the test run.
|
647 |
-
*
|
648 |
-
* @param string $contents The contents to parse. If NULL, the content
|
649 |
-
* is taken from the file system.
|
650 |
-
*
|
651 |
-
* @return void
|
652 |
-
*/
|
653 |
-
private function _parse($contents=null)
|
654 |
-
{
|
655 |
-
if ($contents === null && empty($this->_tokens) === false) {
|
656 |
-
// File has already been parsed.
|
657 |
-
return;
|
658 |
-
}
|
659 |
-
|
660 |
-
$stdin = false;
|
661 |
-
$cliValues = $this->phpcs->cli->getCommandLineValues();
|
662 |
-
if (empty($cliValues['files']) === true) {
|
663 |
-
$stdin = true;
|
664 |
-
}
|
665 |
-
|
666 |
-
// Determine the tokenizer from the file extension.
|
667 |
-
$fileParts = explode('.', $this->_file);
|
668 |
-
$extension = array_pop($fileParts);
|
669 |
-
if (isset($this->phpcs->allowedFileExtensions[$extension]) === true) {
|
670 |
-
$tokenizerClass = 'PHP_CodeSniffer_Tokenizers_'.$this->phpcs->allowedFileExtensions[$extension];
|
671 |
-
$this->tokenizerType = $this->phpcs->allowedFileExtensions[$extension];
|
672 |
-
} else if (isset($this->phpcs->defaultFileExtensions[$extension]) === true) {
|
673 |
-
$tokenizerClass = 'PHP_CodeSniffer_Tokenizers_'.$this->phpcs->defaultFileExtensions[$extension];
|
674 |
-
$this->tokenizerType = $this->phpcs->defaultFileExtensions[$extension];
|
675 |
-
} else {
|
676 |
-
// Revert to default.
|
677 |
-
$tokenizerClass = 'PHP_CodeSniffer_Tokenizers_'.$this->tokenizerType;
|
678 |
-
}
|
679 |
-
|
680 |
-
$tokenizer = new $tokenizerClass();
|
681 |
-
$this->tokenizer = $tokenizer;
|
682 |
-
|
683 |
-
if ($contents === null) {
|
684 |
-
$contents = file_get_contents($this->_file);
|
685 |
-
}
|
686 |
-
|
687 |
-
try {
|
688 |
-
$tabWidth = null;
|
689 |
-
$encoding = null;
|
690 |
-
if (defined('PHP_CODESNIFFER_IN_TESTS') === true) {
|
691 |
-
$cliValues = $this->phpcs->cli->getCommandLineValues();
|
692 |
-
if (isset($cliValues['tabWidth']) === true) {
|
693 |
-
$tabWidth = $cliValues['tabWidth'];
|
694 |
-
}
|
695 |
-
|
696 |
-
if (isset($cliValues['encoding']) === true) {
|
697 |
-
$encoding = $cliValues['encoding'];
|
698 |
-
}
|
699 |
-
}
|
700 |
-
|
701 |
-
$this->_tokens = self::tokenizeString($contents, $tokenizer, $this->eolChar, $tabWidth, $encoding);
|
702 |
-
} catch (PHP_CodeSniffer_Exception $e) {
|
703 |
-
$this->addWarning($e->getMessage(), null, 'Internal.Tokenizer.Exception');
|
704 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0 || (PHP_CODESNIFFER_CBF === true && $stdin === false)) {
|
705 |
-
echo "[$this->tokenizerType => tokenizer error]... ";
|
706 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
707 |
-
echo PHP_EOL;
|
708 |
-
}
|
709 |
-
}
|
710 |
-
|
711 |
-
return;
|
712 |
-
}//end try
|
713 |
-
|
714 |
-
$this->numTokens = count($this->_tokens);
|
715 |
-
|
716 |
-
// Check for mixed line endings as these can cause tokenizer errors and we
|
717 |
-
// should let the user know that the results they get may be incorrect.
|
718 |
-
// This is done by removing all backslashes, removing the newline char we
|
719 |
-
// detected, then converting newlines chars into text. If any backslashes
|
720 |
-
// are left at the end, we have additional newline chars in use.
|
721 |
-
$contents = str_replace('\\', '', $contents);
|
722 |
-
$contents = str_replace($this->eolChar, '', $contents);
|
723 |
-
$contents = str_replace("\n", '\n', $contents);
|
724 |
-
$contents = str_replace("\r", '\r', $contents);
|
725 |
-
if (strpos($contents, '\\') !== false) {
|
726 |
-
$error = 'File has mixed line endings; this may cause incorrect results';
|
727 |
-
$this->addWarning($error, 0, 'Internal.LineEndings.Mixed');
|
728 |
-
}
|
729 |
-
|
730 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0 || (PHP_CODESNIFFER_CBF === true && $stdin === false)) {
|
731 |
-
if ($this->numTokens === 0) {
|
732 |
-
$numLines = 0;
|
733 |
-
} else {
|
734 |
-
$numLines = $this->_tokens[($this->numTokens - 1)]['line'];
|
735 |
-
}
|
736 |
-
|
737 |
-
echo "[$this->tokenizerType => $this->numTokens tokens in $numLines lines]... ";
|
738 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
739 |
-
echo PHP_EOL;
|
740 |
-
}
|
741 |
-
}
|
742 |
-
|
743 |
-
}//end _parse()
|
744 |
-
|
745 |
-
|
746 |
-
/**
|
747 |
-
* Opens a file and detects the EOL character being used.
|
748 |
-
*
|
749 |
-
* @param string $file The full path to the file.
|
750 |
-
* @param string $contents The contents to parse. If NULL, the content
|
751 |
-
* is taken from the file system.
|
752 |
-
*
|
753 |
-
* @return string
|
754 |
-
* @throws PHP_CodeSniffer_Exception If $file could not be opened.
|
755 |
-
*/
|
756 |
-
public static function detectLineEndings($file, $contents=null)
|
757 |
-
{
|
758 |
-
if ($contents === null) {
|
759 |
-
// Determine the newline character being used in this file.
|
760 |
-
// Will be either \r, \r\n or \n.
|
761 |
-
if (is_readable($file) === false) {
|
762 |
-
$error = 'Error opening file; file no longer exists or you do not have access to read the file';
|
763 |
-
throw new PHP_CodeSniffer_Exception($error);
|
764 |
-
} else {
|
765 |
-
$handle = fopen($file, 'r');
|
766 |
-
if ($handle === false) {
|
767 |
-
$error = 'Error opening file; could not auto-detect line endings';
|
768 |
-
throw new PHP_CodeSniffer_Exception($error);
|
769 |
-
}
|
770 |
-
}
|
771 |
-
|
772 |
-
$firstLine = fgets($handle);
|
773 |
-
fclose($handle);
|
774 |
-
|
775 |
-
$eolChar = substr($firstLine, -1);
|
776 |
-
if ($eolChar === "\n") {
|
777 |
-
$secondLastChar = substr($firstLine, -2, 1);
|
778 |
-
if ($secondLastChar === "\r") {
|
779 |
-
$eolChar = "\r\n";
|
780 |
-
}
|
781 |
-
} else if ($eolChar !== "\r") {
|
782 |
-
// Must not be an EOL char at the end of the line.
|
783 |
-
// Probably a one-line file, so assume \n as it really
|
784 |
-
// doesn't matter considering there are no newlines.
|
785 |
-
$eolChar = "\n";
|
786 |
-
}
|
787 |
-
} else {
|
788 |
-
if (preg_match("/\r\n?|\n/", $contents, $matches) !== 1) {
|
789 |
-
// Assuming there are no newlines.
|
790 |
-
$eolChar = "\n";
|
791 |
-
} else {
|
792 |
-
$eolChar = $matches[0];
|
793 |
-
}
|
794 |
-
}//end if
|
795 |
-
|
796 |
-
return $eolChar;
|
797 |
-
|
798 |
-
}//end detectLineEndings()
|
799 |
-
|
800 |
-
|
801 |
-
/**
|
802 |
-
* Records an error against a specific token in the file.
|
803 |
-
*
|
804 |
-
* @param string $error The error message.
|
805 |
-
* @param int $stackPtr The stack position where the error occurred.
|
806 |
-
* @param string $code A violation code unique to the sniff message.
|
807 |
-
* @param array $data Replacements for the error message.
|
808 |
-
* @param int $severity The severity level for this error. A value of 0
|
809 |
-
* will be converted into the default severity level.
|
810 |
-
* @param boolean $fixable Can the error be fixed by the sniff?
|
811 |
-
*
|
812 |
-
* @return boolean
|
813 |
-
*/
|
814 |
-
public function addError(
|
815 |
-
$error,
|
816 |
-
$stackPtr,
|
817 |
-
$code='',
|
818 |
-
$data=array(),
|
819 |
-
$severity=0,
|
820 |
-
$fixable=false
|
821 |
-
) {
|
822 |
-
if ($stackPtr === null) {
|
823 |
-
$line = 1;
|
824 |
-
$column = 1;
|
825 |
-
} else {
|
826 |
-
$line = $this->_tokens[$stackPtr]['line'];
|
827 |
-
$column = $this->_tokens[$stackPtr]['column'];
|
828 |
-
}
|
829 |
-
|
830 |
-
return $this->_addError($error, $line, $column, $code, $data, $severity, $fixable);
|
831 |
-
|
832 |
-
}//end addError()
|
833 |
-
|
834 |
-
|
835 |
-
/**
|
836 |
-
* Records a warning against a specific token in the file.
|
837 |
-
*
|
838 |
-
* @param string $warning The error message.
|
839 |
-
* @param int $stackPtr The stack position where the error occurred.
|
840 |
-
* @param string $code A violation code unique to the sniff message.
|
841 |
-
* @param array $data Replacements for the warning message.
|
842 |
-
* @param int $severity The severity level for this warning. A value of 0
|
843 |
-
* will be converted into the default severity level.
|
844 |
-
* @param boolean $fixable Can the warning be fixed by the sniff?
|
845 |
-
*
|
846 |
-
* @return boolean
|
847 |
-
*/
|
848 |
-
public function addWarning(
|
849 |
-
$warning,
|
850 |
-
$stackPtr,
|
851 |
-
$code='',
|
852 |
-
$data=array(),
|
853 |
-
$severity=0,
|
854 |
-
$fixable=false
|
855 |
-
) {
|
856 |
-
if ($stackPtr === null) {
|
857 |
-
$line = 1;
|
858 |
-
$column = 1;
|
859 |
-
} else {
|
860 |
-
$line = $this->_tokens[$stackPtr]['line'];
|
861 |
-
$column = $this->_tokens[$stackPtr]['column'];
|
862 |
-
}
|
863 |
-
|
864 |
-
return $this->_addWarning($warning, $line, $column, $code, $data, $severity, $fixable);
|
865 |
-
|
866 |
-
}//end addWarning()
|
867 |
-
|
868 |
-
|
869 |
-
/**
|
870 |
-
* Records an error against a specific line in the file.
|
871 |
-
*
|
872 |
-
* @param string $error The error message.
|
873 |
-
* @param int $line The line on which the error occurred.
|
874 |
-
* @param string $code A violation code unique to the sniff message.
|
875 |
-
* @param array $data Replacements for the error message.
|
876 |
-
* @param int $severity The severity level for this error. A value of 0
|
877 |
-
* will be converted into the default severity level.
|
878 |
-
*
|
879 |
-
* @return boolean
|
880 |
-
*/
|
881 |
-
public function addErrorOnLine(
|
882 |
-
$error,
|
883 |
-
$line,
|
884 |
-
$code='',
|
885 |
-
$data=array(),
|
886 |
-
$severity=0
|
887 |
-
) {
|
888 |
-
return $this->_addError($error, $line, 1, $code, $data, $severity, false);
|
889 |
-
|
890 |
-
}//end addErrorOnLine()
|
891 |
-
|
892 |
-
|
893 |
-
/**
|
894 |
-
* Records a warning against a specific token in the file.
|
895 |
-
*
|
896 |
-
* @param string $warning The error message.
|
897 |
-
* @param int $line The line on which the warning occurred.
|
898 |
-
* @param string $code A violation code unique to the sniff message.
|
899 |
-
* @param array $data Replacements for the warning message.
|
900 |
-
* @param int $severity The severity level for this warning. A value of 0
|
901 |
-
* will be converted into the default severity level.
|
902 |
-
*
|
903 |
-
* @return boolean
|
904 |
-
*/
|
905 |
-
public function addWarningOnLine(
|
906 |
-
$warning,
|
907 |
-
$line,
|
908 |
-
$code='',
|
909 |
-
$data=array(),
|
910 |
-
$severity=0
|
911 |
-
) {
|
912 |
-
return $this->_addWarning($warning, $line, 1, $code, $data, $severity, false);
|
913 |
-
|
914 |
-
}//end addWarningOnLine()
|
915 |
-
|
916 |
-
|
917 |
-
/**
|
918 |
-
* Records a fixable error against a specific token in the file.
|
919 |
-
*
|
920 |
-
* Returns true if the error was recorded and should be fixed.
|
921 |
-
*
|
922 |
-
* @param string $error The error message.
|
923 |
-
* @param int $stackPtr The stack position where the error occurred.
|
924 |
-
* @param string $code A violation code unique to the sniff message.
|
925 |
-
* @param array $data Replacements for the error message.
|
926 |
-
* @param int $severity The severity level for this error. A value of 0
|
927 |
-
* will be converted into the default severity level.
|
928 |
-
*
|
929 |
-
* @return boolean
|
930 |
-
*/
|
931 |
-
public function addFixableError(
|
932 |
-
$error,
|
933 |
-
$stackPtr,
|
934 |
-
$code='',
|
935 |
-
$data=array(),
|
936 |
-
$severity=0
|
937 |
-
) {
|
938 |
-
$recorded = $this->addError($error, $stackPtr, $code, $data, $severity, true);
|
939 |
-
if ($recorded === true && $this->fixer->enabled === true) {
|
940 |
-
return true;
|
941 |
-
}
|
942 |
-
|
943 |
-
return false;
|
944 |
-
|
945 |
-
}//end addFixableError()
|
946 |
-
|
947 |
-
|
948 |
-
/**
|
949 |
-
* Records a fixable warning against a specific token in the file.
|
950 |
-
*
|
951 |
-
* Returns true if the warning was recorded and should be fixed.
|
952 |
-
*
|
953 |
-
* @param string $warning The error message.
|
954 |
-
* @param int $stackPtr The stack position where the error occurred.
|
955 |
-
* @param string $code A violation code unique to the sniff message.
|
956 |
-
* @param array $data Replacements for the warning message.
|
957 |
-
* @param int $severity The severity level for this warning. A value of 0
|
958 |
-
* will be converted into the default severity level.
|
959 |
-
*
|
960 |
-
* @return boolean
|
961 |
-
*/
|
962 |
-
public function addFixableWarning(
|
963 |
-
$warning,
|
964 |
-
$stackPtr,
|
965 |
-
$code='',
|
966 |
-
$data=array(),
|
967 |
-
$severity=0
|
968 |
-
) {
|
969 |
-
$recorded = $this->addWarning($warning, $stackPtr, $code, $data, $severity, true);
|
970 |
-
if ($recorded === true && $this->fixer->enabled === true) {
|
971 |
-
return true;
|
972 |
-
}
|
973 |
-
|
974 |
-
return false;
|
975 |
-
|
976 |
-
}//end addFixableWarning()
|
977 |
-
|
978 |
-
|
979 |
-
/**
|
980 |
-
* Adds an error to the error stack.
|
981 |
-
*
|
982 |
-
* @param string $error The error message.
|
983 |
-
* @param int $line The line on which the error occurred.
|
984 |
-
* @param int $column The column at which the error occurred.
|
985 |
-
* @param string $code A violation code unique to the sniff message.
|
986 |
-
* @param array $data Replacements for the error message.
|
987 |
-
* @param int $severity The severity level for this error. A value of 0
|
988 |
-
* will be converted into the default severity level.
|
989 |
-
* @param boolean $fixable Can the error be fixed by the sniff?
|
990 |
-
*
|
991 |
-
* @return boolean
|
992 |
-
*/
|
993 |
-
private function _addError($error, $line, $column, $code, $data, $severity, $fixable)
|
994 |
-
{
|
995 |
-
if (isset(self::$_ignoredLines[$line]) === true) {
|
996 |
-
return false;
|
997 |
-
}
|
998 |
-
|
999 |
-
// Work out which sniff generated the error.
|
1000 |
-
if (substr($code, 0, 9) === 'Internal.') {
|
1001 |
-
// Any internal message.
|
1002 |
-
$sniffCode = $code;
|
1003 |
-
} else {
|
1004 |
-
$parts = explode('_', str_replace('\\', '_', $this->_activeListener));
|
1005 |
-
if (isset($parts[3]) === true) {
|
1006 |
-
$sniff = $parts[0].'.'.$parts[2].'.'.$parts[3];
|
1007 |
-
|
1008 |
-
// Remove "Sniff" from the end.
|
1009 |
-
$sniff = substr($sniff, 0, -5);
|
1010 |
-
} else {
|
1011 |
-
$sniff = 'unknownSniff';
|
1012 |
-
}
|
1013 |
-
|
1014 |
-
$sniffCode = $sniff;
|
1015 |
-
if ($code !== '') {
|
1016 |
-
$sniffCode .= '.'.$code;
|
1017 |
-
}
|
1018 |
-
}//end if
|
1019 |
-
|
1020 |
-
// If we know this sniff code is being ignored for this file, return early.
|
1021 |
-
if (isset($this->_ignoredCodes[$sniffCode]) === true) {
|
1022 |
-
return false;
|
1023 |
-
}
|
1024 |
-
|
1025 |
-
// Make sure this message type has not been set to "warning".
|
1026 |
-
if (isset($this->ruleset[$sniffCode]['type']) === true
|
1027 |
-
&& $this->ruleset[$sniffCode]['type'] === 'warning'
|
1028 |
-
) {
|
1029 |
-
// Pass this off to the warning handler.
|
1030 |
-
return $this->_addWarning($error, $line, $column, $code, $data, $severity, $fixable);
|
1031 |
-
} else if ($this->phpcs->cli->errorSeverity === 0) {
|
1032 |
-
// Don't bother doing any processing as errors are just going to
|
1033 |
-
// be hidden in the reports anyway.
|
1034 |
-
return false;
|
1035 |
-
}
|
1036 |
-
|
1037 |
-
// Make sure we are interested in this severity level.
|
1038 |
-
if (isset($this->ruleset[$sniffCode]['severity']) === true) {
|
1039 |
-
$severity = $this->ruleset[$sniffCode]['severity'];
|
1040 |
-
} else if ($severity === 0) {
|
1041 |
-
$severity = PHPCS_DEFAULT_ERROR_SEV;
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
if ($this->phpcs->cli->errorSeverity > $severity) {
|
1045 |
-
return false;
|
1046 |
-
}
|
1047 |
-
|
1048 |
-
// Make sure we are not ignoring this file.
|
1049 |
-
$patterns = $this->phpcs->getIgnorePatterns($sniffCode);
|
1050 |
-
foreach ($patterns as $pattern => $type) {
|
1051 |
-
// While there is support for a type of each pattern
|
1052 |
-
// (absolute or relative) we don't actually support it here.
|
1053 |
-
$replacements = array(
|
1054 |
-
'\\,' => ',',
|
1055 |
-
'*' => '.*',
|
1056 |
-
);
|
1057 |
-
|
1058 |
-
// We assume a / directory separator, as do the exclude rules
|
1059 |
-
// most developers write, so we need a special case for any system
|
1060 |
-
// that is different.
|
1061 |
-
if (DIRECTORY_SEPARATOR === '\\') {
|
1062 |
-
$replacements['/'] = '\\\\';
|
1063 |
-
}
|
1064 |
-
|
1065 |
-
$pattern = '`'.strtr($pattern, $replacements).'`i';
|
1066 |
-
if (preg_match($pattern, $this->_file) === 1) {
|
1067 |
-
$this->_ignoredCodes[$sniffCode] = true;
|
1068 |
-
return false;
|
1069 |
-
}
|
1070 |
-
}//end foreach
|
1071 |
-
|
1072 |
-
$this->_errorCount++;
|
1073 |
-
if ($fixable === true) {
|
1074 |
-
$this->_fixableCount++;
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
if ($this->_recordErrors === false) {
|
1078 |
-
if (isset($this->_errors[$line]) === false) {
|
1079 |
-
$this->_errors[$line] = 0;
|
1080 |
-
}
|
1081 |
-
|
1082 |
-
$this->_errors[$line]++;
|
1083 |
-
return true;
|
1084 |
-
}
|
1085 |
-
|
1086 |
-
// Work out the error message.
|
1087 |
-
if (isset($this->ruleset[$sniffCode]['message']) === true) {
|
1088 |
-
$error = $this->ruleset[$sniffCode]['message'];
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
if (empty($data) === true) {
|
1092 |
-
$message = $error;
|
1093 |
-
} else {
|
1094 |
-
$message = vsprintf($error, $data);
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
if (isset($this->_errors[$line]) === false) {
|
1098 |
-
$this->_errors[$line] = array();
|
1099 |
-
}
|
1100 |
-
|
1101 |
-
if (isset($this->_errors[$line][$column]) === false) {
|
1102 |
-
$this->_errors[$line][$column] = array();
|
1103 |
-
}
|
1104 |
-
|
1105 |
-
$this->_errors[$line][$column][] = array(
|
1106 |
-
'message' => $message,
|
1107 |
-
'source' => $sniffCode,
|
1108 |
-
'severity' => $severity,
|
1109 |
-
'fixable' => $fixable,
|
1110 |
-
);
|
1111 |
-
|
1112 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1
|
1113 |
-
&& $this->fixer->enabled === true
|
1114 |
-
&& $fixable === true
|
1115 |
-
) {
|
1116 |
-
@ob_end_clean();
|
1117 |
-
echo "\tE: [Line $line] $message ($sniffCode)".PHP_EOL;
|
1118 |
-
ob_start();
|
1119 |
-
}
|
1120 |
-
|
1121 |
-
return true;
|
1122 |
-
|
1123 |
-
}//end _addError()
|
1124 |
-
|
1125 |
-
|
1126 |
-
/**
|
1127 |
-
* Adds an warning to the warning stack.
|
1128 |
-
*
|
1129 |
-
* @param string $warning The error message.
|
1130 |
-
* @param int $line The line on which the warning occurred.
|
1131 |
-
* @param int $column The column at which the warning occurred.
|
1132 |
-
* @param string $code A violation code unique to the sniff message.
|
1133 |
-
* @param array $data Replacements for the warning message.
|
1134 |
-
* @param int $severity The severity level for this warning. A value of 0
|
1135 |
-
* will be converted into the default severity level.
|
1136 |
-
* @param boolean $fixable Can the warning be fixed by the sniff?
|
1137 |
-
*
|
1138 |
-
* @return boolean
|
1139 |
-
*/
|
1140 |
-
private function _addWarning($warning, $line, $column, $code, $data, $severity, $fixable)
|
1141 |
-
{
|
1142 |
-
if (isset(self::$_ignoredLines[$line]) === true) {
|
1143 |
-
return false;
|
1144 |
-
}
|
1145 |
-
|
1146 |
-
// Work out which sniff generated the warning.
|
1147 |
-
if (substr($code, 0, 9) === 'Internal.') {
|
1148 |
-
// Any internal message.
|
1149 |
-
$sniffCode = $code;
|
1150 |
-
} else {
|
1151 |
-
$parts = explode('_', str_replace('\\', '_', $this->_activeListener));
|
1152 |
-
if (isset($parts[3]) === true) {
|
1153 |
-
$sniff = $parts[0].'.'.$parts[2].'.'.$parts[3];
|
1154 |
-
|
1155 |
-
// Remove "Sniff" from the end.
|
1156 |
-
$sniff = substr($sniff, 0, -5);
|
1157 |
-
} else {
|
1158 |
-
$sniff = 'unknownSniff';
|
1159 |
-
}
|
1160 |
-
|
1161 |
-
$sniffCode = $sniff;
|
1162 |
-
if ($code !== '') {
|
1163 |
-
$sniffCode .= '.'.$code;
|
1164 |
-
}
|
1165 |
-
}//end if
|
1166 |
-
|
1167 |
-
// If we know this sniff code is being ignored for this file, return early.
|
1168 |
-
if (isset($this->_ignoredCodes[$sniffCode]) === true) {
|
1169 |
-
return false;
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
// Make sure this message type has not been set to "error".
|
1173 |
-
if (isset($this->ruleset[$sniffCode]['type']) === true
|
1174 |
-
&& $this->ruleset[$sniffCode]['type'] === 'error'
|
1175 |
-
) {
|
1176 |
-
// Pass this off to the error handler.
|
1177 |
-
return $this->_addError($warning, $line, $column, $code, $data, $severity, $fixable);
|
1178 |
-
} else if ($this->phpcs->cli->warningSeverity === 0) {
|
1179 |
-
// Don't bother doing any processing as warnings are just going to
|
1180 |
-
// be hidden in the reports anyway.
|
1181 |
-
return false;
|
1182 |
-
}
|
1183 |
-
|
1184 |
-
// Make sure we are interested in this severity level.
|
1185 |
-
if (isset($this->ruleset[$sniffCode]['severity']) === true) {
|
1186 |
-
$severity = $this->ruleset[$sniffCode]['severity'];
|
1187 |
-
} else if ($severity === 0) {
|
1188 |
-
$severity = PHPCS_DEFAULT_WARN_SEV;
|
1189 |
-
}
|
1190 |
-
|
1191 |
-
if ($this->phpcs->cli->warningSeverity > $severity) {
|
1192 |
-
return false;
|
1193 |
-
}
|
1194 |
-
|
1195 |
-
// Make sure we are not ignoring this file.
|
1196 |
-
$patterns = $this->phpcs->getIgnorePatterns($sniffCode);
|
1197 |
-
foreach ($patterns as $pattern => $type) {
|
1198 |
-
// While there is support for a type of each pattern
|
1199 |
-
// (absolute or relative) we don't actually support it here.
|
1200 |
-
$replacements = array(
|
1201 |
-
'\\,' => ',',
|
1202 |
-
'*' => '.*',
|
1203 |
-
);
|
1204 |
-
|
1205 |
-
// We assume a / directory separator, as do the exclude rules
|
1206 |
-
// most developers write, so we need a special case for any system
|
1207 |
-
// that is different.
|
1208 |
-
if (DIRECTORY_SEPARATOR === '\\') {
|
1209 |
-
$replacements['/'] = '\\\\';
|
1210 |
-
}
|
1211 |
-
|
1212 |
-
$pattern = '`'.strtr($pattern, $replacements).'`i';
|
1213 |
-
if (preg_match($pattern, $this->_file) === 1) {
|
1214 |
-
$this->_ignoredCodes[$sniffCode] = true;
|
1215 |
-
return false;
|
1216 |
-
}
|
1217 |
-
}//end foreach
|
1218 |
-
|
1219 |
-
$this->_warningCount++;
|
1220 |
-
if ($fixable === true) {
|
1221 |
-
$this->_fixableCount++;
|
1222 |
-
}
|
1223 |
-
|
1224 |
-
if ($this->_recordErrors === false) {
|
1225 |
-
if (isset($this->_warnings[$line]) === false) {
|
1226 |
-
$this->_warnings[$line] = 0;
|
1227 |
-
}
|
1228 |
-
|
1229 |
-
$this->_warnings[$line]++;
|
1230 |
-
return true;
|
1231 |
-
}
|
1232 |
-
|
1233 |
-
// Work out the warning message.
|
1234 |
-
if (isset($this->ruleset[$sniffCode]['message']) === true) {
|
1235 |
-
$warning = $this->ruleset[$sniffCode]['message'];
|
1236 |
-
}
|
1237 |
-
|
1238 |
-
if (empty($data) === true) {
|
1239 |
-
$message = $warning;
|
1240 |
-
} else {
|
1241 |
-
$message = vsprintf($warning, $data);
|
1242 |
-
}
|
1243 |
-
|
1244 |
-
if (isset($this->_warnings[$line]) === false) {
|
1245 |
-
$this->_warnings[$line] = array();
|
1246 |
-
}
|
1247 |
-
|
1248 |
-
if (isset($this->_warnings[$line][$column]) === false) {
|
1249 |
-
$this->_warnings[$line][$column] = array();
|
1250 |
-
}
|
1251 |
-
|
1252 |
-
$this->_warnings[$line][$column][] = array(
|
1253 |
-
'message' => $message,
|
1254 |
-
'source' => $sniffCode,
|
1255 |
-
'severity' => $severity,
|
1256 |
-
'fixable' => $fixable,
|
1257 |
-
);
|
1258 |
-
|
1259 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1
|
1260 |
-
&& $this->fixer->enabled === true
|
1261 |
-
&& $fixable === true
|
1262 |
-
) {
|
1263 |
-
@ob_end_clean();
|
1264 |
-
echo "\tW: $message ($sniffCode)".PHP_EOL;
|
1265 |
-
ob_start();
|
1266 |
-
}
|
1267 |
-
|
1268 |
-
return true;
|
1269 |
-
|
1270 |
-
}//end _addWarning()
|
1271 |
-
|
1272 |
-
|
1273 |
-
/**
|
1274 |
-
* Adds an warning to the warning stack.
|
1275 |
-
*
|
1276 |
-
* @param int $stackPtr The stack position where the metric was recorded.
|
1277 |
-
* @param string $metric The name of the metric being recorded.
|
1278 |
-
* @param string $value The value of the metric being recorded.
|
1279 |
-
*
|
1280 |
-
* @return boolean
|
1281 |
-
*/
|
1282 |
-
public function recordMetric($stackPtr, $metric, $value)
|
1283 |
-
{
|
1284 |
-
if (isset($this->_metrics[$metric]) === false) {
|
1285 |
-
$this->_metrics[$metric] = array(
|
1286 |
-
'values' => array(
|
1287 |
-
$value => array($stackPtr),
|
1288 |
-
),
|
1289 |
-
);
|
1290 |
-
} else {
|
1291 |
-
if (isset($this->_metrics[$metric]['values'][$value]) === false) {
|
1292 |
-
$this->_metrics[$metric]['values'][$value] = array($stackPtr);
|
1293 |
-
} else {
|
1294 |
-
$this->_metrics[$metric]['values'][$value][] = $stackPtr;
|
1295 |
-
}
|
1296 |
-
}
|
1297 |
-
|
1298 |
-
return true;
|
1299 |
-
|
1300 |
-
}//end recordMetric()
|
1301 |
-
|
1302 |
-
|
1303 |
-
/**
|
1304 |
-
* Returns the number of errors raised.
|
1305 |
-
*
|
1306 |
-
* @return int
|
1307 |
-
*/
|
1308 |
-
public function getErrorCount()
|
1309 |
-
{
|
1310 |
-
return $this->_errorCount;
|
1311 |
-
|
1312 |
-
}//end getErrorCount()
|
1313 |
-
|
1314 |
-
|
1315 |
-
/**
|
1316 |
-
* Returns the number of warnings raised.
|
1317 |
-
*
|
1318 |
-
* @return int
|
1319 |
-
*/
|
1320 |
-
public function getWarningCount()
|
1321 |
-
{
|
1322 |
-
return $this->_warningCount;
|
1323 |
-
|
1324 |
-
}//end getWarningCount()
|
1325 |
-
|
1326 |
-
|
1327 |
-
/**
|
1328 |
-
* Returns the number of successes recorded.
|
1329 |
-
*
|
1330 |
-
* @return int
|
1331 |
-
*/
|
1332 |
-
public function getSuccessCount()
|
1333 |
-
{
|
1334 |
-
return $this->_successCount;
|
1335 |
-
|
1336 |
-
}//end getSuccessCount()
|
1337 |
-
|
1338 |
-
|
1339 |
-
/**
|
1340 |
-
* Returns the number of fixable errors/warnings raised.
|
1341 |
-
*
|
1342 |
-
* @return int
|
1343 |
-
*/
|
1344 |
-
public function getFixableCount()
|
1345 |
-
{
|
1346 |
-
return $this->_fixableCount;
|
1347 |
-
|
1348 |
-
}//end getFixableCount()
|
1349 |
-
|
1350 |
-
|
1351 |
-
/**
|
1352 |
-
* Returns the list of ignored lines.
|
1353 |
-
*
|
1354 |
-
* @return array
|
1355 |
-
*/
|
1356 |
-
public function getIgnoredLines()
|
1357 |
-
{
|
1358 |
-
return self::$_ignoredLines;
|
1359 |
-
|
1360 |
-
}//end getIgnoredLines()
|
1361 |
-
|
1362 |
-
|
1363 |
-
/**
|
1364 |
-
* Returns the errors raised from processing this file.
|
1365 |
-
*
|
1366 |
-
* @return array
|
1367 |
-
*/
|
1368 |
-
public function getErrors()
|
1369 |
-
{
|
1370 |
-
return $this->_errors;
|
1371 |
-
|
1372 |
-
}//end getErrors()
|
1373 |
-
|
1374 |
-
|
1375 |
-
/**
|
1376 |
-
* Returns the warnings raised from processing this file.
|
1377 |
-
*
|
1378 |
-
* @return array
|
1379 |
-
*/
|
1380 |
-
public function getWarnings()
|
1381 |
-
{
|
1382 |
-
return $this->_warnings;
|
1383 |
-
|
1384 |
-
}//end getWarnings()
|
1385 |
-
|
1386 |
-
|
1387 |
-
/**
|
1388 |
-
* Returns the metrics found while processing this file.
|
1389 |
-
*
|
1390 |
-
* @return array
|
1391 |
-
*/
|
1392 |
-
public function getMetrics()
|
1393 |
-
{
|
1394 |
-
return $this->_metrics;
|
1395 |
-
|
1396 |
-
}//end getMetrics()
|
1397 |
-
|
1398 |
-
|
1399 |
-
/**
|
1400 |
-
* Returns the absolute filename of this file.
|
1401 |
-
*
|
1402 |
-
* @return string
|
1403 |
-
*/
|
1404 |
-
public function getFilename()
|
1405 |
-
{
|
1406 |
-
return $this->_file;
|
1407 |
-
|
1408 |
-
}//end getFilename()
|
1409 |
-
|
1410 |
-
|
1411 |
-
/**
|
1412 |
-
* Creates an array of tokens when given some PHP code.
|
1413 |
-
*
|
1414 |
-
* Starts by using token_get_all() but does a lot of extra processing
|
1415 |
-
* to insert information about the context of the token.
|
1416 |
-
*
|
1417 |
-
* @param string $string The string to tokenize.
|
1418 |
-
* @param object $tokenizer A tokenizer class to use to tokenize the string.
|
1419 |
-
* @param string $eolChar The EOL character to use for splitting strings.
|
1420 |
-
* @param int $tabWidth The number of spaces each tab respresents.
|
1421 |
-
* @param string $encoding The charset of the sniffed file.
|
1422 |
-
*
|
1423 |
-
* @throws PHP_CodeSniffer_Exception If the file cannot be processed.
|
1424 |
-
* @return array
|
1425 |
-
*/
|
1426 |
-
public static function tokenizeString($string, $tokenizer, $eolChar='\n', $tabWidth=null, $encoding=null)
|
1427 |
-
{
|
1428 |
-
// Minified files often have a very large number of characters per line
|
1429 |
-
// and cause issues when tokenizing.
|
1430 |
-
if (property_exists($tokenizer, 'skipMinified') === true
|
1431 |
-
&& $tokenizer->skipMinified === true
|
1432 |
-
) {
|
1433 |
-
$numChars = strlen($string);
|
1434 |
-
$numLines = (substr_count($string, $eolChar) + 1);
|
1435 |
-
$average = ($numChars / $numLines);
|
1436 |
-
if ($average > 100) {
|
1437 |
-
throw new PHP_CodeSniffer_Exception('File appears to be minified and cannot be processed');
|
1438 |
-
}
|
1439 |
-
}
|
1440 |
-
|
1441 |
-
$tokens = $tokenizer->tokenizeString($string, $eolChar);
|
1442 |
-
|
1443 |
-
if ($tabWidth === null) {
|
1444 |
-
$tabWidth = PHP_CODESNIFFER_TAB_WIDTH;
|
1445 |
-
}
|
1446 |
-
|
1447 |
-
if ($encoding === null) {
|
1448 |
-
$encoding = PHP_CODESNIFFER_ENCODING;
|
1449 |
-
}
|
1450 |
-
|
1451 |
-
self::_createPositionMap($tokens, $tokenizer, $eolChar, $encoding, $tabWidth);
|
1452 |
-
self::_createTokenMap($tokens, $tokenizer, $eolChar);
|
1453 |
-
self::_createParenthesisNestingMap($tokens, $tokenizer, $eolChar);
|
1454 |
-
self::_createScopeMap($tokens, $tokenizer, $eolChar);
|
1455 |
-
|
1456 |
-
self::_createLevelMap($tokens, $tokenizer, $eolChar);
|
1457 |
-
|
1458 |
-
// Allow the tokenizer to do additional processing if required.
|
1459 |
-
$tokenizer->processAdditional($tokens, $eolChar);
|
1460 |
-
|
1461 |
-
return $tokens;
|
1462 |
-
|
1463 |
-
}//end tokenizeString()
|
1464 |
-
|
1465 |
-
|
1466 |
-
/**
|
1467 |
-
* Sets token position information.
|
1468 |
-
*
|
1469 |
-
* Can also convert tabs into spaces. Each tab can represent between
|
1470 |
-
* 1 and $width spaces, so this cannot be a straight string replace.
|
1471 |
-
*
|
1472 |
-
* @param array $tokens The array of tokens to process.
|
1473 |
-
* @param object $tokenizer The tokenizer being used to process this file.
|
1474 |
-
* @param string $eolChar The EOL character to use for splitting strings.
|
1475 |
-
* @param string $encoding The charset of the sniffed file.
|
1476 |
-
* @param int $tabWidth The number of spaces that each tab represents.
|
1477 |
-
* Set to 0 to disable tab replacement.
|
1478 |
-
*
|
1479 |
-
* @return void
|
1480 |
-
*/
|
1481 |
-
private static function _createPositionMap(&$tokens, $tokenizer, $eolChar, $encoding, $tabWidth)
|
1482 |
-
{
|
1483 |
-
$currColumn = 1;
|
1484 |
-
$lineNumber = 1;
|
1485 |
-
$eolLen = (strlen($eolChar) * -1);
|
1486 |
-
$tokenizerType = get_class($tokenizer);
|
1487 |
-
$ignoring = false;
|
1488 |
-
$inTests = defined('PHP_CODESNIFFER_IN_TESTS');
|
1489 |
-
|
1490 |
-
$checkEncoding = false;
|
1491 |
-
if ($encoding !== 'iso-8859-1' && function_exists('iconv_strlen') === true) {
|
1492 |
-
$checkEncoding = true;
|
1493 |
-
}
|
1494 |
-
|
1495 |
-
$tokensWithTabs = array(
|
1496 |
-
T_WHITESPACE => true,
|
1497 |
-
T_COMMENT => true,
|
1498 |
-
T_DOC_COMMENT => true,
|
1499 |
-
T_DOC_COMMENT_WHITESPACE => true,
|
1500 |
-
T_DOC_COMMENT_STRING => true,
|
1501 |
-
T_CONSTANT_ENCAPSED_STRING => true,
|
1502 |
-
T_DOUBLE_QUOTED_STRING => true,
|
1503 |
-
T_HEREDOC => true,
|
1504 |
-
T_NOWDOC => true,
|
1505 |
-
T_INLINE_HTML => true,
|
1506 |
-
);
|
1507 |
-
|
1508 |
-
$numTokens = count($tokens);
|
1509 |
-
for ($i = 0; $i < $numTokens; $i++) {
|
1510 |
-
$tokens[$i]['line'] = $lineNumber;
|
1511 |
-
$tokens[$i]['column'] = $currColumn;
|
1512 |
-
|
1513 |
-
if ($tokenizerType === 'PHP_CodeSniffer_Tokenizers_PHP'
|
1514 |
-
&& isset(PHP_CodeSniffer_Tokens::$knownLengths[$tokens[$i]['code']]) === true
|
1515 |
-
) {
|
1516 |
-
// There are no tabs in the tokens we know the length of.
|
1517 |
-
$length = PHP_CodeSniffer_Tokens::$knownLengths[$tokens[$i]['code']];
|
1518 |
-
$currColumn += $length;
|
1519 |
-
} else if ($tabWidth === 0
|
1520 |
-
|| isset($tokensWithTabs[$tokens[$i]['code']]) === false
|
1521 |
-
|| strpos($tokens[$i]['content'], "\t") === false
|
1522 |
-
) {
|
1523 |
-
// There are no tabs in this content, or we aren't replacing them.
|
1524 |
-
if ($checkEncoding === true) {
|
1525 |
-
// Not using the default encoding, so take a bit more care.
|
1526 |
-
$length = @iconv_strlen($tokens[$i]['content'], $encoding);
|
1527 |
-
if ($length === false) {
|
1528 |
-
// String contained invalid characters, so revert to default.
|
1529 |
-
$length = strlen($tokens[$i]['content']);
|
1530 |
-
}
|
1531 |
-
} else {
|
1532 |
-
$length = strlen($tokens[$i]['content']);
|
1533 |
-
}
|
1534 |
-
|
1535 |
-
$currColumn += $length;
|
1536 |
-
} else {
|
1537 |
-
if (str_replace("\t", '', $tokens[$i]['content']) === '') {
|
1538 |
-
// String only contains tabs, so we can shortcut the process.
|
1539 |
-
$numTabs = strlen($tokens[$i]['content']);
|
1540 |
-
|
1541 |
-
$newContent = '';
|
1542 |
-
$firstTabSize = ($tabWidth - (($currColumn - 1) % $tabWidth));
|
1543 |
-
$length = ($firstTabSize + ($tabWidth * ($numTabs - 1)));
|
1544 |
-
$currColumn += $length;
|
1545 |
-
$newContent = str_repeat(' ', $length);
|
1546 |
-
} else {
|
1547 |
-
// We need to determine the length of each tab.
|
1548 |
-
$tabs = explode("\t", $tokens[$i]['content']);
|
1549 |
-
|
1550 |
-
$numTabs = (count($tabs) - 1);
|
1551 |
-
$tabNum = 0;
|
1552 |
-
$newContent = '';
|
1553 |
-
$length = 0;
|
1554 |
-
|
1555 |
-
foreach ($tabs as $content) {
|
1556 |
-
if ($content !== '') {
|
1557 |
-
$newContent .= $content;
|
1558 |
-
if ($checkEncoding === true) {
|
1559 |
-
// Not using the default encoding, so take a bit more care.
|
1560 |
-
$contentLength = @iconv_strlen($content, $encoding);
|
1561 |
-
if ($contentLength === false) {
|
1562 |
-
// String contained invalid characters, so revert to default.
|
1563 |
-
$contentLength = strlen($content);
|
1564 |
-
}
|
1565 |
-
} else {
|
1566 |
-
$contentLength = strlen($content);
|
1567 |
-
}
|
1568 |
-
|
1569 |
-
$currColumn += $contentLength;
|
1570 |
-
$length += $contentLength;
|
1571 |
-
}
|
1572 |
-
|
1573 |
-
// The last piece of content does not have a tab after it.
|
1574 |
-
if ($tabNum === $numTabs) {
|
1575 |
-
break;
|
1576 |
-
}
|
1577 |
-
|
1578 |
-
// Process the tab that comes after the content.
|
1579 |
-
$lastCurrColumn = $currColumn;
|
1580 |
-
$tabNum++;
|
1581 |
-
|
1582 |
-
// Move the pointer to the next tab stop.
|
1583 |
-
if (($currColumn % $tabWidth) === 0) {
|
1584 |
-
// This is the first tab, and we are already at a
|
1585 |
-
// tab stop, so this tab counts as a single space.
|
1586 |
-
$currColumn++;
|
1587 |
-
} else {
|
1588 |
-
$currColumn++;
|
1589 |
-
while (($currColumn % $tabWidth) !== 0) {
|
1590 |
-
$currColumn++;
|
1591 |
-
}
|
1592 |
-
|
1593 |
-
$currColumn++;
|
1594 |
-
}
|
1595 |
-
|
1596 |
-
$length += ($currColumn - $lastCurrColumn);
|
1597 |
-
$newContent .= str_repeat(' ', ($currColumn - $lastCurrColumn));
|
1598 |
-
}//end foreach
|
1599 |
-
}//end if
|
1600 |
-
|
1601 |
-
$tokens[$i]['orig_content'] = $tokens[$i]['content'];
|
1602 |
-
$tokens[$i]['content'] = $newContent;
|
1603 |
-
}//end if
|
1604 |
-
|
1605 |
-
$tokens[$i]['length'] = $length;
|
1606 |
-
|
1607 |
-
if (isset(PHP_CodeSniffer_Tokens::$knownLengths[$tokens[$i]['code']]) === false
|
1608 |
-
&& strpos($tokens[$i]['content'], $eolChar) !== false
|
1609 |
-
) {
|
1610 |
-
$lineNumber++;
|
1611 |
-
$currColumn = 1;
|
1612 |
-
|
1613 |
-
// Newline chars are not counted in the token length.
|
1614 |
-
$tokens[$i]['length'] += $eolLen;
|
1615 |
-
}
|
1616 |
-
|
1617 |
-
if ($tokens[$i]['code'] === T_COMMENT
|
1618 |
-
|| $tokens[$i]['code'] === T_DOC_COMMENT_TAG
|
1619 |
-
|| ($inTests === true && $tokens[$i]['code'] === T_INLINE_HTML)
|
1620 |
-
) {
|
1621 |
-
if (strpos($tokens[$i]['content'], '@codingStandards') !== false) {
|
1622 |
-
if ($ignoring === false
|
1623 |
-
&& strpos($tokens[$i]['content'], '@codingStandardsIgnoreStart') !== false
|
1624 |
-
) {
|
1625 |
-
$ignoring = true;
|
1626 |
-
} else if ($ignoring === true
|
1627 |
-
&& strpos($tokens[$i]['content'], '@codingStandardsIgnoreEnd') !== false
|
1628 |
-
) {
|
1629 |
-
$ignoring = false;
|
1630 |
-
// Ignore this comment too.
|
1631 |
-
self::$_ignoredLines[$tokens[$i]['line']] = true;
|
1632 |
-
} else if ($ignoring === false
|
1633 |
-
&& strpos($tokens[$i]['content'], '@codingStandardsIgnoreLine') !== false
|
1634 |
-
) {
|
1635 |
-
self::$_ignoredLines[($tokens[$i]['line'] + 1)] = true;
|
1636 |
-
// Ignore this comment too.
|
1637 |
-
self::$_ignoredLines[$tokens[$i]['line']] = true;
|
1638 |
-
}
|
1639 |
-
}
|
1640 |
-
}//end if
|
1641 |
-
|
1642 |
-
if ($ignoring === true) {
|
1643 |
-
self::$_ignoredLines[$tokens[$i]['line']] = true;
|
1644 |
-
}
|
1645 |
-
}//end for
|
1646 |
-
|
1647 |
-
}//end _createPositionMap()
|
1648 |
-
|
1649 |
-
|
1650 |
-
/**
|
1651 |
-
* Creates a map of brackets positions.
|
1652 |
-
*
|
1653 |
-
* @param array $tokens The array of tokens to process.
|
1654 |
-
* @param object $tokenizer The tokenizer being used to process this file.
|
1655 |
-
* @param string $eolChar The EOL character to use for splitting strings.
|
1656 |
-
*
|
1657 |
-
* @return void
|
1658 |
-
*/
|
1659 |
-
private static function _createTokenMap(&$tokens, $tokenizer, $eolChar)
|
1660 |
-
{
|
1661 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1662 |
-
echo "\t*** START TOKEN MAP ***".PHP_EOL;
|
1663 |
-
}
|
1664 |
-
|
1665 |
-
$squareOpeners = array();
|
1666 |
-
$curlyOpeners = array();
|
1667 |
-
$numTokens = count($tokens);
|
1668 |
-
|
1669 |
-
$openers = array();
|
1670 |
-
$openOwner = null;
|
1671 |
-
|
1672 |
-
for ($i = 0; $i < $numTokens; $i++) {
|
1673 |
-
/*
|
1674 |
-
Parenthesis mapping.
|
1675 |
-
*/
|
1676 |
-
|
1677 |
-
if (isset(PHP_CodeSniffer_Tokens::$parenthesisOpeners[$tokens[$i]['code']]) === true) {
|
1678 |
-
$tokens[$i]['parenthesis_opener'] = null;
|
1679 |
-
$tokens[$i]['parenthesis_closer'] = null;
|
1680 |
-
$tokens[$i]['parenthesis_owner'] = $i;
|
1681 |
-
$openOwner = $i;
|
1682 |
-
} else if ($tokens[$i]['code'] === T_OPEN_PARENTHESIS) {
|
1683 |
-
$openers[] = $i;
|
1684 |
-
$tokens[$i]['parenthesis_opener'] = $i;
|
1685 |
-
if ($openOwner !== null) {
|
1686 |
-
$tokens[$openOwner]['parenthesis_opener'] = $i;
|
1687 |
-
$tokens[$i]['parenthesis_owner'] = $openOwner;
|
1688 |
-
$openOwner = null;
|
1689 |
-
}
|
1690 |
-
} else if ($tokens[$i]['code'] === T_CLOSE_PARENTHESIS) {
|
1691 |
-
// Did we set an owner for this set of parenthesis?
|
1692 |
-
$numOpeners = count($openers);
|
1693 |
-
if ($numOpeners !== 0) {
|
1694 |
-
$opener = array_pop($openers);
|
1695 |
-
if (isset($tokens[$opener]['parenthesis_owner']) === true) {
|
1696 |
-
$owner = $tokens[$opener]['parenthesis_owner'];
|
1697 |
-
|
1698 |
-
$tokens[$owner]['parenthesis_closer'] = $i;
|
1699 |
-
$tokens[$i]['parenthesis_owner'] = $owner;
|
1700 |
-
}
|
1701 |
-
|
1702 |
-
$tokens[$i]['parenthesis_opener'] = $opener;
|
1703 |
-
$tokens[$i]['parenthesis_closer'] = $i;
|
1704 |
-
$tokens[$opener]['parenthesis_closer'] = $i;
|
1705 |
-
}
|
1706 |
-
}//end if
|
1707 |
-
|
1708 |
-
/*
|
1709 |
-
Bracket mapping.
|
1710 |
-
*/
|
1711 |
-
|
1712 |
-
switch ($tokens[$i]['code']) {
|
1713 |
-
case T_OPEN_SQUARE_BRACKET:
|
1714 |
-
$squareOpeners[] = $i;
|
1715 |
-
|
1716 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1717 |
-
echo str_repeat("\t", count($squareOpeners));
|
1718 |
-
echo str_repeat("\t", count($curlyOpeners));
|
1719 |
-
echo "=> Found square bracket opener at $i".PHP_EOL;
|
1720 |
-
}
|
1721 |
-
break;
|
1722 |
-
case T_OPEN_CURLY_BRACKET:
|
1723 |
-
if (isset($tokens[$i]['scope_closer']) === false) {
|
1724 |
-
$curlyOpeners[] = $i;
|
1725 |
-
|
1726 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1727 |
-
echo str_repeat("\t", count($squareOpeners));
|
1728 |
-
echo str_repeat("\t", count($curlyOpeners));
|
1729 |
-
echo "=> Found curly bracket opener at $i".PHP_EOL;
|
1730 |
-
}
|
1731 |
-
}
|
1732 |
-
break;
|
1733 |
-
case T_CLOSE_SQUARE_BRACKET:
|
1734 |
-
if (empty($squareOpeners) === false) {
|
1735 |
-
$opener = array_pop($squareOpeners);
|
1736 |
-
$tokens[$i]['bracket_opener'] = $opener;
|
1737 |
-
$tokens[$i]['bracket_closer'] = $i;
|
1738 |
-
$tokens[$opener]['bracket_opener'] = $opener;
|
1739 |
-
$tokens[$opener]['bracket_closer'] = $i;
|
1740 |
-
|
1741 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1742 |
-
echo str_repeat("\t", count($squareOpeners));
|
1743 |
-
echo str_repeat("\t", count($curlyOpeners));
|
1744 |
-
echo "\t=> Found square bracket closer at $i for $opener".PHP_EOL;
|
1745 |
-
}
|
1746 |
-
}
|
1747 |
-
break;
|
1748 |
-
case T_CLOSE_CURLY_BRACKET:
|
1749 |
-
if (empty($curlyOpeners) === false
|
1750 |
-
&& isset($tokens[$i]['scope_opener']) === false
|
1751 |
-
) {
|
1752 |
-
$opener = array_pop($curlyOpeners);
|
1753 |
-
$tokens[$i]['bracket_opener'] = $opener;
|
1754 |
-
$tokens[$i]['bracket_closer'] = $i;
|
1755 |
-
$tokens[$opener]['bracket_opener'] = $opener;
|
1756 |
-
$tokens[$opener]['bracket_closer'] = $i;
|
1757 |
-
|
1758 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1759 |
-
echo str_repeat("\t", count($squareOpeners));
|
1760 |
-
echo str_repeat("\t", count($curlyOpeners));
|
1761 |
-
echo "\t=> Found curly bracket closer at $i for $opener".PHP_EOL;
|
1762 |
-
}
|
1763 |
-
}
|
1764 |
-
break;
|
1765 |
-
default:
|
1766 |
-
continue;
|
1767 |
-
}//end switch
|
1768 |
-
}//end for
|
1769 |
-
|
1770 |
-
// Cleanup for any openers that we didn't find closers for.
|
1771 |
-
// This typically means there was a syntax error breaking things.
|
1772 |
-
foreach ($openers as $opener) {
|
1773 |
-
unset($tokens[$opener]['parenthesis_opener']);
|
1774 |
-
unset($tokens[$opener]['parenthesis_owner']);
|
1775 |
-
}
|
1776 |
-
|
1777 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1778 |
-
echo "\t*** END TOKEN MAP ***".PHP_EOL;
|
1779 |
-
}
|
1780 |
-
|
1781 |
-
}//end _createTokenMap()
|
1782 |
-
|
1783 |
-
|
1784 |
-
/**
|
1785 |
-
* Creates a map for the parenthesis tokens that surround other tokens.
|
1786 |
-
*
|
1787 |
-
* @param array $tokens The array of tokens to process.
|
1788 |
-
* @param object $tokenizer The tokenizer being used to process this file.
|
1789 |
-
* @param string $eolChar The EOL character to use for splitting strings.
|
1790 |
-
*
|
1791 |
-
* @return void
|
1792 |
-
*/
|
1793 |
-
private static function _createParenthesisNestingMap(
|
1794 |
-
&$tokens,
|
1795 |
-
$tokenizer,
|
1796 |
-
$eolChar
|
1797 |
-
) {
|
1798 |
-
$numTokens = count($tokens);
|
1799 |
-
$map = array();
|
1800 |
-
for ($i = 0; $i < $numTokens; $i++) {
|
1801 |
-
if (isset($tokens[$i]['parenthesis_opener']) === true
|
1802 |
-
&& $i === $tokens[$i]['parenthesis_opener']
|
1803 |
-
) {
|
1804 |
-
if (empty($map) === false) {
|
1805 |
-
$tokens[$i]['nested_parenthesis'] = $map;
|
1806 |
-
}
|
1807 |
-
|
1808 |
-
if (isset($tokens[$i]['parenthesis_closer']) === true) {
|
1809 |
-
$map[$tokens[$i]['parenthesis_opener']]
|
1810 |
-
= $tokens[$i]['parenthesis_closer'];
|
1811 |
-
}
|
1812 |
-
} else if (isset($tokens[$i]['parenthesis_closer']) === true
|
1813 |
-
&& $i === $tokens[$i]['parenthesis_closer']
|
1814 |
-
) {
|
1815 |
-
array_pop($map);
|
1816 |
-
if (empty($map) === false) {
|
1817 |
-
$tokens[$i]['nested_parenthesis'] = $map;
|
1818 |
-
}
|
1819 |
-
} else {
|
1820 |
-
if (empty($map) === false) {
|
1821 |
-
$tokens[$i]['nested_parenthesis'] = $map;
|
1822 |
-
}
|
1823 |
-
}//end if
|
1824 |
-
}//end for
|
1825 |
-
|
1826 |
-
}//end _createParenthesisNestingMap()
|
1827 |
-
|
1828 |
-
|
1829 |
-
/**
|
1830 |
-
* Creates a scope map of tokens that open scopes.
|
1831 |
-
*
|
1832 |
-
* @param array $tokens The array of tokens to process.
|
1833 |
-
* @param object $tokenizer The tokenizer being used to process this file.
|
1834 |
-
* @param string $eolChar The EOL character to use for splitting strings.
|
1835 |
-
*
|
1836 |
-
* @return void
|
1837 |
-
* @see _recurseScopeMap()
|
1838 |
-
*/
|
1839 |
-
private static function _createScopeMap(&$tokens, $tokenizer, $eolChar)
|
1840 |
-
{
|
1841 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1842 |
-
echo "\t*** START SCOPE MAP ***".PHP_EOL;
|
1843 |
-
}
|
1844 |
-
|
1845 |
-
$numTokens = count($tokens);
|
1846 |
-
for ($i = 0; $i < $numTokens; $i++) {
|
1847 |
-
// Check to see if the current token starts a new scope.
|
1848 |
-
if (isset($tokenizer->scopeOpeners[$tokens[$i]['code']]) === true) {
|
1849 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1850 |
-
$type = $tokens[$i]['type'];
|
1851 |
-
$content = PHP_CodeSniffer::prepareForOutput($tokens[$i]['content']);
|
1852 |
-
echo "\tStart scope map at $i:$type => $content".PHP_EOL;
|
1853 |
-
}
|
1854 |
-
|
1855 |
-
if (isset($tokens[$i]['scope_condition']) === true) {
|
1856 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1857 |
-
echo "\t* already processed, skipping *".PHP_EOL;
|
1858 |
-
}
|
1859 |
-
|
1860 |
-
continue;
|
1861 |
-
}
|
1862 |
-
|
1863 |
-
$i = self::_recurseScopeMap(
|
1864 |
-
$tokens,
|
1865 |
-
$numTokens,
|
1866 |
-
$tokenizer,
|
1867 |
-
$eolChar,
|
1868 |
-
$i
|
1869 |
-
);
|
1870 |
-
}//end if
|
1871 |
-
}//end for
|
1872 |
-
|
1873 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1874 |
-
echo "\t*** END SCOPE MAP ***".PHP_EOL;
|
1875 |
-
}
|
1876 |
-
|
1877 |
-
}//end _createScopeMap()
|
1878 |
-
|
1879 |
-
|
1880 |
-
/**
|
1881 |
-
* Recurses though the scope openers to build a scope map.
|
1882 |
-
*
|
1883 |
-
* @param array $tokens The array of tokens to process.
|
1884 |
-
* @param int $numTokens The size of the tokens array.
|
1885 |
-
* @param object $tokenizer The tokenizer being used to process this file.
|
1886 |
-
* @param string $eolChar The EOL character to use for splitting strings.
|
1887 |
-
* @param int $stackPtr The position in the stack of the token that
|
1888 |
-
* opened the scope (eg. an IF token or FOR token).
|
1889 |
-
* @param int $depth How many scope levels down we are.
|
1890 |
-
* @param int $ignore How many curly braces we are ignoring.
|
1891 |
-
*
|
1892 |
-
* @return int The position in the stack that closed the scope.
|
1893 |
-
*/
|
1894 |
-
private static function _recurseScopeMap(
|
1895 |
-
&$tokens,
|
1896 |
-
$numTokens,
|
1897 |
-
$tokenizer,
|
1898 |
-
$eolChar,
|
1899 |
-
$stackPtr,
|
1900 |
-
$depth=1,
|
1901 |
-
&$ignore=0
|
1902 |
-
) {
|
1903 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1904 |
-
echo str_repeat("\t", $depth);
|
1905 |
-
echo "=> Begin scope map recursion at token $stackPtr with depth $depth".PHP_EOL;
|
1906 |
-
}
|
1907 |
-
|
1908 |
-
$opener = null;
|
1909 |
-
$currType = $tokens[$stackPtr]['code'];
|
1910 |
-
$startLine = $tokens[$stackPtr]['line'];
|
1911 |
-
|
1912 |
-
// We will need this to restore the value if we end up
|
1913 |
-
// returning a token ID that causes our calling function to go back
|
1914 |
-
// over already ignored braces.
|
1915 |
-
$originalIgnore = $ignore;
|
1916 |
-
|
1917 |
-
// If the start token for this scope opener is the same as
|
1918 |
-
// the scope token, we have already found our opener.
|
1919 |
-
if (isset($tokenizer->scopeOpeners[$currType]['start'][$currType]) === true) {
|
1920 |
-
$opener = $stackPtr;
|
1921 |
-
}
|
1922 |
-
|
1923 |
-
for ($i = ($stackPtr + 1); $i < $numTokens; $i++) {
|
1924 |
-
$tokenType = $tokens[$i]['code'];
|
1925 |
-
|
1926 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1927 |
-
$type = $tokens[$i]['type'];
|
1928 |
-
$line = $tokens[$i]['line'];
|
1929 |
-
$content = PHP_CodeSniffer::prepareForOutput($tokens[$i]['content']);
|
1930 |
-
|
1931 |
-
echo str_repeat("\t", $depth);
|
1932 |
-
echo "Process token $i on line $line [";
|
1933 |
-
if ($opener !== null) {
|
1934 |
-
echo "opener:$opener;";
|
1935 |
-
}
|
1936 |
-
|
1937 |
-
if ($ignore > 0) {
|
1938 |
-
echo "ignore=$ignore;";
|
1939 |
-
}
|
1940 |
-
|
1941 |
-
echo "]: $type => $content".PHP_EOL;
|
1942 |
-
}//end if
|
1943 |
-
|
1944 |
-
// Very special case for IF statements in PHP that can be defined without
|
1945 |
-
// scope tokens. E.g., if (1) 1; 1 ? (1 ? 1 : 1) : 1;
|
1946 |
-
// If an IF statement below this one has an opener but no
|
1947 |
-
// keyword, the opener will be incorrectly assigned to this IF statement.
|
1948 |
-
// The same case also applies to USE statements, which don't have to have
|
1949 |
-
// openers, so a following USE statement can cause an incorrect brace match.
|
1950 |
-
if (($currType === T_IF || $currType === T_ELSE || $currType === T_USE)
|
1951 |
-
&& $opener === null
|
1952 |
-
&& $tokens[$i]['code'] === T_SEMICOLON
|
1953 |
-
) {
|
1954 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1955 |
-
$type = $tokens[$stackPtr]['type'];
|
1956 |
-
echo str_repeat("\t", $depth);
|
1957 |
-
echo "=> Found semicolon before scope opener for $stackPtr:$type, bailing".PHP_EOL;
|
1958 |
-
}
|
1959 |
-
|
1960 |
-
return $i;
|
1961 |
-
}
|
1962 |
-
|
1963 |
-
if ($opener === null
|
1964 |
-
&& $ignore === 0
|
1965 |
-
&& $tokenType === T_CLOSE_CURLY_BRACKET
|
1966 |
-
&& isset($tokenizer->scopeOpeners[$currType]['end'][$tokenType]) === true
|
1967 |
-
) {
|
1968 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1969 |
-
$type = $tokens[$stackPtr]['type'];
|
1970 |
-
echo str_repeat("\t", $depth);
|
1971 |
-
echo "=> Found curly brace closer before scope opener for $stackPtr:$type, bailing".PHP_EOL;
|
1972 |
-
}
|
1973 |
-
|
1974 |
-
return ($i - 1);
|
1975 |
-
}
|
1976 |
-
|
1977 |
-
if ($opener !== null
|
1978 |
-
&& (isset($tokens[$i]['scope_opener']) === false
|
1979 |
-
|| $tokenizer->scopeOpeners[$tokens[$stackPtr]['code']]['shared'] === true)
|
1980 |
-
&& isset($tokenizer->scopeOpeners[$currType]['end'][$tokenType]) === true
|
1981 |
-
) {
|
1982 |
-
if ($ignore > 0 && $tokenType === T_CLOSE_CURLY_BRACKET) {
|
1983 |
-
// The last opening bracket must have been for a string
|
1984 |
-
// offset or alike, so let's ignore it.
|
1985 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1986 |
-
echo str_repeat("\t", $depth);
|
1987 |
-
echo '* finished ignoring curly brace *'.PHP_EOL;
|
1988 |
-
}
|
1989 |
-
|
1990 |
-
$ignore--;
|
1991 |
-
continue;
|
1992 |
-
} else if ($tokens[$opener]['code'] === T_OPEN_CURLY_BRACKET
|
1993 |
-
&& $tokenType !== T_CLOSE_CURLY_BRACKET
|
1994 |
-
) {
|
1995 |
-
// The opener is a curly bracket so the closer must be a curly bracket as well.
|
1996 |
-
// We ignore this closer to handle cases such as T_ELSE or T_ELSEIF being considered
|
1997 |
-
// a closer of T_IF when it should not.
|
1998 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
1999 |
-
$type = $tokens[$stackPtr]['type'];
|
2000 |
-
echo str_repeat("\t", $depth);
|
2001 |
-
echo "=> Ignoring non-curly scope closer for $stackPtr:$type".PHP_EOL;
|
2002 |
-
}
|
2003 |
-
} else {
|
2004 |
-
$scopeCloser = $i;
|
2005 |
-
$todo = array(
|
2006 |
-
$stackPtr,
|
2007 |
-
$opener,
|
2008 |
-
);
|
2009 |
-
|
2010 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2011 |
-
$type = $tokens[$stackPtr]['type'];
|
2012 |
-
$closerType = $tokens[$scopeCloser]['type'];
|
2013 |
-
echo str_repeat("\t", $depth);
|
2014 |
-
echo "=> Found scope closer ($scopeCloser:$closerType) for $stackPtr:$type".PHP_EOL;
|
2015 |
-
}
|
2016 |
-
|
2017 |
-
$validCloser = true;
|
2018 |
-
if (($tokens[$stackPtr]['code'] === T_IF || $tokens[$stackPtr]['code'] === T_ELSEIF)
|
2019 |
-
&& ($tokenType === T_ELSE || $tokenType === T_ELSEIF)
|
2020 |
-
) {
|
2021 |
-
// To be a closer, this token must have an opener.
|
2022 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2023 |
-
echo str_repeat("\t", $depth);
|
2024 |
-
echo "* closer needs to be tested *".PHP_EOL;
|
2025 |
-
}
|
2026 |
-
|
2027 |
-
$i = self::_recurseScopeMap(
|
2028 |
-
$tokens,
|
2029 |
-
$numTokens,
|
2030 |
-
$tokenizer,
|
2031 |
-
$eolChar,
|
2032 |
-
$i,
|
2033 |
-
($depth + 1),
|
2034 |
-
$ignore
|
2035 |
-
);
|
2036 |
-
|
2037 |
-
if (isset($tokens[$scopeCloser]['scope_opener']) === false) {
|
2038 |
-
$validCloser = false;
|
2039 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2040 |
-
echo str_repeat("\t", $depth);
|
2041 |
-
echo "* closer is not valid (no opener found) *".PHP_EOL;
|
2042 |
-
}
|
2043 |
-
} else if ($tokens[$tokens[$scopeCloser]['scope_opener']]['code'] !== $tokens[$opener]['code']) {
|
2044 |
-
$validCloser = false;
|
2045 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2046 |
-
echo str_repeat("\t", $depth);
|
2047 |
-
$type = $tokens[$tokens[$scopeCloser]['scope_opener']]['type'];
|
2048 |
-
$openerType = $tokens[$opener]['type'];
|
2049 |
-
echo "* closer is not valid (mismatched opener type; $type != $openerType) *".PHP_EOL;
|
2050 |
-
}
|
2051 |
-
} else if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2052 |
-
echo str_repeat("\t", $depth);
|
2053 |
-
echo "* closer was valid *".PHP_EOL;
|
2054 |
-
}
|
2055 |
-
} else {
|
2056 |
-
// The closer was not processed, so we need to
|
2057 |
-
// complete that token as well.
|
2058 |
-
$todo[] = $scopeCloser;
|
2059 |
-
}//end if
|
2060 |
-
|
2061 |
-
if ($validCloser === true) {
|
2062 |
-
foreach ($todo as $token) {
|
2063 |
-
$tokens[$token]['scope_condition'] = $stackPtr;
|
2064 |
-
$tokens[$token]['scope_opener'] = $opener;
|
2065 |
-
$tokens[$token]['scope_closer'] = $scopeCloser;
|
2066 |
-
}
|
2067 |
-
|
2068 |
-
if ($tokenizer->scopeOpeners[$tokens[$stackPtr]['code']]['shared'] === true) {
|
2069 |
-
// As we are going back to where we started originally, restore
|
2070 |
-
// the ignore value back to its original value.
|
2071 |
-
$ignore = $originalIgnore;
|
2072 |
-
return $opener;
|
2073 |
-
} else if ($scopeCloser === $i
|
2074 |
-
&& isset($tokenizer->scopeOpeners[$tokenType]) === true
|
2075 |
-
) {
|
2076 |
-
// Unset scope_condition here or else the token will appear to have
|
2077 |
-
// already been processed, and it will be skipped. Normally we want that,
|
2078 |
-
// but in this case, the token is both a closer and an opener, so
|
2079 |
-
// it needs to act like an opener. This is also why we return the
|
2080 |
-
// token before this one; so the closer has a chance to be processed
|
2081 |
-
// a second time, but as an opener.
|
2082 |
-
unset($tokens[$scopeCloser]['scope_condition']);
|
2083 |
-
return ($i - 1);
|
2084 |
-
} else {
|
2085 |
-
return $i;
|
2086 |
-
}
|
2087 |
-
} else {
|
2088 |
-
continue;
|
2089 |
-
}//end if
|
2090 |
-
}//end if
|
2091 |
-
}//end if
|
2092 |
-
|
2093 |
-
// Is this an opening condition ?
|
2094 |
-
if (isset($tokenizer->scopeOpeners[$tokenType]) === true) {
|
2095 |
-
if ($opener === null) {
|
2096 |
-
if ($tokenType === T_USE) {
|
2097 |
-
// PHP use keywords are special because they can be
|
2098 |
-
// used as blocks but also inline in function definitions.
|
2099 |
-
// So if we find them nested inside another opener, just skip them.
|
2100 |
-
continue;
|
2101 |
-
}
|
2102 |
-
|
2103 |
-
if ($tokenType === T_FUNCTION
|
2104 |
-
&& $tokens[$stackPtr]['code'] !== T_FUNCTION
|
2105 |
-
) {
|
2106 |
-
// Probably a closure, so process it manually.
|
2107 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2108 |
-
$type = $tokens[$stackPtr]['type'];
|
2109 |
-
echo str_repeat("\t", $depth);
|
2110 |
-
echo "=> Found function before scope opener for $stackPtr:$type, processing manually".PHP_EOL;
|
2111 |
-
}
|
2112 |
-
|
2113 |
-
if (isset($tokens[$i]['scope_closer']) === true) {
|
2114 |
-
// We've already processed this closure.
|
2115 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2116 |
-
echo str_repeat("\t", $depth);
|
2117 |
-
echo '* already processed, skipping *'.PHP_EOL;
|
2118 |
-
}
|
2119 |
-
|
2120 |
-
$i = $tokens[$i]['scope_closer'];
|
2121 |
-
continue;
|
2122 |
-
}
|
2123 |
-
|
2124 |
-
$i = self::_recurseScopeMap(
|
2125 |
-
$tokens,
|
2126 |
-
$numTokens,
|
2127 |
-
$tokenizer,
|
2128 |
-
$eolChar,
|
2129 |
-
$i,
|
2130 |
-
($depth + 1),
|
2131 |
-
$ignore
|
2132 |
-
);
|
2133 |
-
|
2134 |
-
continue;
|
2135 |
-
}//end if
|
2136 |
-
|
2137 |
-
// Found another opening condition but still haven't
|
2138 |
-
// found our opener, so we are never going to find one.
|
2139 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2140 |
-
$type = $tokens[$stackPtr]['type'];
|
2141 |
-
echo str_repeat("\t", $depth);
|
2142 |
-
echo "=> Found new opening condition before scope opener for $stackPtr:$type, ";
|
2143 |
-
}
|
2144 |
-
|
2145 |
-
if (($tokens[$stackPtr]['code'] === T_IF
|
2146 |
-
|| $tokens[$stackPtr]['code'] === T_ELSEIF
|
2147 |
-
|| $tokens[$stackPtr]['code'] === T_ELSE)
|
2148 |
-
&& ($tokens[$i]['code'] === T_ELSE
|
2149 |
-
|| $tokens[$i]['code'] === T_ELSEIF)
|
2150 |
-
) {
|
2151 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2152 |
-
echo "continuing".PHP_EOL;
|
2153 |
-
}
|
2154 |
-
|
2155 |
-
return ($i - 1);
|
2156 |
-
} else {
|
2157 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2158 |
-
echo "backtracking".PHP_EOL;
|
2159 |
-
}
|
2160 |
-
|
2161 |
-
return $stackPtr;
|
2162 |
-
}
|
2163 |
-
}//end if
|
2164 |
-
|
2165 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2166 |
-
echo str_repeat("\t", $depth);
|
2167 |
-
echo '* token is an opening condition *'.PHP_EOL;
|
2168 |
-
}
|
2169 |
-
|
2170 |
-
$isShared = ($tokenizer->scopeOpeners[$tokenType]['shared'] === true);
|
2171 |
-
|
2172 |
-
if (isset($tokens[$i]['scope_condition']) === true) {
|
2173 |
-
// We've been here before.
|
2174 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2175 |
-
echo str_repeat("\t", $depth);
|
2176 |
-
echo '* already processed, skipping *'.PHP_EOL;
|
2177 |
-
}
|
2178 |
-
|
2179 |
-
if ($isShared === false
|
2180 |
-
&& isset($tokens[$i]['scope_closer']) === true
|
2181 |
-
) {
|
2182 |
-
$i = $tokens[$i]['scope_closer'];
|
2183 |
-
}
|
2184 |
-
|
2185 |
-
continue;
|
2186 |
-
} else if ($currType === $tokenType
|
2187 |
-
&& $isShared === false
|
2188 |
-
&& $opener === null
|
2189 |
-
) {
|
2190 |
-
// We haven't yet found our opener, but we have found another
|
2191 |
-
// scope opener which is the same type as us, and we don't
|
2192 |
-
// share openers, so we will never find one.
|
2193 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2194 |
-
echo str_repeat("\t", $depth);
|
2195 |
-
echo '* it was another token\'s opener, bailing *'.PHP_EOL;
|
2196 |
-
}
|
2197 |
-
|
2198 |
-
return $stackPtr;
|
2199 |
-
} else {
|
2200 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2201 |
-
echo str_repeat("\t", $depth);
|
2202 |
-
echo '* searching for opener *'.PHP_EOL;
|
2203 |
-
}
|
2204 |
-
|
2205 |
-
if (isset($tokenizer->scopeOpeners[$tokenType]['end'][T_CLOSE_CURLY_BRACKET]) === true) {
|
2206 |
-
$oldIgnore = $ignore;
|
2207 |
-
$ignore = 0;
|
2208 |
-
}
|
2209 |
-
|
2210 |
-
// PHP has a max nesting level for functions. Stop before we hit that limit
|
2211 |
-
// because too many loops means we've run into trouble anyway.
|
2212 |
-
if ($depth > 50) {
|
2213 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2214 |
-
echo str_repeat("\t", $depth);
|
2215 |
-
echo '* reached maximum nesting level; aborting *'.PHP_EOL;
|
2216 |
-
}
|
2217 |
-
|
2218 |
-
throw new PHP_CodeSniffer_Exception('Maximum nesting level reached; file could not be processed');
|
2219 |
-
}
|
2220 |
-
|
2221 |
-
$oldDepth = $depth;
|
2222 |
-
if ($isShared === true
|
2223 |
-
&& isset($tokenizer->scopeOpeners[$tokenType]['with'][$currType]) === true
|
2224 |
-
) {
|
2225 |
-
// Don't allow the depth to increment because this is
|
2226 |
-
// possibly not a true nesting if we are sharing our closer.
|
2227 |
-
// This can happen, for example, when a SWITCH has a large
|
2228 |
-
// number of CASE statements with the same shared BREAK.
|
2229 |
-
$depth--;
|
2230 |
-
}
|
2231 |
-
|
2232 |
-
$i = self::_recurseScopeMap(
|
2233 |
-
$tokens,
|
2234 |
-
$numTokens,
|
2235 |
-
$tokenizer,
|
2236 |
-
$eolChar,
|
2237 |
-
$i,
|
2238 |
-
($depth + 1),
|
2239 |
-
$ignore
|
2240 |
-
);
|
2241 |
-
|
2242 |
-
$depth = $oldDepth;
|
2243 |
-
|
2244 |
-
if (isset($tokenizer->scopeOpeners[$tokenType]['end'][T_CLOSE_CURLY_BRACKET]) === true) {
|
2245 |
-
$ignore = $oldIgnore;
|
2246 |
-
}
|
2247 |
-
}//end if
|
2248 |
-
}//end if
|
2249 |
-
|
2250 |
-
if (isset($tokenizer->scopeOpeners[$currType]['start'][$tokenType]) === true
|
2251 |
-
&& $opener === null
|
2252 |
-
) {
|
2253 |
-
if ($tokenType === T_OPEN_CURLY_BRACKET) {
|
2254 |
-
if (isset($tokens[$stackPtr]['parenthesis_closer']) === true
|
2255 |
-
&& $i < $tokens[$stackPtr]['parenthesis_closer']
|
2256 |
-
) {
|
2257 |
-
// We found a curly brace inside the condition of the
|
2258 |
-
// current scope opener, so it must be a string offset.
|
2259 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2260 |
-
echo str_repeat("\t", $depth);
|
2261 |
-
echo '* ignoring curly brace inside condition *'.PHP_EOL;
|
2262 |
-
}
|
2263 |
-
|
2264 |
-
$ignore++;
|
2265 |
-
} else {
|
2266 |
-
// Make sure this is actually an opener and not a
|
2267 |
-
// string offset (e.g., $var{0}).
|
2268 |
-
for ($x = ($i - 1); $x > 0; $x--) {
|
2269 |
-
if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$tokens[$x]['code']]) === true) {
|
2270 |
-
continue;
|
2271 |
-
} else {
|
2272 |
-
// If the first non-whitespace/comment token looks like this
|
2273 |
-
// brace is a string offset, or this brace is mid-way through
|
2274 |
-
// a new statement, it isn't a scope opener.
|
2275 |
-
$disallowed = PHP_CodeSniffer_Tokens::$assignmentTokens;
|
2276 |
-
$disallowed += array(
|
2277 |
-
T_VARIABLE => true,
|
2278 |
-
T_OBJECT_OPERATOR => true,
|
2279 |
-
T_COMMA => true,
|
2280 |
-
T_OPEN_PARENTHESIS => true,
|
2281 |
-
);
|
2282 |
-
|
2283 |
-
if (isset($disallowed[$tokens[$x]['code']]) === true) {
|
2284 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2285 |
-
echo str_repeat("\t", $depth);
|
2286 |
-
echo '* ignoring curly brace after condition *'.PHP_EOL;
|
2287 |
-
}
|
2288 |
-
|
2289 |
-
$ignore++;
|
2290 |
-
}//end if
|
2291 |
-
|
2292 |
-
break;
|
2293 |
-
}//end if
|
2294 |
-
}//end for
|
2295 |
-
}//end if
|
2296 |
-
}//end if
|
2297 |
-
|
2298 |
-
if ($ignore === 0 || $tokenType !== T_OPEN_CURLY_BRACKET) {
|
2299 |
-
// We found the opening scope token for $currType.
|
2300 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2301 |
-
$type = $tokens[$stackPtr]['type'];
|
2302 |
-
echo str_repeat("\t", $depth);
|
2303 |
-
echo "=> Found scope opener for $stackPtr:$type".PHP_EOL;
|
2304 |
-
}
|
2305 |
-
|
2306 |
-
$opener = $i;
|
2307 |
-
}
|
2308 |
-
} else if ($tokenType === T_OPEN_PARENTHESIS) {
|
2309 |
-
if (isset($tokens[$i]['parenthesis_owner']) === true) {
|
2310 |
-
$owner = $tokens[$i]['parenthesis_owner'];
|
2311 |
-
if (isset(PHP_CodeSniffer_Tokens::$scopeOpeners[$tokens[$owner]['code']]) === true
|
2312 |
-
&& isset($tokens[$i]['parenthesis_closer']) === true
|
2313 |
-
) {
|
2314 |
-
// If we get into here, then we opened a parenthesis for
|
2315 |
-
// a scope (eg. an if or else if) so we need to update the
|
2316 |
-
// start of the line so that when we check to see
|
2317 |
-
// if the closing parenthesis is more than 3 lines away from
|
2318 |
-
// the statement, we check from the closing parenthesis.
|
2319 |
-
$startLine = $tokens[$tokens[$i]['parenthesis_closer']]['line'];
|
2320 |
-
}
|
2321 |
-
}
|
2322 |
-
} else if ($tokenType === T_OPEN_CURLY_BRACKET && $opener !== null) {
|
2323 |
-
// We opened something that we don't have a scope opener for.
|
2324 |
-
// Examples of this are curly brackets for string offsets etc.
|
2325 |
-
// We want to ignore this so that we don't have an invalid scope
|
2326 |
-
// map.
|
2327 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2328 |
-
echo str_repeat("\t", $depth);
|
2329 |
-
echo '* ignoring curly brace *'.PHP_EOL;
|
2330 |
-
}
|
2331 |
-
|
2332 |
-
$ignore++;
|
2333 |
-
} else if ($tokenType === T_CLOSE_CURLY_BRACKET && $ignore > 0) {
|
2334 |
-
// We found the end token for the opener we were ignoring.
|
2335 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2336 |
-
echo str_repeat("\t", $depth);
|
2337 |
-
echo '* finished ignoring curly brace *'.PHP_EOL;
|
2338 |
-
}
|
2339 |
-
|
2340 |
-
$ignore--;
|
2341 |
-
} else if ($opener === null
|
2342 |
-
&& isset($tokenizer->scopeOpeners[$currType]) === true
|
2343 |
-
) {
|
2344 |
-
// If we still haven't found the opener after 3 lines,
|
2345 |
-
// we're not going to find it, unless we know it requires
|
2346 |
-
// an opener (in which case we better keep looking) or the last
|
2347 |
-
// token was empty (in which case we'll just confirm there is
|
2348 |
-
// more code in this file and not just a big comment).
|
2349 |
-
if ($tokens[$i]['line'] >= ($startLine + 3)
|
2350 |
-
&& isset(PHP_CodeSniffer_Tokens::$emptyTokens[$tokens[($i - 1)]['code']]) === false
|
2351 |
-
) {
|
2352 |
-
if ($tokenizer->scopeOpeners[$currType]['strict'] === true) {
|
2353 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2354 |
-
$type = $tokens[$stackPtr]['type'];
|
2355 |
-
$lines = ($tokens[$i]['line'] - $startLine);
|
2356 |
-
echo str_repeat("\t", $depth);
|
2357 |
-
echo "=> Still looking for $stackPtr:$type scope opener after $lines lines".PHP_EOL;
|
2358 |
-
}
|
2359 |
-
} else {
|
2360 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2361 |
-
$type = $tokens[$stackPtr]['type'];
|
2362 |
-
echo str_repeat("\t", $depth);
|
2363 |
-
echo "=> Couldn't find scope opener for $stackPtr:$type, bailing".PHP_EOL;
|
2364 |
-
}
|
2365 |
-
|
2366 |
-
return $stackPtr;
|
2367 |
-
}
|
2368 |
-
}
|
2369 |
-
} else if ($opener !== null
|
2370 |
-
&& $tokenType !== T_BREAK
|
2371 |
-
&& isset($tokenizer->endScopeTokens[$tokenType]) === true
|
2372 |
-
) {
|
2373 |
-
if (isset($tokens[$i]['scope_condition']) === false) {
|
2374 |
-
if ($ignore > 0) {
|
2375 |
-
// We found the end token for the opener we were ignoring.
|
2376 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2377 |
-
echo str_repeat("\t", $depth);
|
2378 |
-
echo '* finished ignoring curly brace *'.PHP_EOL;
|
2379 |
-
}
|
2380 |
-
|
2381 |
-
$ignore--;
|
2382 |
-
} else {
|
2383 |
-
// We found a token that closes the scope but it doesn't
|
2384 |
-
// have a condition, so it belongs to another token and
|
2385 |
-
// our token doesn't have a closer, so pretend this is
|
2386 |
-
// the closer.
|
2387 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2388 |
-
$type = $tokens[$stackPtr]['type'];
|
2389 |
-
echo str_repeat("\t", $depth);
|
2390 |
-
echo "=> Found (unexpected) scope closer for $stackPtr:$type".PHP_EOL;
|
2391 |
-
}
|
2392 |
-
|
2393 |
-
foreach (array($stackPtr, $opener) as $token) {
|
2394 |
-
$tokens[$token]['scope_condition'] = $stackPtr;
|
2395 |
-
$tokens[$token]['scope_opener'] = $opener;
|
2396 |
-
$tokens[$token]['scope_closer'] = $i;
|
2397 |
-
}
|
2398 |
-
|
2399 |
-
return ($i - 1);
|
2400 |
-
}//end if
|
2401 |
-
}//end if
|
2402 |
-
}//end if
|
2403 |
-
}//end for
|
2404 |
-
|
2405 |
-
return $stackPtr;
|
2406 |
-
|
2407 |
-
}//end _recurseScopeMap()
|
2408 |
-
|
2409 |
-
|
2410 |
-
/**
|
2411 |
-
* Constructs the level map.
|
2412 |
-
*
|
2413 |
-
* The level map adds a 'level' index to each token which indicates the
|
2414 |
-
* depth that a token within a set of scope blocks. It also adds a
|
2415 |
-
* 'condition' index which is an array of the scope conditions that opened
|
2416 |
-
* each of the scopes - position 0 being the first scope opener.
|
2417 |
-
*
|
2418 |
-
* @param array $tokens The array of tokens to process.
|
2419 |
-
* @param object $tokenizer The tokenizer being used to process this file.
|
2420 |
-
* @param string $eolChar The EOL character to use for splitting strings.
|
2421 |
-
*
|
2422 |
-
* @return void
|
2423 |
-
*/
|
2424 |
-
private static function _createLevelMap(&$tokens, $tokenizer, $eolChar)
|
2425 |
-
{
|
2426 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2427 |
-
echo "\t*** START LEVEL MAP ***".PHP_EOL;
|
2428 |
-
}
|
2429 |
-
|
2430 |
-
$numTokens = count($tokens);
|
2431 |
-
$level = 0;
|
2432 |
-
$conditions = array();
|
2433 |
-
$lastOpener = null;
|
2434 |
-
$openers = array();
|
2435 |
-
|
2436 |
-
for ($i = 0; $i < $numTokens; $i++) {
|
2437 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2438 |
-
$type = $tokens[$i]['type'];
|
2439 |
-
$line = $tokens[$i]['line'];
|
2440 |
-
$len = $tokens[$i]['length'];
|
2441 |
-
$col = $tokens[$i]['column'];
|
2442 |
-
|
2443 |
-
$content = PHP_CodeSniffer::prepareForOutput($tokens[$i]['content']);
|
2444 |
-
|
2445 |
-
echo str_repeat("\t", ($level + 1));
|
2446 |
-
echo "Process token $i on line $line [col:$col;len:$len;lvl:$level;";
|
2447 |
-
if (empty($conditions) !== true) {
|
2448 |
-
$condString = 'conds;';
|
2449 |
-
foreach ($conditions as $condition) {
|
2450 |
-
$condString .= token_name($condition).',';
|
2451 |
-
}
|
2452 |
-
|
2453 |
-
echo rtrim($condString, ',').';';
|
2454 |
-
}
|
2455 |
-
|
2456 |
-
echo "]: $type => $content".PHP_EOL;
|
2457 |
-
}//end if
|
2458 |
-
|
2459 |
-
$tokens[$i]['level'] = $level;
|
2460 |
-
$tokens[$i]['conditions'] = $conditions;
|
2461 |
-
|
2462 |
-
if (isset($tokens[$i]['scope_condition']) === true) {
|
2463 |
-
// Check to see if this token opened the scope.
|
2464 |
-
if ($tokens[$i]['scope_opener'] === $i) {
|
2465 |
-
$stackPtr = $tokens[$i]['scope_condition'];
|
2466 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2467 |
-
$type = $tokens[$stackPtr]['type'];
|
2468 |
-
echo str_repeat("\t", ($level + 1));
|
2469 |
-
echo "=> Found scope opener for $stackPtr:$type".PHP_EOL;
|
2470 |
-
}
|
2471 |
-
|
2472 |
-
$stackPtr = $tokens[$i]['scope_condition'];
|
2473 |
-
|
2474 |
-
// If we find a scope opener that has a shared closer,
|
2475 |
-
// then we need to go back over the condition map that we
|
2476 |
-
// just created and fix ourselves as we just added some
|
2477 |
-
// conditions where there was none. This happens for T_CASE
|
2478 |
-
// statements that are using the same break statement.
|
2479 |
-
if ($lastOpener !== null && $tokens[$lastOpener]['scope_closer'] === $tokens[$i]['scope_closer']) {
|
2480 |
-
// This opener shares its closer with the previous opener,
|
2481 |
-
// but we still need to check if the two openers share their
|
2482 |
-
// closer with each other directly (like CASE and DEFAULT)
|
2483 |
-
// or if they are just sharing because one doesn't have a
|
2484 |
-
// closer (like CASE with no BREAK using a SWITCHes closer).
|
2485 |
-
$thisType = $tokens[$tokens[$i]['scope_condition']]['code'];
|
2486 |
-
$opener = $tokens[$lastOpener]['scope_condition'];
|
2487 |
-
|
2488 |
-
$isShared = isset($tokenizer->scopeOpeners[$thisType]['with'][$tokens[$opener]['code']]);
|
2489 |
-
|
2490 |
-
reset($tokenizer->scopeOpeners[$thisType]['end']);
|
2491 |
-
reset($tokenizer->scopeOpeners[$tokens[$opener]['code']]['end']);
|
2492 |
-
$sameEnd = (current($tokenizer->scopeOpeners[$thisType]['end']) === current($tokenizer->scopeOpeners[$tokens[$opener]['code']]['end']));
|
2493 |
-
|
2494 |
-
if ($isShared === true && $sameEnd === true) {
|
2495 |
-
$badToken = $opener;
|
2496 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2497 |
-
$type = $tokens[$badToken]['type'];
|
2498 |
-
echo str_repeat("\t", ($level + 1));
|
2499 |
-
echo "* shared closer, cleaning up $badToken:$type *".PHP_EOL;
|
2500 |
-
}
|
2501 |
-
|
2502 |
-
for ($x = $tokens[$i]['scope_condition']; $x <= $i; $x++) {
|
2503 |
-
$oldConditions = $tokens[$x]['conditions'];
|
2504 |
-
$oldLevel = $tokens[$x]['level'];
|
2505 |
-
$tokens[$x]['level']--;
|
2506 |
-
unset($tokens[$x]['conditions'][$badToken]);
|
2507 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2508 |
-
$type = $tokens[$x]['type'];
|
2509 |
-
$oldConds = '';
|
2510 |
-
foreach ($oldConditions as $condition) {
|
2511 |
-
$oldConds .= token_name($condition).',';
|
2512 |
-
}
|
2513 |
-
|
2514 |
-
$oldConds = rtrim($oldConds, ',');
|
2515 |
-
|
2516 |
-
$newConds = '';
|
2517 |
-
foreach ($tokens[$x]['conditions'] as $condition) {
|
2518 |
-
$newConds .= token_name($condition).',';
|
2519 |
-
}
|
2520 |
-
|
2521 |
-
$newConds = rtrim($newConds, ',');
|
2522 |
-
|
2523 |
-
$newLevel = $tokens[$x]['level'];
|
2524 |
-
echo str_repeat("\t", ($level + 1));
|
2525 |
-
echo "* cleaned $x:$type *".PHP_EOL;
|
2526 |
-
echo str_repeat("\t", ($level + 2));
|
2527 |
-
echo "=> level changed from $oldLevel to $newLevel".PHP_EOL;
|
2528 |
-
echo str_repeat("\t", ($level + 2));
|
2529 |
-
echo "=> conditions changed from $oldConds to $newConds".PHP_EOL;
|
2530 |
-
}//end if
|
2531 |
-
}//end for
|
2532 |
-
|
2533 |
-
unset($conditions[$badToken]);
|
2534 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2535 |
-
$type = $tokens[$badToken]['type'];
|
2536 |
-
echo str_repeat("\t", ($level + 1));
|
2537 |
-
echo "* token $badToken:$type removed from conditions array *".PHP_EOL;
|
2538 |
-
}
|
2539 |
-
|
2540 |
-
unset($openers[$lastOpener]);
|
2541 |
-
|
2542 |
-
$level--;
|
2543 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2544 |
-
echo str_repeat("\t", ($level + 2));
|
2545 |
-
echo '* level decreased *'.PHP_EOL;
|
2546 |
-
}
|
2547 |
-
}//end if
|
2548 |
-
}//end if
|
2549 |
-
|
2550 |
-
$level++;
|
2551 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2552 |
-
echo str_repeat("\t", ($level + 1));
|
2553 |
-
echo '* level increased *'.PHP_EOL;
|
2554 |
-
}
|
2555 |
-
|
2556 |
-
$conditions[$stackPtr] = $tokens[$stackPtr]['code'];
|
2557 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2558 |
-
$type = $tokens[$stackPtr]['type'];
|
2559 |
-
echo str_repeat("\t", ($level + 1));
|
2560 |
-
echo "* token $stackPtr:$type added to conditions array *".PHP_EOL;
|
2561 |
-
}
|
2562 |
-
|
2563 |
-
$lastOpener = $tokens[$i]['scope_opener'];
|
2564 |
-
if ($lastOpener !== null) {
|
2565 |
-
$openers[$lastOpener] = $lastOpener;
|
2566 |
-
}
|
2567 |
-
} else if ($lastOpener !== null && $tokens[$lastOpener]['scope_closer'] === $i) {
|
2568 |
-
foreach (array_reverse($openers) as $opener) {
|
2569 |
-
if ($tokens[$opener]['scope_closer'] === $i) {
|
2570 |
-
$oldOpener = array_pop($openers);
|
2571 |
-
if (empty($openers) === false) {
|
2572 |
-
$lastOpener = array_pop($openers);
|
2573 |
-
$openers[$lastOpener] = $lastOpener;
|
2574 |
-
} else {
|
2575 |
-
$lastOpener = null;
|
2576 |
-
}
|
2577 |
-
|
2578 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2579 |
-
$type = $tokens[$oldOpener]['type'];
|
2580 |
-
echo str_repeat("\t", ($level + 1));
|
2581 |
-
echo "=> Found scope closer for $oldOpener:$type".PHP_EOL;
|
2582 |
-
}
|
2583 |
-
|
2584 |
-
$oldCondition = array_pop($conditions);
|
2585 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2586 |
-
echo str_repeat("\t", ($level + 1));
|
2587 |
-
echo '* token '.token_name($oldCondition).' removed from conditions array *'.PHP_EOL;
|
2588 |
-
}
|
2589 |
-
|
2590 |
-
// Make sure this closer actually belongs to us.
|
2591 |
-
// Either the condition also has to think this is the
|
2592 |
-
// closer, or it has to allow sharing with us.
|
2593 |
-
$condition = $tokens[$tokens[$i]['scope_condition']]['code'];
|
2594 |
-
if ($condition !== $oldCondition) {
|
2595 |
-
if (isset($tokenizer->scopeOpeners[$oldCondition]['with'][$condition]) === false) {
|
2596 |
-
$badToken = $tokens[$oldOpener]['scope_condition'];
|
2597 |
-
|
2598 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2599 |
-
$type = token_name($oldCondition);
|
2600 |
-
echo str_repeat("\t", ($level + 1));
|
2601 |
-
echo "* scope closer was bad, cleaning up $badToken:$type *".PHP_EOL;
|
2602 |
-
}
|
2603 |
-
|
2604 |
-
for ($x = ($oldOpener + 1); $x <= $i; $x++) {
|
2605 |
-
$oldConditions = $tokens[$x]['conditions'];
|
2606 |
-
$oldLevel = $tokens[$x]['level'];
|
2607 |
-
$tokens[$x]['level']--;
|
2608 |
-
unset($tokens[$x]['conditions'][$badToken]);
|
2609 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2610 |
-
$type = $tokens[$x]['type'];
|
2611 |
-
$oldConds = '';
|
2612 |
-
foreach ($oldConditions as $condition) {
|
2613 |
-
$oldConds .= token_name($condition).',';
|
2614 |
-
}
|
2615 |
-
|
2616 |
-
$oldConds = rtrim($oldConds, ',');
|
2617 |
-
|
2618 |
-
$newConds = '';
|
2619 |
-
foreach ($tokens[$x]['conditions'] as $condition) {
|
2620 |
-
$newConds .= token_name($condition).',';
|
2621 |
-
}
|
2622 |
-
|
2623 |
-
$newConds = rtrim($newConds, ',');
|
2624 |
-
|
2625 |
-
$newLevel = $tokens[$x]['level'];
|
2626 |
-
echo str_repeat("\t", ($level + 1));
|
2627 |
-
echo "* cleaned $x:$type *".PHP_EOL;
|
2628 |
-
echo str_repeat("\t", ($level + 2));
|
2629 |
-
echo "=> level changed from $oldLevel to $newLevel".PHP_EOL;
|
2630 |
-
echo str_repeat("\t", ($level + 2));
|
2631 |
-
echo "=> conditions changed from $oldConds to $newConds".PHP_EOL;
|
2632 |
-
}//end if
|
2633 |
-
}//end for
|
2634 |
-
}//end if
|
2635 |
-
}//end if
|
2636 |
-
|
2637 |
-
$level--;
|
2638 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2639 |
-
echo str_repeat("\t", ($level + 2));
|
2640 |
-
echo '* level decreased *'.PHP_EOL;
|
2641 |
-
}
|
2642 |
-
|
2643 |
-
$tokens[$i]['level'] = $level;
|
2644 |
-
$tokens[$i]['conditions'] = $conditions;
|
2645 |
-
}//end if
|
2646 |
-
}//end foreach
|
2647 |
-
}//end if
|
2648 |
-
}//end if
|
2649 |
-
}//end for
|
2650 |
-
|
2651 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
2652 |
-
echo "\t*** END LEVEL MAP ***".PHP_EOL;
|
2653 |
-
}
|
2654 |
-
|
2655 |
-
}//end _createLevelMap()
|
2656 |
-
|
2657 |
-
|
2658 |
-
/**
|
2659 |
-
* Returns the declaration names for classes, interfaces, and functions.
|
2660 |
-
*
|
2661 |
-
* @param int $stackPtr The position of the declaration token which
|
2662 |
-
* declared the class, interface, trait or function.
|
2663 |
-
*
|
2664 |
-
* @return string|null The name of the class, interface or function.
|
2665 |
-
* or NULL if the function or class is anonymous.
|
2666 |
-
* @throws PHP_CodeSniffer_Exception If the specified token is not of type
|
2667 |
-
* T_FUNCTION, T_CLASS, T_ANON_CLASS,
|
2668 |
-
* T_TRAIT or T_INTERFACE.
|
2669 |
-
*/
|
2670 |
-
public function getDeclarationName($stackPtr)
|
2671 |
-
{
|
2672 |
-
$tokenCode = $this->_tokens[$stackPtr]['code'];
|
2673 |
-
|
2674 |
-
if ($tokenCode === T_ANON_CLASS) {
|
2675 |
-
return null;
|
2676 |
-
}
|
2677 |
-
|
2678 |
-
if ($tokenCode === T_CLOSURE) {
|
2679 |
-
return null;
|
2680 |
-
}
|
2681 |
-
|
2682 |
-
if ($tokenCode !== T_FUNCTION
|
2683 |
-
&& $tokenCode !== T_CLASS
|
2684 |
-
&& $tokenCode !== T_INTERFACE
|
2685 |
-
&& $tokenCode !== T_TRAIT
|
2686 |
-
) {
|
2687 |
-
throw new PHP_CodeSniffer_Exception('Token type "'.$this->_tokens[$stackPtr]['type'].'" is not T_FUNCTION, T_CLASS, T_INTERFACE or T_TRAIT');
|
2688 |
-
}
|
2689 |
-
|
2690 |
-
$content = null;
|
2691 |
-
for ($i = $stackPtr; $i < $this->numTokens; $i++) {
|
2692 |
-
if ($this->_tokens[$i]['code'] === T_STRING) {
|
2693 |
-
$content = $this->_tokens[$i]['content'];
|
2694 |
-
break;
|
2695 |
-
}
|
2696 |
-
}
|
2697 |
-
|
2698 |
-
return $content;
|
2699 |
-
|
2700 |
-
}//end getDeclarationName()
|
2701 |
-
|
2702 |
-
|
2703 |
-
/**
|
2704 |
-
* Check if the token at the specified position is a anonymous function.
|
2705 |
-
*
|
2706 |
-
* @param int $stackPtr The position of the declaration token which
|
2707 |
-
* declared the class, interface or function.
|
2708 |
-
*
|
2709 |
-
* @return boolean
|
2710 |
-
* @throws PHP_CodeSniffer_Exception If the specified token is not of type
|
2711 |
-
* T_FUNCTION
|
2712 |
-
*/
|
2713 |
-
public function isAnonymousFunction($stackPtr)
|
2714 |
-
{
|
2715 |
-
$tokenCode = $this->_tokens[$stackPtr]['code'];
|
2716 |
-
if ($tokenCode !== T_FUNCTION) {
|
2717 |
-
throw new PHP_CodeSniffer_Exception('Token type is not T_FUNCTION');
|
2718 |
-
}
|
2719 |
-
|
2720 |
-
if (isset($this->_tokens[$stackPtr]['parenthesis_opener']) === false) {
|
2721 |
-
// Something is not right with this function.
|
2722 |
-
return false;
|
2723 |
-
}
|
2724 |
-
|
2725 |
-
$name = false;
|
2726 |
-
for ($i = ($stackPtr + 1); $i < $this->numTokens; $i++) {
|
2727 |
-
if ($this->_tokens[$i]['code'] === T_STRING) {
|
2728 |
-
$name = $i;
|
2729 |
-
break;
|
2730 |
-
}
|
2731 |
-
}
|
2732 |
-
|
2733 |
-
if ($name === false) {
|
2734 |
-
// No name found.
|
2735 |
-
return true;
|
2736 |
-
}
|
2737 |
-
|
2738 |
-
$open = $this->_tokens[$stackPtr]['parenthesis_opener'];
|
2739 |
-
if ($name > $open) {
|
2740 |
-
return true;
|
2741 |
-
}
|
2742 |
-
|
2743 |
-
return false;
|
2744 |
-
|
2745 |
-
}//end isAnonymousFunction()
|
2746 |
-
|
2747 |
-
|
2748 |
-
/**
|
2749 |
-
* Returns the method parameters for the specified function token.
|
2750 |
-
*
|
2751 |
-
* Each parameter is in the following format:
|
2752 |
-
*
|
2753 |
-
* <code>
|
2754 |
-
* 0 => array(
|
2755 |
-
* 'token' => int, // The position of the var in the token stack.
|
2756 |
-
* 'name' => '$var', // The variable name.
|
2757 |
-
* 'content' => string, // The full content of the variable definition.
|
2758 |
-
* 'pass_by_reference' => boolean, // Is the variable passed by reference?
|
2759 |
-
* 'variable_length' => boolean, // Is the param of variable length through use of `...` ?
|
2760 |
-
* 'type_hint' => string, // The type hint for the variable.
|
2761 |
-
* 'nullable_type' => boolean, // Is the variable using a nullable type?
|
2762 |
-
* )
|
2763 |
-
* </code>
|
2764 |
-
*
|
2765 |
-
* Parameters with default values have an additional array index of
|
2766 |
-
* 'default' with the value of the default as a string.
|
2767 |
-
*
|
2768 |
-
* @param int $stackPtr The position in the stack of the function token
|
2769 |
-
* to acquire the parameters for.
|
2770 |
-
*
|
2771 |
-
* @return array
|
2772 |
-
* @throws PHP_CodeSniffer_Exception If the specified $stackPtr is not of
|
2773 |
-
* type T_FUNCTION or T_CLOSURE.
|
2774 |
-
*/
|
2775 |
-
public function getMethodParameters($stackPtr)
|
2776 |
-
{
|
2777 |
-
if ($this->_tokens[$stackPtr]['code'] !== T_FUNCTION
|
2778 |
-
&& $this->_tokens[$stackPtr]['code'] !== T_CLOSURE
|
2779 |
-
) {
|
2780 |
-
throw new PHP_CodeSniffer_Exception('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
|
2781 |
-
}
|
2782 |
-
|
2783 |
-
$opener = $this->_tokens[$stackPtr]['parenthesis_opener'];
|
2784 |
-
$closer = $this->_tokens[$stackPtr]['parenthesis_closer'];
|
2785 |
-
|
2786 |
-
$vars = array();
|
2787 |
-
$currVar = null;
|
2788 |
-
$paramStart = ($opener + 1);
|
2789 |
-
$defaultStart = null;
|
2790 |
-
$paramCount = 0;
|
2791 |
-
$passByReference = false;
|
2792 |
-
$variableLength = false;
|
2793 |
-
$typeHint = '';
|
2794 |
-
$nullableType = false;
|
2795 |
-
|
2796 |
-
for ($i = $paramStart; $i <= $closer; $i++) {
|
2797 |
-
// Check to see if this token has a parenthesis or bracket opener. If it does
|
2798 |
-
// it's likely to be an array which might have arguments in it. This
|
2799 |
-
// could cause problems in our parsing below, so lets just skip to the
|
2800 |
-
// end of it.
|
2801 |
-
if (isset($this->_tokens[$i]['parenthesis_opener']) === true) {
|
2802 |
-
// Don't do this if it's the close parenthesis for the method.
|
2803 |
-
if ($i !== $this->_tokens[$i]['parenthesis_closer']) {
|
2804 |
-
$i = ($this->_tokens[$i]['parenthesis_closer'] + 1);
|
2805 |
-
}
|
2806 |
-
}
|
2807 |
-
|
2808 |
-
if (isset($this->_tokens[$i]['bracket_opener']) === true) {
|
2809 |
-
// Don't do this if it's the close parenthesis for the method.
|
2810 |
-
if ($i !== $this->_tokens[$i]['bracket_closer']) {
|
2811 |
-
$i = ($this->_tokens[$i]['bracket_closer'] + 1);
|
2812 |
-
}
|
2813 |
-
}
|
2814 |
-
|
2815 |
-
switch ($this->_tokens[$i]['code']) {
|
2816 |
-
case T_BITWISE_AND:
|
2817 |
-
$passByReference = true;
|
2818 |
-
break;
|
2819 |
-
case T_VARIABLE:
|
2820 |
-
$currVar = $i;
|
2821 |
-
break;
|
2822 |
-
case T_ELLIPSIS:
|
2823 |
-
$variableLength = true;
|
2824 |
-
break;
|
2825 |
-
case T_ARRAY_HINT:
|
2826 |
-
case T_CALLABLE:
|
2827 |
-
$typeHint .= $this->_tokens[$i]['content'];
|
2828 |
-
break;
|
2829 |
-
case T_SELF:
|
2830 |
-
case T_PARENT:
|
2831 |
-
case T_STATIC:
|
2832 |
-
// Self is valid, the others invalid, but were probably intended as type hints.
|
2833 |
-
if (isset($defaultStart) === false) {
|
2834 |
-
$typeHint .= $this->_tokens[$i]['content'];
|
2835 |
-
}
|
2836 |
-
break;
|
2837 |
-
case T_STRING:
|
2838 |
-
// This is a string, so it may be a type hint, but it could
|
2839 |
-
// also be a constant used as a default value.
|
2840 |
-
$prevComma = false;
|
2841 |
-
for ($t = $i; $t >= $opener; $t--) {
|
2842 |
-
if ($this->_tokens[$t]['code'] === T_COMMA) {
|
2843 |
-
$prevComma = $t;
|
2844 |
-
break;
|
2845 |
-
}
|
2846 |
-
}
|
2847 |
-
|
2848 |
-
if ($prevComma !== false) {
|
2849 |
-
$nextEquals = false;
|
2850 |
-
for ($t = $prevComma; $t < $i; $t++) {
|
2851 |
-
if ($this->_tokens[$t]['code'] === T_EQUAL) {
|
2852 |
-
$nextEquals = $t;
|
2853 |
-
break;
|
2854 |
-
}
|
2855 |
-
}
|
2856 |
-
|
2857 |
-
if ($nextEquals !== false) {
|
2858 |
-
break;
|
2859 |
-
}
|
2860 |
-
}
|
2861 |
-
|
2862 |
-
if ($defaultStart === null) {
|
2863 |
-
$typeHint .= $this->_tokens[$i]['content'];
|
2864 |
-
}
|
2865 |
-
break;
|
2866 |
-
case T_NS_SEPARATOR:
|
2867 |
-
// Part of a type hint or default value.
|
2868 |
-
if ($defaultStart === null) {
|
2869 |
-
$typeHint .= $this->_tokens[$i]['content'];
|
2870 |
-
}
|
2871 |
-
break;
|
2872 |
-
case T_NULLABLE:
|
2873 |
-
if ($defaultStart === null) {
|
2874 |
-
$nullableType = true;
|
2875 |
-
$typeHint .= $this->_tokens[$i]['content'];
|
2876 |
-
}
|
2877 |
-
break;
|
2878 |
-
case T_CLOSE_PARENTHESIS:
|
2879 |
-
case T_COMMA:
|
2880 |
-
// If it's null, then there must be no parameters for this
|
2881 |
-
// method.
|
2882 |
-
if ($currVar === null) {
|
2883 |
-
continue;
|
2884 |
-
}
|
2885 |
-
|
2886 |
-
$vars[$paramCount] = array();
|
2887 |
-
$vars[$paramCount]['token'] = $currVar;
|
2888 |
-
$vars[$paramCount]['name'] = $this->_tokens[$currVar]['content'];
|
2889 |
-
$vars[$paramCount]['content'] = trim($this->getTokensAsString($paramStart, ($i - $paramStart)));
|
2890 |
-
|
2891 |
-
if ($defaultStart !== null) {
|
2892 |
-
$vars[$paramCount]['default'] = trim($this->getTokensAsString($defaultStart, ($i - $defaultStart)));
|
2893 |
-
}
|
2894 |
-
|
2895 |
-
$vars[$paramCount]['pass_by_reference'] = $passByReference;
|
2896 |
-
$vars[$paramCount]['variable_length'] = $variableLength;
|
2897 |
-
$vars[$paramCount]['type_hint'] = $typeHint;
|
2898 |
-
$vars[$paramCount]['nullable_type'] = $nullableType;
|
2899 |
-
|
2900 |
-
// Reset the vars, as we are about to process the next parameter.
|
2901 |
-
$defaultStart = null;
|
2902 |
-
$paramStart = ($i + 1);
|
2903 |
-
$passByReference = false;
|
2904 |
-
$variableLength = false;
|
2905 |
-
$typeHint = '';
|
2906 |
-
$nullableType = false;
|
2907 |
-
|
2908 |
-
$paramCount++;
|
2909 |
-
break;
|
2910 |
-
case T_EQUAL:
|
2911 |
-
$defaultStart = ($i + 1);
|
2912 |
-
break;
|
2913 |
-
}//end switch
|
2914 |
-
}//end for
|
2915 |
-
|
2916 |
-
return $vars;
|
2917 |
-
|
2918 |
-
}//end getMethodParameters()
|
2919 |
-
|
2920 |
-
|
2921 |
-
/**
|
2922 |
-
* Returns the visibility and implementation properties of a method.
|
2923 |
-
*
|
2924 |
-
* The format of the array is:
|
2925 |
-
* <code>
|
2926 |
-
* array(
|
2927 |
-
* 'scope' => 'public', // public private or protected
|
2928 |
-
* 'scope_specified' => true, // true is scope keyword was found.
|
2929 |
-
* 'is_abstract' => false, // true if the abstract keyword was found.
|
2930 |
-
* 'is_final' => false, // true if the final keyword was found.
|
2931 |
-
* 'is_static' => false, // true if the static keyword was found.
|
2932 |
-
* 'is_closure' => false, // true if no name is found.
|
2933 |
-
* );
|
2934 |
-
* </code>
|
2935 |
-
*
|
2936 |
-
* @param int $stackPtr The position in the stack of the T_FUNCTION token to
|
2937 |
-
* acquire the properties for.
|
2938 |
-
*
|
2939 |
-
* @return array
|
2940 |
-
* @throws PHP_CodeSniffer_Exception If the specified position is not a
|
2941 |
-
* T_FUNCTION token.
|
2942 |
-
*/
|
2943 |
-
public function getMethodProperties($stackPtr)
|
2944 |
-
{
|
2945 |
-
if ($this->_tokens[$stackPtr]['code'] !== T_FUNCTION) {
|
2946 |
-
throw new PHP_CodeSniffer_Exception('$stackPtr must be of type T_FUNCTION');
|
2947 |
-
}
|
2948 |
-
|
2949 |
-
$valid = array(
|
2950 |
-
T_PUBLIC => T_PUBLIC,
|
2951 |
-
T_PRIVATE => T_PRIVATE,
|
2952 |
-
T_PROTECTED => T_PROTECTED,
|
2953 |
-
T_STATIC => T_STATIC,
|
2954 |
-
T_FINAL => T_FINAL,
|
2955 |
-
T_ABSTRACT => T_ABSTRACT,
|
2956 |
-
T_WHITESPACE => T_WHITESPACE,
|
2957 |
-
T_COMMENT => T_COMMENT,
|
2958 |
-
T_DOC_COMMENT => T_DOC_COMMENT,
|
2959 |
-
);
|
2960 |
-
|
2961 |
-
$scope = 'public';
|
2962 |
-
$scopeSpecified = false;
|
2963 |
-
$isAbstract = false;
|
2964 |
-
$isFinal = false;
|
2965 |
-
$isStatic = false;
|
2966 |
-
$isClosure = $this->isAnonymousFunction($stackPtr);
|
2967 |
-
|
2968 |
-
for ($i = ($stackPtr - 1); $i > 0; $i--) {
|
2969 |
-
if (isset($valid[$this->_tokens[$i]['code']]) === false) {
|
2970 |
-
break;
|
2971 |
-
}
|
2972 |
-
|
2973 |
-
switch ($this->_tokens[$i]['code']) {
|
2974 |
-
case T_PUBLIC:
|
2975 |
-
$scope = 'public';
|
2976 |
-
$scopeSpecified = true;
|
2977 |
-
break;
|
2978 |
-
case T_PRIVATE:
|
2979 |
-
$scope = 'private';
|
2980 |
-
$scopeSpecified = true;
|
2981 |
-
break;
|
2982 |
-
case T_PROTECTED:
|
2983 |
-
$scope = 'protected';
|
2984 |
-
$scopeSpecified = true;
|
2985 |
-
break;
|
2986 |
-
case T_ABSTRACT:
|
2987 |
-
$isAbstract = true;
|
2988 |
-
break;
|
2989 |
-
case T_FINAL:
|
2990 |
-
$isFinal = true;
|
2991 |
-
break;
|
2992 |
-
case T_STATIC:
|
2993 |
-
$isStatic = true;
|
2994 |
-
break;
|
2995 |
-
}//end switch
|
2996 |
-
}//end for
|
2997 |
-
|
2998 |
-
return array(
|
2999 |
-
'scope' => $scope,
|
3000 |
-
'scope_specified' => $scopeSpecified,
|
3001 |
-
'is_abstract' => $isAbstract,
|
3002 |
-
'is_final' => $isFinal,
|
3003 |
-
'is_static' => $isStatic,
|
3004 |
-
'is_closure' => $isClosure,
|
3005 |
-
);
|
3006 |
-
|
3007 |
-
}//end getMethodProperties()
|
3008 |
-
|
3009 |
-
|
3010 |
-
/**
|
3011 |
-
* Returns the visibility and implementation properties of the class member
|
3012 |
-
* variable found at the specified position in the stack.
|
3013 |
-
*
|
3014 |
-
* The format of the array is:
|
3015 |
-
*
|
3016 |
-
* <code>
|
3017 |
-
* array(
|
3018 |
-
* 'scope' => 'public', // public private or protected
|
3019 |
-
* 'is_static' => false, // true if the static keyword was found.
|
3020 |
-
* );
|
3021 |
-
* </code>
|
3022 |
-
*
|
3023 |
-
* @param int $stackPtr The position in the stack of the T_VARIABLE token to
|
3024 |
-
* acquire the properties for.
|
3025 |
-
*
|
3026 |
-
* @return array
|
3027 |
-
* @throws PHP_CodeSniffer_Exception If the specified position is not a
|
3028 |
-
* T_VARIABLE token, or if the position is not
|
3029 |
-
* a class member variable.
|
3030 |
-
*/
|
3031 |
-
public function getMemberProperties($stackPtr)
|
3032 |
-
{
|
3033 |
-
if ($this->_tokens[$stackPtr]['code'] !== T_VARIABLE) {
|
3034 |
-
throw new PHP_CodeSniffer_Exception('$stackPtr must be of type T_VARIABLE');
|
3035 |
-
}
|
3036 |
-
|
3037 |
-
$conditions = array_keys($this->_tokens[$stackPtr]['conditions']);
|
3038 |
-
$ptr = array_pop($conditions);
|
3039 |
-
if (isset($this->_tokens[$ptr]) === false
|
3040 |
-
|| ($this->_tokens[$ptr]['code'] !== T_CLASS
|
3041 |
-
&& $this->_tokens[$ptr]['code'] !== T_ANON_CLASS
|
3042 |
-
&& $this->_tokens[$ptr]['code'] !== T_TRAIT)
|
3043 |
-
) {
|
3044 |
-
if (isset($this->_tokens[$ptr]) === true
|
3045 |
-
&& $this->_tokens[$ptr]['code'] === T_INTERFACE
|
3046 |
-
) {
|
3047 |
-
// T_VARIABLEs in interfaces can actually be method arguments
|
3048 |
-
// but they wont be seen as being inside the method because there
|
3049 |
-
// are no scope openers and closers for abstract methods. If it is in
|
3050 |
-
// parentheses, we can be pretty sure it is a method argument.
|
3051 |
-
if (isset($this->_tokens[$stackPtr]['nested_parenthesis']) === false
|
3052 |
-
|| empty($this->_tokens[$stackPtr]['nested_parenthesis']) === true
|
3053 |
-
) {
|
3054 |
-
$error = 'Possible parse error: interfaces may not include member vars';
|
3055 |
-
$this->addWarning($error, $stackPtr, 'Internal.ParseError.InterfaceHasMemberVar');
|
3056 |
-
return array();
|
3057 |
-
}
|
3058 |
-
} else {
|
3059 |
-
throw new PHP_CodeSniffer_Exception('$stackPtr is not a class member var');
|
3060 |
-
}
|
3061 |
-
}
|
3062 |
-
|
3063 |
-
$valid = array(
|
3064 |
-
T_PUBLIC => T_PUBLIC,
|
3065 |
-
T_PRIVATE => T_PRIVATE,
|
3066 |
-
T_PROTECTED => T_PROTECTED,
|
3067 |
-
T_STATIC => T_STATIC,
|
3068 |
-
T_WHITESPACE => T_WHITESPACE,
|
3069 |
-
T_COMMENT => T_COMMENT,
|
3070 |
-
T_DOC_COMMENT => T_DOC_COMMENT,
|
3071 |
-
T_VARIABLE => T_VARIABLE,
|
3072 |
-
T_COMMA => T_COMMA,
|
3073 |
-
);
|
3074 |
-
|
3075 |
-
$scope = 'public';
|
3076 |
-
$scopeSpecified = false;
|
3077 |
-
$isStatic = false;
|
3078 |
-
|
3079 |
-
for ($i = ($stackPtr - 1); $i > 0; $i--) {
|
3080 |
-
if (isset($valid[$this->_tokens[$i]['code']]) === false) {
|
3081 |
-
break;
|
3082 |
-
}
|
3083 |
-
|
3084 |
-
switch ($this->_tokens[$i]['code']) {
|
3085 |
-
case T_PUBLIC:
|
3086 |
-
$scope = 'public';
|
3087 |
-
$scopeSpecified = true;
|
3088 |
-
break;
|
3089 |
-
case T_PRIVATE:
|
3090 |
-
$scope = 'private';
|
3091 |
-
$scopeSpecified = true;
|
3092 |
-
break;
|
3093 |
-
case T_PROTECTED:
|
3094 |
-
$scope = 'protected';
|
3095 |
-
$scopeSpecified = true;
|
3096 |
-
break;
|
3097 |
-
case T_STATIC:
|
3098 |
-
$isStatic = true;
|
3099 |
-
break;
|
3100 |
-
}
|
3101 |
-
}//end for
|
3102 |
-
|
3103 |
-
return array(
|
3104 |
-
'scope' => $scope,
|
3105 |
-
'scope_specified' => $scopeSpecified,
|
3106 |
-
'is_static' => $isStatic,
|
3107 |
-
);
|
3108 |
-
|
3109 |
-
}//end getMemberProperties()
|
3110 |
-
|
3111 |
-
|
3112 |
-
/**
|
3113 |
-
* Returns the visibility and implementation properties of a class.
|
3114 |
-
*
|
3115 |
-
* The format of the array is:
|
3116 |
-
* <code>
|
3117 |
-
* array(
|
3118 |
-
* 'is_abstract' => false, // true if the abstract keyword was found.
|
3119 |
-
* 'is_final' => false, // true if the final keyword was found.
|
3120 |
-
* );
|
3121 |
-
* </code>
|
3122 |
-
*
|
3123 |
-
* @param int $stackPtr The position in the stack of the T_CLASS token to
|
3124 |
-
* acquire the properties for.
|
3125 |
-
*
|
3126 |
-
* @return array
|
3127 |
-
* @throws PHP_CodeSniffer_Exception If the specified position is not a
|
3128 |
-
* T_CLASS token.
|
3129 |
-
*/
|
3130 |
-
public function getClassProperties($stackPtr)
|
3131 |
-
{
|
3132 |
-
if ($this->_tokens[$stackPtr]['code'] !== T_CLASS) {
|
3133 |
-
throw new PHP_CodeSniffer_Exception('$stackPtr must be of type T_CLASS');
|
3134 |
-
}
|
3135 |
-
|
3136 |
-
$valid = array(
|
3137 |
-
T_FINAL => T_FINAL,
|
3138 |
-
T_ABSTRACT => T_ABSTRACT,
|
3139 |
-
T_WHITESPACE => T_WHITESPACE,
|
3140 |
-
T_COMMENT => T_COMMENT,
|
3141 |
-
T_DOC_COMMENT => T_DOC_COMMENT,
|
3142 |
-
);
|
3143 |
-
|
3144 |
-
$isAbstract = false;
|
3145 |
-
$isFinal = false;
|
3146 |
-
|
3147 |
-
for ($i = ($stackPtr - 1); $i > 0; $i--) {
|
3148 |
-
if (isset($valid[$this->_tokens[$i]['code']]) === false) {
|
3149 |
-
break;
|
3150 |
-
}
|
3151 |
-
|
3152 |
-
switch ($this->_tokens[$i]['code']) {
|
3153 |
-
case T_ABSTRACT:
|
3154 |
-
$isAbstract = true;
|
3155 |
-
break;
|
3156 |
-
|
3157 |
-
case T_FINAL:
|
3158 |
-
$isFinal = true;
|
3159 |
-
break;
|
3160 |
-
}
|
3161 |
-
}//end for
|
3162 |
-
|
3163 |
-
return array(
|
3164 |
-
'is_abstract' => $isAbstract,
|
3165 |
-
'is_final' => $isFinal,
|
3166 |
-
);
|
3167 |
-
|
3168 |
-
}//end getClassProperties()
|
3169 |
-
|
3170 |
-
|
3171 |
-
/**
|
3172 |
-
* Determine if the passed token is a reference operator.
|
3173 |
-
*
|
3174 |
-
* Returns true if the specified token position represents a reference.
|
3175 |
-
* Returns false if the token represents a bitwise operator.
|
3176 |
-
*
|
3177 |
-
* @param int $stackPtr The position of the T_BITWISE_AND token.
|
3178 |
-
*
|
3179 |
-
* @return boolean
|
3180 |
-
*/
|
3181 |
-
public function isReference($stackPtr)
|
3182 |
-
{
|
3183 |
-
if ($this->_tokens[$stackPtr]['code'] !== T_BITWISE_AND) {
|
3184 |
-
return false;
|
3185 |
-
}
|
3186 |
-
|
3187 |
-
$tokenBefore = $this->findPrevious(
|
3188 |
-
PHP_CodeSniffer_Tokens::$emptyTokens,
|
3189 |
-
($stackPtr - 1),
|
3190 |
-
null,
|
3191 |
-
true
|
3192 |
-
);
|
3193 |
-
|
3194 |
-
if ($this->_tokens[$tokenBefore]['code'] === T_FUNCTION) {
|
3195 |
-
// Function returns a reference.
|
3196 |
-
return true;
|
3197 |
-
}
|
3198 |
-
|
3199 |
-
if ($this->_tokens[$tokenBefore]['code'] === T_DOUBLE_ARROW) {
|
3200 |
-
// Inside a foreach loop, this is a reference.
|
3201 |
-
return true;
|
3202 |
-
}
|
3203 |
-
|
3204 |
-
if ($this->_tokens[$tokenBefore]['code'] === T_AS) {
|
3205 |
-
// Inside a foreach loop, this is a reference.
|
3206 |
-
return true;
|
3207 |
-
}
|
3208 |
-
|
3209 |
-
if ($this->_tokens[$tokenBefore]['code'] === T_OPEN_SHORT_ARRAY) {
|
3210 |
-
// Inside an array declaration, this is a reference.
|
3211 |
-
return true;
|
3212 |
-
}
|
3213 |
-
|
3214 |
-
if (isset(PHP_CodeSniffer_Tokens::$assignmentTokens[$this->_tokens[$tokenBefore]['code']]) === true) {
|
3215 |
-
// This is directly after an assignment. It's a reference. Even if
|
3216 |
-
// it is part of an operation, the other tests will handle it.
|
3217 |
-
return true;
|
3218 |
-
}
|
3219 |
-
|
3220 |
-
if (isset($this->_tokens[$stackPtr]['nested_parenthesis']) === true) {
|
3221 |
-
$brackets = $this->_tokens[$stackPtr]['nested_parenthesis'];
|
3222 |
-
$lastBracket = array_pop($brackets);
|
3223 |
-
if (isset($this->_tokens[$lastBracket]['parenthesis_owner']) === true) {
|
3224 |
-
$owner = $this->_tokens[$this->_tokens[$lastBracket]['parenthesis_owner']];
|
3225 |
-
if ($owner['code'] === T_FUNCTION
|
3226 |
-
|| $owner['code'] === T_CLOSURE
|
3227 |
-
|| $owner['code'] === T_ARRAY
|
3228 |
-
) {
|
3229 |
-
// Inside a function or array declaration, this is a reference.
|
3230 |
-
return true;
|
3231 |
-
}
|
3232 |
-
} else {
|
3233 |
-
$prev = false;
|
3234 |
-
for ($t = ($this->_tokens[$lastBracket]['parenthesis_opener'] - 1); $t >= 0; $t--) {
|
3235 |
-
if ($this->_tokens[$t]['code'] !== T_WHITESPACE) {
|
3236 |
-
$prev = $t;
|
3237 |
-
break;
|
3238 |
-
}
|
3239 |
-
}
|
3240 |
-
|
3241 |
-
if ($prev !== false && $this->_tokens[$prev]['code'] === T_USE) {
|
3242 |
-
return true;
|
3243 |
-
}
|
3244 |
-
}//end if
|
3245 |
-
}//end if
|
3246 |
-
|
3247 |
-
$tokenAfter = $this->findNext(
|
3248 |
-
PHP_CodeSniffer_Tokens::$emptyTokens,
|
3249 |
-
($stackPtr + 1),
|
3250 |
-
null,
|
3251 |
-
true
|
3252 |
-
);
|
3253 |
-
|
3254 |
-
if ($this->_tokens[$tokenAfter]['code'] === T_VARIABLE
|
3255 |
-
&& ($this->_tokens[$tokenBefore]['code'] === T_OPEN_PARENTHESIS
|
3256 |
-
|| $this->_tokens[$tokenBefore]['code'] === T_COMMA)
|
3257 |
-
) {
|
3258 |
-
return true;
|
3259 |
-
}
|
3260 |
-
|
3261 |
-
return false;
|
3262 |
-
|
3263 |
-
}//end isReference()
|
3264 |
-
|
3265 |
-
|
3266 |
-
/**
|
3267 |
-
* Returns the content of the tokens from the specified start position in
|
3268 |
-
* the token stack for the specified length.
|
3269 |
-
*
|
3270 |
-
* @param int $start The position to start from in the token stack.
|
3271 |
-
* @param int $length The length of tokens to traverse from the start pos.
|
3272 |
-
*
|
3273 |
-
* @return string The token contents.
|
3274 |
-
*/
|
3275 |
-
public function getTokensAsString($start, $length)
|
3276 |
-
{
|
3277 |
-
$str = '';
|
3278 |
-
$end = ($start + $length);
|
3279 |
-
if ($end > $this->numTokens) {
|
3280 |
-
$end = $this->numTokens;
|
3281 |
-
}
|
3282 |
-
|
3283 |
-
for ($i = $start; $i < $end; $i++) {
|
3284 |
-
$str .= $this->_tokens[$i]['content'];
|
3285 |
-
}
|
3286 |
-
|
3287 |
-
return $str;
|
3288 |
-
|
3289 |
-
}//end getTokensAsString()
|
3290 |
-
|
3291 |
-
|
3292 |
-
/**
|
3293 |
-
* Returns the position of the previous specified token(s).
|
3294 |
-
*
|
3295 |
-
* If a value is specified, the previous token of the specified type(s)
|
3296 |
-
* containing the specified value will be returned.
|
3297 |
-
*
|
3298 |
-
* Returns false if no token can be found.
|
3299 |
-
*
|
3300 |
-
* @param int|array $types The type(s) of tokens to search for.
|
3301 |
-
* @param int $start The position to start searching from in the
|
3302 |
-
* token stack.
|
3303 |
-
* @param int $end The end position to fail if no token is found.
|
3304 |
-
* if not specified or null, end will default to
|
3305 |
-
* the start of the token stack.
|
3306 |
-
* @param bool $exclude If true, find the previous token that are NOT of
|
3307 |
-
* the types specified in $types.
|
3308 |
-
* @param string $value The value that the token(s) must be equal to.
|
3309 |
-
* If value is omitted, tokens with any value will
|
3310 |
-
* be returned.
|
3311 |
-
* @param bool $local If true, tokens outside the current statement
|
3312 |
-
* will not be checked. IE. checking will stop
|
3313 |
-
* at the previous semi-colon found.
|
3314 |
-
*
|
3315 |
-
* @return int|bool
|
3316 |
-
* @see findNext()
|
3317 |
-
*/
|
3318 |
-
public function findPrevious(
|
3319 |
-
$types,
|
3320 |
-
$start,
|
3321 |
-
$end=null,
|
3322 |
-
$exclude=false,
|
3323 |
-
$value=null,
|
3324 |
-
$local=false
|
3325 |
-
) {
|
3326 |
-
$types = (array) $types;
|
3327 |
-
|
3328 |
-
if ($end === null) {
|
3329 |
-
$end = 0;
|
3330 |
-
}
|
3331 |
-
|
3332 |
-
for ($i = $start; $i >= $end; $i--) {
|
3333 |
-
$found = (bool) $exclude;
|
3334 |
-
foreach ($types as $type) {
|
3335 |
-
if ($this->_tokens[$i]['code'] === $type) {
|
3336 |
-
$found = !$exclude;
|
3337 |
-
break;
|
3338 |
-
}
|
3339 |
-
}
|
3340 |
-
|
3341 |
-
if ($found === true) {
|
3342 |
-
if ($value === null) {
|
3343 |
-
return $i;
|
3344 |
-
} else if ($this->_tokens[$i]['content'] === $value) {
|
3345 |
-
return $i;
|
3346 |
-
}
|
3347 |
-
}
|
3348 |
-
|
3349 |
-
if ($local === true) {
|
3350 |
-
if (isset($this->_tokens[$i]['scope_opener']) === true
|
3351 |
-
&& $i === $this->_tokens[$i]['scope_closer']
|
3352 |
-
) {
|
3353 |
-
$i = $this->_tokens[$i]['scope_opener'];
|
3354 |
-
} else if (isset($this->_tokens[$i]['bracket_opener']) === true
|
3355 |
-
&& $i === $this->_tokens[$i]['bracket_closer']
|
3356 |
-
) {
|
3357 |
-
$i = $this->_tokens[$i]['bracket_opener'];
|
3358 |
-
} else if (isset($this->_tokens[$i]['parenthesis_opener']) === true
|
3359 |
-
&& $i === $this->_tokens[$i]['parenthesis_closer']
|
3360 |
-
) {
|
3361 |
-
$i = $this->_tokens[$i]['parenthesis_opener'];
|
3362 |
-
} else if ($this->_tokens[$i]['code'] === T_SEMICOLON) {
|
3363 |
-
break;
|
3364 |
-
}
|
3365 |
-
}
|
3366 |
-
}//end for
|
3367 |
-
|
3368 |
-
return false;
|
3369 |
-
|
3370 |
-
}//end findPrevious()
|
3371 |
-
|
3372 |
-
|
3373 |
-
/**
|
3374 |
-
* Returns the position of the next specified token(s).
|
3375 |
-
*
|
3376 |
-
* If a value is specified, the next token of the specified type(s)
|
3377 |
-
* containing the specified value will be returned.
|
3378 |
-
*
|
3379 |
-
* Returns false if no token can be found.
|
3380 |
-
*
|
3381 |
-
* @param int|array $types The type(s) of tokens to search for.
|
3382 |
-
* @param int $start The position to start searching from in the
|
3383 |
-
* token stack.
|
3384 |
-
* @param int $end The end position to fail if no token is found.
|
3385 |
-
* if not specified or null, end will default to
|
3386 |
-
* the end of the token stack.
|
3387 |
-
* @param bool $exclude If true, find the next token that is NOT of
|
3388 |
-
* a type specified in $types.
|
3389 |
-
* @param string $value The value that the token(s) must be equal to.
|
3390 |
-
* If value is omitted, tokens with any value will
|
3391 |
-
* be returned.
|
3392 |
-
* @param bool $local If true, tokens outside the current statement
|
3393 |
-
* will not be checked. i.e., checking will stop
|
3394 |
-
* at the next semi-colon found.
|
3395 |
-
*
|
3396 |
-
* @return int|bool
|
3397 |
-
* @see findPrevious()
|
3398 |
-
*/
|
3399 |
-
public function findNext(
|
3400 |
-
$types,
|
3401 |
-
$start,
|
3402 |
-
$end=null,
|
3403 |
-
$exclude=false,
|
3404 |
-
$value=null,
|
3405 |
-
$local=false
|
3406 |
-
) {
|
3407 |
-
$types = (array) $types;
|
3408 |
-
|
3409 |
-
if ($end === null || $end > $this->numTokens) {
|
3410 |
-
$end = $this->numTokens;
|
3411 |
-
}
|
3412 |
-
|
3413 |
-
for ($i = $start; $i < $end; $i++) {
|
3414 |
-
$found = (bool) $exclude;
|
3415 |
-
foreach ($types as $type) {
|
3416 |
-
if ($this->_tokens[$i]['code'] === $type) {
|
3417 |
-
$found = !$exclude;
|
3418 |
-
break;
|
3419 |
-
}
|
3420 |
-
}
|
3421 |
-
|
3422 |
-
if ($found === true) {
|
3423 |
-
if ($value === null) {
|
3424 |
-
return $i;
|
3425 |
-
} else if ($this->_tokens[$i]['content'] === $value) {
|
3426 |
-
return $i;
|
3427 |
-
}
|
3428 |
-
}
|
3429 |
-
|
3430 |
-
if ($local === true && $this->_tokens[$i]['code'] === T_SEMICOLON) {
|
3431 |
-
break;
|
3432 |
-
}
|
3433 |
-
}//end for
|
3434 |
-
|
3435 |
-
return false;
|
3436 |
-
|
3437 |
-
}//end findNext()
|
3438 |
-
|
3439 |
-
|
3440 |
-
/**
|
3441 |
-
* Returns the position of the first non-whitespace token in a statement.
|
3442 |
-
*
|
3443 |
-
* @param int $start The position to start searching from in the token stack.
|
3444 |
-
* @param int|array $ignore Token types that should not be considered stop points.
|
3445 |
-
*
|
3446 |
-
* @return int
|
3447 |
-
*/
|
3448 |
-
public function findStartOfStatement($start, $ignore=null)
|
3449 |
-
{
|
3450 |
-
$endTokens = PHP_CodeSniffer_Tokens::$blockOpeners;
|
3451 |
-
|
3452 |
-
$endTokens[T_COLON] = true;
|
3453 |
-
$endTokens[T_COMMA] = true;
|
3454 |
-
$endTokens[T_DOUBLE_ARROW] = true;
|
3455 |
-
$endTokens[T_SEMICOLON] = true;
|
3456 |
-
$endTokens[T_OPEN_TAG] = true;
|
3457 |
-
$endTokens[T_CLOSE_TAG] = true;
|
3458 |
-
$endTokens[T_OPEN_SHORT_ARRAY] = true;
|
3459 |
-
|
3460 |
-
if ($ignore !== null) {
|
3461 |
-
$ignore = (array) $ignore;
|
3462 |
-
foreach ($ignore as $code) {
|
3463 |
-
if (isset($endTokens[$code]) === true) {
|
3464 |
-
unset($endTokens[$code]);
|
3465 |
-
}
|
3466 |
-
}
|
3467 |
-
}
|
3468 |
-
|
3469 |
-
$lastNotEmpty = $start;
|
3470 |
-
|
3471 |
-
for ($i = $start; $i >= 0; $i--) {
|
3472 |
-
if (isset($endTokens[$this->_tokens[$i]['code']]) === true) {
|
3473 |
-
// Found the end of the previous statement.
|
3474 |
-
return $lastNotEmpty;
|
3475 |
-
}
|
3476 |
-
|
3477 |
-
if (isset($this->_tokens[$i]['scope_opener']) === true
|
3478 |
-
&& $i === $this->_tokens[$i]['scope_closer']
|
3479 |
-
) {
|
3480 |
-
// Found the end of the previous scope block.
|
3481 |
-
return $lastNotEmpty;
|
3482 |
-
}
|
3483 |
-
|
3484 |
-
// Skip nested statements.
|
3485 |
-
if (isset($this->_tokens[$i]['bracket_opener']) === true
|
3486 |
-
&& $i === $this->_tokens[$i]['bracket_closer']
|
3487 |
-
) {
|
3488 |
-
$i = $this->_tokens[$i]['bracket_opener'];
|
3489 |
-
} else if (isset($this->_tokens[$i]['parenthesis_opener']) === true
|
3490 |
-
&& $i === $this->_tokens[$i]['parenthesis_closer']
|
3491 |
-
) {
|
3492 |
-
$i = $this->_tokens[$i]['parenthesis_opener'];
|
3493 |
-
}
|
3494 |
-
|
3495 |
-
if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$this->_tokens[$i]['code']]) === false) {
|
3496 |
-
$lastNotEmpty = $i;
|
3497 |
-
}
|
3498 |
-
}//end for
|
3499 |
-
|
3500 |
-
return 0;
|
3501 |
-
|
3502 |
-
}//end findStartOfStatement()
|
3503 |
-
|
3504 |
-
|
3505 |
-
/**
|
3506 |
-
* Returns the position of the last non-whitespace token in a statement.
|
3507 |
-
*
|
3508 |
-
* @param int $start The position to start searching from in the token stack.
|
3509 |
-
* @param int|array $ignore Token types that should not be considered stop points.
|
3510 |
-
*
|
3511 |
-
* @return int
|
3512 |
-
*/
|
3513 |
-
public function findEndOfStatement($start, $ignore=null)
|
3514 |
-
{
|
3515 |
-
$endTokens = array(
|
3516 |
-
T_COLON => true,
|
3517 |
-
T_COMMA => true,
|
3518 |
-
T_DOUBLE_ARROW => true,
|
3519 |
-
T_SEMICOLON => true,
|
3520 |
-
T_CLOSE_PARENTHESIS => true,
|
3521 |
-
T_CLOSE_SQUARE_BRACKET => true,
|
3522 |
-
T_CLOSE_CURLY_BRACKET => true,
|
3523 |
-
T_CLOSE_SHORT_ARRAY => true,
|
3524 |
-
T_OPEN_TAG => true,
|
3525 |
-
T_CLOSE_TAG => true,
|
3526 |
-
);
|
3527 |
-
|
3528 |
-
if ($ignore !== null) {
|
3529 |
-
$ignore = (array) $ignore;
|
3530 |
-
foreach ($ignore as $code) {
|
3531 |
-
if (isset($endTokens[$code]) === true) {
|
3532 |
-
unset($endTokens[$code]);
|
3533 |
-
}
|
3534 |
-
}
|
3535 |
-
}
|
3536 |
-
|
3537 |
-
$lastNotEmpty = $start;
|
3538 |
-
|
3539 |
-
for ($i = $start; $i < $this->numTokens; $i++) {
|
3540 |
-
if ($i !== $start && isset($endTokens[$this->_tokens[$i]['code']]) === true) {
|
3541 |
-
// Found the end of the statement.
|
3542 |
-
if ($this->_tokens[$i]['code'] === T_CLOSE_PARENTHESIS
|
3543 |
-
|| $this->_tokens[$i]['code'] === T_CLOSE_SQUARE_BRACKET
|
3544 |
-
|| $this->_tokens[$i]['code'] === T_CLOSE_CURLY_BRACKET
|
3545 |
-
|| $this->_tokens[$i]['code'] === T_CLOSE_SHORT_ARRAY
|
3546 |
-
|| $this->_tokens[$i]['code'] === T_OPEN_TAG
|
3547 |
-
|| $this->_tokens[$i]['code'] === T_CLOSE_TAG
|
3548 |
-
) {
|
3549 |
-
return $lastNotEmpty;
|
3550 |
-
}
|
3551 |
-
|
3552 |
-
return $i;
|
3553 |
-
}
|
3554 |
-
|
3555 |
-
// Skip nested statements.
|
3556 |
-
if (isset($this->_tokens[$i]['scope_closer']) === true
|
3557 |
-
&& ($i === $this->_tokens[$i]['scope_opener']
|
3558 |
-
|| $i === $this->_tokens[$i]['scope_condition'])
|
3559 |
-
) {
|
3560 |
-
$i = $this->_tokens[$i]['scope_closer'];
|
3561 |
-
} else if (isset($this->_tokens[$i]['bracket_closer']) === true
|
3562 |
-
&& $i === $this->_tokens[$i]['bracket_opener']
|
3563 |
-
) {
|
3564 |
-
$i = $this->_tokens[$i]['bracket_closer'];
|
3565 |
-
} else if (isset($this->_tokens[$i]['parenthesis_closer']) === true
|
3566 |
-
&& $i === $this->_tokens[$i]['parenthesis_opener']
|
3567 |
-
) {
|
3568 |
-
$i = $this->_tokens[$i]['parenthesis_closer'];
|
3569 |
-
}
|
3570 |
-
|
3571 |
-
if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$this->_tokens[$i]['code']]) === false) {
|
3572 |
-
$lastNotEmpty = $i;
|
3573 |
-
}
|
3574 |
-
}//end for
|
3575 |
-
|
3576 |
-
return ($this->numTokens - 1);
|
3577 |
-
|
3578 |
-
}//end findEndOfStatement()
|
3579 |
-
|
3580 |
-
|
3581 |
-
/**
|
3582 |
-
* Returns the position of the first token on a line, matching given type.
|
3583 |
-
*
|
3584 |
-
* Returns false if no token can be found.
|
3585 |
-
*
|
3586 |
-
* @param int|array $types The type(s) of tokens to search for.
|
3587 |
-
* @param int $start The position to start searching from in the
|
3588 |
-
* token stack. The first token matching on
|
3589 |
-
* this line before this token will be returned.
|
3590 |
-
* @param bool $exclude If true, find the token that is NOT of
|
3591 |
-
* the types specified in $types.
|
3592 |
-
* @param string $value The value that the token must be equal to.
|
3593 |
-
* If value is omitted, tokens with any value will
|
3594 |
-
* be returned.
|
3595 |
-
*
|
3596 |
-
* @return int | bool
|
3597 |
-
*/
|
3598 |
-
public function findFirstOnLine($types, $start, $exclude=false, $value=null)
|
3599 |
-
{
|
3600 |
-
if (is_array($types) === false) {
|
3601 |
-
$types = array($types);
|
3602 |
-
}
|
3603 |
-
|
3604 |
-
$foundToken = false;
|
3605 |
-
|
3606 |
-
for ($i = $start; $i >= 0; $i--) {
|
3607 |
-
if ($this->_tokens[$i]['line'] < $this->_tokens[$start]['line']) {
|
3608 |
-
break;
|
3609 |
-
}
|
3610 |
-
|
3611 |
-
$found = $exclude;
|
3612 |
-
foreach ($types as $type) {
|
3613 |
-
if ($exclude === false) {
|
3614 |
-
if ($this->_tokens[$i]['code'] === $type) {
|
3615 |
-
$found = true;
|
3616 |
-
break;
|
3617 |
-
}
|
3618 |
-
} else {
|
3619 |
-
if ($this->_tokens[$i]['code'] === $type) {
|
3620 |
-
$found = false;
|
3621 |
-
break;
|
3622 |
-
}
|
3623 |
-
}
|
3624 |
-
}
|
3625 |
-
|
3626 |
-
if ($found === true) {
|
3627 |
-
if ($value === null) {
|
3628 |
-
$foundToken = $i;
|
3629 |
-
} else if ($this->_tokens[$i]['content'] === $value) {
|
3630 |
-
$foundToken = $i;
|
3631 |
-
}
|
3632 |
-
}
|
3633 |
-
}//end for
|
3634 |
-
|
3635 |
-
return $foundToken;
|
3636 |
-
|
3637 |
-
}//end findFirstOnLine()
|
3638 |
-
|
3639 |
-
|
3640 |
-
/**
|
3641 |
-
* Determine if the passed token has a condition of one of the passed types.
|
3642 |
-
*
|
3643 |
-
* @param int $stackPtr The position of the token we are checking.
|
3644 |
-
* @param int|array $types The type(s) of tokens to search for.
|
3645 |
-
*
|
3646 |
-
* @return boolean
|
3647 |
-
*/
|
3648 |
-
public function hasCondition($stackPtr, $types)
|
3649 |
-
{
|
3650 |
-
// Check for the existence of the token.
|
3651 |
-
if (isset($this->_tokens[$stackPtr]) === false) {
|
3652 |
-
return false;
|
3653 |
-
}
|
3654 |
-
|
3655 |
-
// Make sure the token has conditions.
|
3656 |
-
if (isset($this->_tokens[$stackPtr]['conditions']) === false) {
|
3657 |
-
return false;
|
3658 |
-
}
|
3659 |
-
|
3660 |
-
$types = (array) $types;
|
3661 |
-
$conditions = $this->_tokens[$stackPtr]['conditions'];
|
3662 |
-
|
3663 |
-
foreach ($types as $type) {
|
3664 |
-
if (in_array($type, $conditions) === true) {
|
3665 |
-
// We found a token with the required type.
|
3666 |
-
return true;
|
3667 |
-
}
|
3668 |
-
}
|
3669 |
-
|
3670 |
-
return false;
|
3671 |
-
|
3672 |
-
}//end hasCondition()
|
3673 |
-
|
3674 |
-
|
3675 |
-
/**
|
3676 |
-
* Return the position of the condition for the passed token.
|
3677 |
-
*
|
3678 |
-
* Returns FALSE if the token does not have the condition.
|
3679 |
-
*
|
3680 |
-
* @param int $stackPtr The position of the token we are checking.
|
3681 |
-
* @param int $type The type of token to search for.
|
3682 |
-
*
|
3683 |
-
* @return int
|
3684 |
-
*/
|
3685 |
-
public function getCondition($stackPtr, $type)
|
3686 |
-
{
|
3687 |
-
// Check for the existence of the token.
|
3688 |
-
if (isset($this->_tokens[$stackPtr]) === false) {
|
3689 |
-
return false;
|
3690 |
-
}
|
3691 |
-
|
3692 |
-
// Make sure the token has conditions.
|
3693 |
-
if (isset($this->_tokens[$stackPtr]['conditions']) === false) {
|
3694 |
-
return false;
|
3695 |
-
}
|
3696 |
-
|
3697 |
-
$conditions = $this->_tokens[$stackPtr]['conditions'];
|
3698 |
-
foreach ($conditions as $token => $condition) {
|
3699 |
-
if ($condition === $type) {
|
3700 |
-
return $token;
|
3701 |
-
}
|
3702 |
-
}
|
3703 |
-
|
3704 |
-
return false;
|
3705 |
-
|
3706 |
-
}//end getCondition()
|
3707 |
-
|
3708 |
-
|
3709 |
-
/**
|
3710 |
-
* Returns the name of the class that the specified class extends.
|
3711 |
-
*
|
3712 |
-
* Returns FALSE on error or if there is no extended class name.
|
3713 |
-
*
|
3714 |
-
* @param int $stackPtr The stack position of the class.
|
3715 |
-
*
|
3716 |
-
* @return string
|
3717 |
-
*/
|
3718 |
-
public function findExtendedClassName($stackPtr)
|
3719 |
-
{
|
3720 |
-
// Check for the existence of the token.
|
3721 |
-
if (isset($this->_tokens[$stackPtr]) === false) {
|
3722 |
-
return false;
|
3723 |
-
}
|
3724 |
-
|
3725 |
-
if ($this->_tokens[$stackPtr]['code'] !== T_CLASS
|
3726 |
-
&& $this->_tokens[$stackPtr]['code'] !== T_ANON_CLASS
|
3727 |
-
) {
|
3728 |
-
return false;
|
3729 |
-
}
|
3730 |
-
|
3731 |
-
if (isset($this->_tokens[$stackPtr]['scope_closer']) === false) {
|
3732 |
-
return false;
|
3733 |
-
}
|
3734 |
-
|
3735 |
-
$classCloserIndex = $this->_tokens[$stackPtr]['scope_closer'];
|
3736 |
-
$extendsIndex = $this->findNext(T_EXTENDS, $stackPtr, $classCloserIndex);
|
3737 |
-
if (false === $extendsIndex) {
|
3738 |
-
return false;
|
3739 |
-
}
|
3740 |
-
|
3741 |
-
$find = array(
|
3742 |
-
T_NS_SEPARATOR,
|
3743 |
-
T_STRING,
|
3744 |
-
T_WHITESPACE,
|
3745 |
-
);
|
3746 |
-
|
3747 |
-
$end = $this->findNext($find, ($extendsIndex + 1), $classCloserIndex, true);
|
3748 |
-
$name = $this->getTokensAsString(($extendsIndex + 1), ($end - $extendsIndex - 1));
|
3749 |
-
$name = trim($name);
|
3750 |
-
|
3751 |
-
if ($name === '') {
|
3752 |
-
return false;
|
3753 |
-
}
|
3754 |
-
|
3755 |
-
return $name;
|
3756 |
-
|
3757 |
-
}//end findExtendedClassName()
|
3758 |
-
|
3759 |
-
|
3760 |
-
/**
|
3761 |
-
* Returns the name(s) of the interface(s) that the specified class implements.
|
3762 |
-
*
|
3763 |
-
* Returns FALSE on error or if there are no implemented interface names.
|
3764 |
-
*
|
3765 |
-
* @param int $stackPtr The stack position of the class.
|
3766 |
-
*
|
3767 |
-
* @return array|false
|
3768 |
-
*/
|
3769 |
-
public function findImplementedInterfaceNames($stackPtr)
|
3770 |
-
{
|
3771 |
-
// Check for the existence of the token.
|
3772 |
-
if (isset($this->_tokens[$stackPtr]) === false) {
|
3773 |
-
return false;
|
3774 |
-
}
|
3775 |
-
|
3776 |
-
if ($this->_tokens[$stackPtr]['code'] !== T_CLASS
|
3777 |
-
&& $this->_tokens[$stackPtr]['code'] !== T_ANON_CLASS
|
3778 |
-
) {
|
3779 |
-
return false;
|
3780 |
-
}
|
3781 |
-
|
3782 |
-
if (isset($this->_tokens[$stackPtr]['scope_closer']) === false) {
|
3783 |
-
return false;
|
3784 |
-
}
|
3785 |
-
|
3786 |
-
$classOpenerIndex = $this->_tokens[$stackPtr]['scope_opener'];
|
3787 |
-
$implementsIndex = $this->findNext(T_IMPLEMENTS, $stackPtr, $classOpenerIndex);
|
3788 |
-
if ($implementsIndex === false) {
|
3789 |
-
return false;
|
3790 |
-
}
|
3791 |
-
|
3792 |
-
$find = array(
|
3793 |
-
T_NS_SEPARATOR,
|
3794 |
-
T_STRING,
|
3795 |
-
T_WHITESPACE,
|
3796 |
-
T_COMMA,
|
3797 |
-
);
|
3798 |
-
|
3799 |
-
$end = $this->findNext($find, ($implementsIndex + 1), ($classOpenerIndex + 1), true);
|
3800 |
-
$name = $this->getTokensAsString(($implementsIndex + 1), ($end - $implementsIndex - 1));
|
3801 |
-
$name = trim($name);
|
3802 |
-
|
3803 |
-
if ($name === '') {
|
3804 |
-
return false;
|
3805 |
-
} else {
|
3806 |
-
$names = explode(',', $name);
|
3807 |
-
$names = array_map('trim', $names);
|
3808 |
-
return $names;
|
3809 |
-
}
|
3810 |
-
|
3811 |
-
}//end findImplementedInterfaceNames()
|
3812 |
-
|
3813 |
-
|
3814 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Fixer.php
DELETED
@@ -1,741 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A helper class for fixing errors.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
10 |
-
* @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)
|
11 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
12 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* A helper class for fixing errors.
|
17 |
-
*
|
18 |
-
* Provides helper functions that act upon a token array and modify the file
|
19 |
-
* content.
|
20 |
-
*
|
21 |
-
* @category PHP
|
22 |
-
* @package PHP_CodeSniffer
|
23 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
24 |
-
* @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)
|
25 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
26 |
-
* @version Release: @package_version@
|
27 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
28 |
-
*/
|
29 |
-
class PHP_CodeSniffer_Fixer
|
30 |
-
{
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Is the fixer enabled and fixing a file?
|
34 |
-
*
|
35 |
-
* Sniffs should check this value to ensure they are not
|
36 |
-
* doing extra processing to prepare for a fix when fixing is
|
37 |
-
* not required.
|
38 |
-
*
|
39 |
-
* @var boolean
|
40 |
-
*/
|
41 |
-
public $enabled = false;
|
42 |
-
|
43 |
-
/**
|
44 |
-
* The number of times we have looped over a file.
|
45 |
-
*
|
46 |
-
* @var int
|
47 |
-
*/
|
48 |
-
public $loops = 0;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* The file being fixed.
|
52 |
-
*
|
53 |
-
* @var PHP_CodeSniffer_File
|
54 |
-
*/
|
55 |
-
private $_currentFile = null;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* The list of tokens that make up the file contents.
|
59 |
-
*
|
60 |
-
* This is a simplified list which just contains the token content and nothing
|
61 |
-
* else. This is the array that is updated as fixes are made, not the file's
|
62 |
-
* token array. Imploding this array will give you the file content back.
|
63 |
-
*
|
64 |
-
* @var array(int => string)
|
65 |
-
*/
|
66 |
-
private $_tokens = array();
|
67 |
-
|
68 |
-
/**
|
69 |
-
* A list of tokens that have already been fixed.
|
70 |
-
*
|
71 |
-
* We don't allow the same token to be fixed more than once each time
|
72 |
-
* through a file as this can easily cause conflicts between sniffs.
|
73 |
-
*
|
74 |
-
* @var array(int)
|
75 |
-
*/
|
76 |
-
private $_fixedTokens = array();
|
77 |
-
|
78 |
-
/**
|
79 |
-
* The last value of each fixed token.
|
80 |
-
*
|
81 |
-
* If a token is being "fixed" back to its last value, the fix is
|
82 |
-
* probably conflicting with another.
|
83 |
-
*
|
84 |
-
* @var array(int => string)
|
85 |
-
*/
|
86 |
-
private $_oldTokenValues = array();
|
87 |
-
|
88 |
-
/**
|
89 |
-
* A list of tokens that have been fixed during a changeset.
|
90 |
-
*
|
91 |
-
* All changes in changeset must be able to be applied, or else
|
92 |
-
* the entire changeset is rejected.
|
93 |
-
*
|
94 |
-
* @var array()
|
95 |
-
*/
|
96 |
-
private $_changeset = array();
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Is there an open changeset.
|
100 |
-
*
|
101 |
-
* @var boolean
|
102 |
-
*/
|
103 |
-
private $_inChangeset = false;
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Is the current fixing loop in conflict?
|
107 |
-
*
|
108 |
-
* @var boolean
|
109 |
-
*/
|
110 |
-
private $_inConflict = false;
|
111 |
-
|
112 |
-
/**
|
113 |
-
* The number of fixes that have been performed.
|
114 |
-
*
|
115 |
-
* @var int
|
116 |
-
*/
|
117 |
-
private $_numFixes = 0;
|
118 |
-
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Starts fixing a new file.
|
122 |
-
*
|
123 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being fixed.
|
124 |
-
*
|
125 |
-
* @return void
|
126 |
-
*/
|
127 |
-
public function startFile($phpcsFile)
|
128 |
-
{
|
129 |
-
$this->_currentFile = $phpcsFile;
|
130 |
-
$this->_numFixes = 0;
|
131 |
-
$this->_fixedTokens = array();
|
132 |
-
|
133 |
-
$tokens = $phpcsFile->getTokens();
|
134 |
-
$this->_tokens = array();
|
135 |
-
foreach ($tokens as $index => $token) {
|
136 |
-
if (isset($token['orig_content']) === true) {
|
137 |
-
$this->_tokens[$index] = $token['orig_content'];
|
138 |
-
} else {
|
139 |
-
$this->_tokens[$index] = $token['content'];
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
}//end startFile()
|
144 |
-
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Attempt to fix the file by processing it until no fixes are made.
|
148 |
-
*
|
149 |
-
* @return boolean
|
150 |
-
*/
|
151 |
-
public function fixFile()
|
152 |
-
{
|
153 |
-
$fixable = $this->_currentFile->getFixableCount();
|
154 |
-
if ($fixable === 0) {
|
155 |
-
// Nothing to fix.
|
156 |
-
return false;
|
157 |
-
}
|
158 |
-
|
159 |
-
$stdin = false;
|
160 |
-
$cliValues = $this->_currentFile->phpcs->cli->getCommandLineValues();
|
161 |
-
if (empty($cliValues['files']) === true) {
|
162 |
-
$stdin = true;
|
163 |
-
}
|
164 |
-
|
165 |
-
$this->enabled = true;
|
166 |
-
|
167 |
-
$this->loops = 0;
|
168 |
-
while ($this->loops < 50) {
|
169 |
-
ob_start();
|
170 |
-
|
171 |
-
// Only needed once file content has changed.
|
172 |
-
$contents = $this->getContents();
|
173 |
-
|
174 |
-
if (PHP_CODESNIFFER_VERBOSITY > 2) {
|
175 |
-
@ob_end_clean();
|
176 |
-
echo '---START FILE CONTENT---'.PHP_EOL;
|
177 |
-
$lines = explode($this->_currentFile->eolChar, $contents);
|
178 |
-
$max = strlen(count($lines));
|
179 |
-
foreach ($lines as $lineNum => $line) {
|
180 |
-
$lineNum++;
|
181 |
-
echo str_pad($lineNum, $max, ' ', STR_PAD_LEFT).'|'.$line.PHP_EOL;
|
182 |
-
}
|
183 |
-
|
184 |
-
echo '--- END FILE CONTENT ---'.PHP_EOL;
|
185 |
-
ob_start();
|
186 |
-
}
|
187 |
-
|
188 |
-
$this->_inConflict = false;
|
189 |
-
$this->_currentFile->refreshTokenListeners();
|
190 |
-
$this->_currentFile->start($contents);
|
191 |
-
ob_end_clean();
|
192 |
-
|
193 |
-
$this->loops++;
|
194 |
-
|
195 |
-
if (PHP_CODESNIFFER_CBF === true && $stdin === false) {
|
196 |
-
echo "\r".str_repeat(' ', 80)."\r";
|
197 |
-
echo "\t=> Fixing file: $this->_numFixes/$fixable violations remaining [made $this->loops pass";
|
198 |
-
if ($this->loops > 1) {
|
199 |
-
echo 'es';
|
200 |
-
}
|
201 |
-
|
202 |
-
echo ']... ';
|
203 |
-
}
|
204 |
-
|
205 |
-
if ($this->_numFixes === 0 && $this->_inConflict === false) {
|
206 |
-
// Nothing left to do.
|
207 |
-
break;
|
208 |
-
} else if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
209 |
-
echo "\t* fixed $this->_numFixes violations, starting loop ".($this->loops + 1).' *'.PHP_EOL;
|
210 |
-
}
|
211 |
-
}//end while
|
212 |
-
|
213 |
-
$this->enabled = false;
|
214 |
-
|
215 |
-
if ($this->_numFixes > 0) {
|
216 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
217 |
-
@ob_end_clean();
|
218 |
-
echo "\t*** Reached maximum number of loops with $this->_numFixes violations left unfixed ***".PHP_EOL;
|
219 |
-
ob_start();
|
220 |
-
}
|
221 |
-
|
222 |
-
return false;
|
223 |
-
}
|
224 |
-
|
225 |
-
return true;
|
226 |
-
|
227 |
-
}//end fixFile()
|
228 |
-
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Generates a text diff of the original file and the new content.
|
232 |
-
*
|
233 |
-
* @param string $filePath Optional file path to diff the file against.
|
234 |
-
* If not specified, the original version of the
|
235 |
-
* file will be used.
|
236 |
-
* @param boolean $colors Print colored output or not.
|
237 |
-
*
|
238 |
-
* @return string
|
239 |
-
*/
|
240 |
-
public function generateDiff($filePath=null, $colors=true)
|
241 |
-
{
|
242 |
-
if ($filePath === null) {
|
243 |
-
$filePath = $this->_currentFile->getFilename();
|
244 |
-
}
|
245 |
-
|
246 |
-
$cwd = getcwd().DIRECTORY_SEPARATOR;
|
247 |
-
if (strpos($filePath, $cwd) === 0) {
|
248 |
-
$filename = substr($filePath, strlen($cwd));
|
249 |
-
} else {
|
250 |
-
$filename = $filePath;
|
251 |
-
}
|
252 |
-
|
253 |
-
$contents = $this->getContents();
|
254 |
-
|
255 |
-
if (function_exists('sys_get_temp_dir') === true) {
|
256 |
-
// This is needed for HHVM support, but only available from 5.2.1.
|
257 |
-
$tempName = tempnam(sys_get_temp_dir(), 'phpcs-fixer');
|
258 |
-
$fixedFile = fopen($tempName, 'w');
|
259 |
-
} else {
|
260 |
-
$fixedFile = tmpfile();
|
261 |
-
$data = stream_get_meta_data($fixedFile);
|
262 |
-
$tempName = $data['uri'];
|
263 |
-
}
|
264 |
-
|
265 |
-
fwrite($fixedFile, $contents);
|
266 |
-
|
267 |
-
// We must use something like shell_exec() because whitespace at the end
|
268 |
-
// of lines is critical to diff files.
|
269 |
-
$filename = escapeshellarg($filename);
|
270 |
-
$cmd = "diff -u -L$filename -LPHP_CodeSniffer $filename \"$tempName\"";
|
271 |
-
|
272 |
-
$diff = shell_exec($cmd);
|
273 |
-
|
274 |
-
fclose($fixedFile);
|
275 |
-
if (is_file($tempName) === true) {
|
276 |
-
unlink($tempName);
|
277 |
-
}
|
278 |
-
|
279 |
-
if ($colors === false) {
|
280 |
-
return $diff;
|
281 |
-
}
|
282 |
-
|
283 |
-
$diffLines = explode(PHP_EOL, $diff);
|
284 |
-
if (count($diffLines) === 1) {
|
285 |
-
// Seems to be required for cygwin.
|
286 |
-
$diffLines = explode("\n", $diff);
|
287 |
-
}
|
288 |
-
|
289 |
-
$diff = array();
|
290 |
-
foreach ($diffLines as $line) {
|
291 |
-
if (isset($line[0]) === true) {
|
292 |
-
switch ($line[0]) {
|
293 |
-
case '-':
|
294 |
-
$diff[] = "\033[31m$line\033[0m";
|
295 |
-
break;
|
296 |
-
case '+':
|
297 |
-
$diff[] = "\033[32m$line\033[0m";
|
298 |
-
break;
|
299 |
-
default:
|
300 |
-
$diff[] = $line;
|
301 |
-
}
|
302 |
-
}
|
303 |
-
}
|
304 |
-
|
305 |
-
$diff = implode(PHP_EOL, $diff);
|
306 |
-
|
307 |
-
return $diff;
|
308 |
-
|
309 |
-
}//end generateDiff()
|
310 |
-
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Get a count of fixes that have been performed on the file.
|
314 |
-
*
|
315 |
-
* This value is reset every time a new file is started, or an existing
|
316 |
-
* file is restarted.
|
317 |
-
*
|
318 |
-
* @return int
|
319 |
-
*/
|
320 |
-
public function getFixCount()
|
321 |
-
{
|
322 |
-
return $this->_numFixes;
|
323 |
-
|
324 |
-
}//end getFixCount()
|
325 |
-
|
326 |
-
|
327 |
-
/**
|
328 |
-
* Get the current content of the file, as a string.
|
329 |
-
*
|
330 |
-
* @return string
|
331 |
-
*/
|
332 |
-
public function getContents()
|
333 |
-
{
|
334 |
-
$contents = implode($this->_tokens);
|
335 |
-
return $contents;
|
336 |
-
|
337 |
-
}//end getContents()
|
338 |
-
|
339 |
-
|
340 |
-
/**
|
341 |
-
* Get the current fixed content of a token.
|
342 |
-
*
|
343 |
-
* This function takes changesets into account so should be used
|
344 |
-
* instead of directly accessing the token array.
|
345 |
-
*
|
346 |
-
* @param int $stackPtr The position of the token in the token stack.
|
347 |
-
*
|
348 |
-
* @return string
|
349 |
-
*/
|
350 |
-
public function getTokenContent($stackPtr)
|
351 |
-
{
|
352 |
-
if ($this->_inChangeset === true
|
353 |
-
&& isset($this->_changeset[$stackPtr]) === true
|
354 |
-
) {
|
355 |
-
return $this->_changeset[$stackPtr];
|
356 |
-
} else {
|
357 |
-
return $this->_tokens[$stackPtr];
|
358 |
-
}
|
359 |
-
|
360 |
-
}//end getTokenContent()
|
361 |
-
|
362 |
-
|
363 |
-
/**
|
364 |
-
* Start recording actions for a changeset.
|
365 |
-
*
|
366 |
-
* @return void
|
367 |
-
*/
|
368 |
-
public function beginChangeset()
|
369 |
-
{
|
370 |
-
if ($this->_inConflict === true) {
|
371 |
-
return false;
|
372 |
-
}
|
373 |
-
|
374 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
375 |
-
$bt = debug_backtrace();
|
376 |
-
$sniff = $bt[1]['class'];
|
377 |
-
$line = $bt[0]['line'];
|
378 |
-
|
379 |
-
@ob_end_clean();
|
380 |
-
echo "\t=> Changeset started by $sniff (line $line)".PHP_EOL;
|
381 |
-
ob_start();
|
382 |
-
}
|
383 |
-
|
384 |
-
$this->_changeset = array();
|
385 |
-
$this->_inChangeset = true;
|
386 |
-
|
387 |
-
}//end beginChangeset()
|
388 |
-
|
389 |
-
|
390 |
-
/**
|
391 |
-
* Stop recording actions for a changeset, and apply logged changes.
|
392 |
-
*
|
393 |
-
* @return boolean
|
394 |
-
*/
|
395 |
-
public function endChangeset()
|
396 |
-
{
|
397 |
-
if ($this->_inConflict === true) {
|
398 |
-
return false;
|
399 |
-
}
|
400 |
-
|
401 |
-
$this->_inChangeset = false;
|
402 |
-
|
403 |
-
$success = true;
|
404 |
-
$applied = array();
|
405 |
-
foreach ($this->_changeset as $stackPtr => $content) {
|
406 |
-
$success = $this->replaceToken($stackPtr, $content);
|
407 |
-
if ($success === false) {
|
408 |
-
break;
|
409 |
-
} else {
|
410 |
-
$applied[] = $stackPtr;
|
411 |
-
}
|
412 |
-
}
|
413 |
-
|
414 |
-
if ($success === false) {
|
415 |
-
// Rolling back all changes.
|
416 |
-
foreach ($applied as $stackPtr) {
|
417 |
-
$this->revertToken($stackPtr);
|
418 |
-
}
|
419 |
-
|
420 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
421 |
-
@ob_end_clean();
|
422 |
-
echo "\t=> Changeset failed to apply".PHP_EOL;
|
423 |
-
ob_start();
|
424 |
-
}
|
425 |
-
} else if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
426 |
-
$fixes = count($this->_changeset);
|
427 |
-
@ob_end_clean();
|
428 |
-
echo "\t=> Changeset ended: $fixes changes applied".PHP_EOL;
|
429 |
-
ob_start();
|
430 |
-
}
|
431 |
-
|
432 |
-
$this->_changeset = array();
|
433 |
-
|
434 |
-
}//end endChangeset()
|
435 |
-
|
436 |
-
|
437 |
-
/**
|
438 |
-
* Stop recording actions for a changeset, and discard logged changes.
|
439 |
-
*
|
440 |
-
* @return void
|
441 |
-
*/
|
442 |
-
public function rollbackChangeset()
|
443 |
-
{
|
444 |
-
$this->_inChangeset = false;
|
445 |
-
$this->_inConflict = false;
|
446 |
-
|
447 |
-
if (empty($this->_changeset) === false) {
|
448 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
449 |
-
$bt = debug_backtrace();
|
450 |
-
if ($bt[1]['class'] === 'PHP_CodeSniffer_Fixer') {
|
451 |
-
$sniff = $bt[2]['class'];
|
452 |
-
$line = $bt[1]['line'];
|
453 |
-
} else {
|
454 |
-
$sniff = $bt[1]['class'];
|
455 |
-
$line = $bt[0]['line'];
|
456 |
-
}
|
457 |
-
|
458 |
-
$numChanges = count($this->_changeset);
|
459 |
-
|
460 |
-
@ob_end_clean();
|
461 |
-
echo "\t\tR: $sniff (line $line) rolled back the changeset ($numChanges changes)".PHP_EOL;
|
462 |
-
echo "\t=> Changeset rolled back".PHP_EOL;
|
463 |
-
ob_start();
|
464 |
-
}
|
465 |
-
|
466 |
-
$this->_changeset = array();
|
467 |
-
}//end if
|
468 |
-
|
469 |
-
}//end rollbackChangeset()
|
470 |
-
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Replace the entire contents of a token.
|
474 |
-
*
|
475 |
-
* @param int $stackPtr The position of the token in the token stack.
|
476 |
-
* @param string $content The new content of the token.
|
477 |
-
*
|
478 |
-
* @return bool If the change was accepted.
|
479 |
-
*/
|
480 |
-
public function replaceToken($stackPtr, $content)
|
481 |
-
{
|
482 |
-
if ($this->_inConflict === true) {
|
483 |
-
return false;
|
484 |
-
}
|
485 |
-
|
486 |
-
if ($this->_inChangeset === false
|
487 |
-
&& isset($this->_fixedTokens[$stackPtr]) === true
|
488 |
-
) {
|
489 |
-
$indent = "\t";
|
490 |
-
if (empty($this->_changeset) === false) {
|
491 |
-
$indent .= "\t";
|
492 |
-
}
|
493 |
-
|
494 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
495 |
-
@ob_end_clean();
|
496 |
-
echo "$indent* token $stackPtr has already been modified, skipping *".PHP_EOL;
|
497 |
-
ob_start();
|
498 |
-
}
|
499 |
-
|
500 |
-
return false;
|
501 |
-
}
|
502 |
-
|
503 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
504 |
-
$bt = debug_backtrace();
|
505 |
-
if ($bt[1]['class'] === 'PHP_CodeSniffer_Fixer') {
|
506 |
-
$sniff = $bt[2]['class'];
|
507 |
-
$line = $bt[1]['line'];
|
508 |
-
} else {
|
509 |
-
$sniff = $bt[1]['class'];
|
510 |
-
$line = $bt[0]['line'];
|
511 |
-
}
|
512 |
-
|
513 |
-
$tokens = $this->_currentFile->getTokens();
|
514 |
-
$type = $tokens[$stackPtr]['type'];
|
515 |
-
$oldContent = PHP_CodeSniffer::prepareForOutput($this->_tokens[$stackPtr]);
|
516 |
-
$newContent = PHP_CodeSniffer::prepareForOutput($content);
|
517 |
-
if (trim($this->_tokens[$stackPtr]) === '' && isset($this->_tokens[($stackPtr + 1)]) === true) {
|
518 |
-
// Add some context for whitespace only changes.
|
519 |
-
$append = PHP_CodeSniffer::prepareForOutput($this->_tokens[($stackPtr + 1)]);
|
520 |
-
$oldContent .= $append;
|
521 |
-
$newContent .= $append;
|
522 |
-
}
|
523 |
-
}//end if
|
524 |
-
|
525 |
-
if ($this->_inChangeset === true) {
|
526 |
-
$this->_changeset[$stackPtr] = $content;
|
527 |
-
|
528 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
529 |
-
@ob_end_clean();
|
530 |
-
echo "\t\tQ: $sniff (line $line) replaced token $stackPtr ($type) \"$oldContent\" => \"$newContent\"".PHP_EOL;
|
531 |
-
ob_start();
|
532 |
-
}
|
533 |
-
|
534 |
-
return true;
|
535 |
-
}
|
536 |
-
|
537 |
-
if (isset($this->_oldTokenValues[$stackPtr]) === false) {
|
538 |
-
$this->_oldTokenValues[$stackPtr] = array(
|
539 |
-
'curr' => $content,
|
540 |
-
'prev' => $this->_tokens[$stackPtr],
|
541 |
-
'loop' => $this->loops,
|
542 |
-
);
|
543 |
-
} else {
|
544 |
-
if ($this->_oldTokenValues[$stackPtr]['prev'] === $content
|
545 |
-
&& $this->_oldTokenValues[$stackPtr]['loop'] === ($this->loops - 1)
|
546 |
-
) {
|
547 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
548 |
-
$indent = "\t";
|
549 |
-
if (empty($this->_changeset) === false) {
|
550 |
-
$indent .= "\t";
|
551 |
-
}
|
552 |
-
|
553 |
-
$loop = $this->_oldTokenValues[$stackPtr]['loop'];
|
554 |
-
|
555 |
-
@ob_end_clean();
|
556 |
-
echo "$indent**** $sniff (line $line) has possible conflict with another sniff on loop $loop; caused by the following change ****".PHP_EOL;
|
557 |
-
echo "$indent**** replaced token $stackPtr ($type) \"$oldContent\" => \"$newContent\" ****".PHP_EOL;
|
558 |
-
}
|
559 |
-
|
560 |
-
if ($this->_oldTokenValues[$stackPtr]['loop'] >= ($this->loops - 1)) {
|
561 |
-
$this->_inConflict = true;
|
562 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
563 |
-
echo "$indent**** ignoring all changes until next loop ****".PHP_EOL;
|
564 |
-
}
|
565 |
-
}
|
566 |
-
|
567 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
568 |
-
ob_start();
|
569 |
-
}
|
570 |
-
|
571 |
-
return false;
|
572 |
-
}//end if
|
573 |
-
|
574 |
-
$this->_oldTokenValues[$stackPtr]['prev'] = $this->_oldTokenValues[$stackPtr]['curr'];
|
575 |
-
$this->_oldTokenValues[$stackPtr]['curr'] = $content;
|
576 |
-
$this->_oldTokenValues[$stackPtr]['loop'] = $this->loops;
|
577 |
-
}//end if
|
578 |
-
|
579 |
-
$this->_fixedTokens[$stackPtr] = $this->_tokens[$stackPtr];
|
580 |
-
$this->_tokens[$stackPtr] = $content;
|
581 |
-
$this->_numFixes++;
|
582 |
-
|
583 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
584 |
-
$indent = "\t";
|
585 |
-
if (empty($this->_changeset) === false) {
|
586 |
-
$indent .= "\tA: ";
|
587 |
-
}
|
588 |
-
|
589 |
-
@ob_end_clean();
|
590 |
-
echo "$indent$sniff (line $line) replaced token $stackPtr ($type) \"$oldContent\" => \"$newContent\"".PHP_EOL;
|
591 |
-
ob_start();
|
592 |
-
}
|
593 |
-
|
594 |
-
return true;
|
595 |
-
|
596 |
-
}//end replaceToken()
|
597 |
-
|
598 |
-
|
599 |
-
/**
|
600 |
-
* Reverts the previous fix made to a token.
|
601 |
-
*
|
602 |
-
* @param int $stackPtr The position of the token in the token stack.
|
603 |
-
*
|
604 |
-
* @return bool If a change was reverted.
|
605 |
-
*/
|
606 |
-
public function revertToken($stackPtr)
|
607 |
-
{
|
608 |
-
if (isset($this->_fixedTokens[$stackPtr]) === false) {
|
609 |
-
return false;
|
610 |
-
}
|
611 |
-
|
612 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
613 |
-
$bt = debug_backtrace();
|
614 |
-
if ($bt[1]['class'] === 'PHP_CodeSniffer_Fixer') {
|
615 |
-
$sniff = $bt[2]['class'];
|
616 |
-
$line = $bt[1]['line'];
|
617 |
-
} else {
|
618 |
-
$sniff = $bt[1]['class'];
|
619 |
-
$line = $bt[0]['line'];
|
620 |
-
}
|
621 |
-
|
622 |
-
$tokens = $this->_currentFile->getTokens();
|
623 |
-
$type = $tokens[$stackPtr]['type'];
|
624 |
-
$oldContent = PHP_CodeSniffer::prepareForOutput($this->_tokens[$stackPtr]);
|
625 |
-
$newContent = PHP_CodeSniffer::prepareForOutput($this->_fixedTokens[$stackPtr]);
|
626 |
-
if (trim($this->_tokens[$stackPtr]) === '' && isset($tokens[($stackPtr + 1)]) === true) {
|
627 |
-
// Add some context for whitespace only changes.
|
628 |
-
$append = PHP_CodeSniffer::prepareForOutput($this->_tokens[($stackPtr + 1)]);
|
629 |
-
$oldContent .= $append;
|
630 |
-
$newContent .= $append;
|
631 |
-
}
|
632 |
-
}//end if
|
633 |
-
|
634 |
-
$this->_tokens[$stackPtr] = $this->_fixedTokens[$stackPtr];
|
635 |
-
unset($this->_fixedTokens[$stackPtr]);
|
636 |
-
$this->_numFixes--;
|
637 |
-
|
638 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
639 |
-
$indent = "\t";
|
640 |
-
if (empty($this->_changeset) === false) {
|
641 |
-
$indent .= "\tR: ";
|
642 |
-
}
|
643 |
-
|
644 |
-
@ob_end_clean();
|
645 |
-
echo "$indent$sniff (line $line) reverted token $stackPtr ($type) \"$oldContent\" => \"$newContent\"".PHP_EOL;
|
646 |
-
ob_start();
|
647 |
-
}
|
648 |
-
|
649 |
-
return true;
|
650 |
-
|
651 |
-
}//end revertToken()
|
652 |
-
|
653 |
-
|
654 |
-
/**
|
655 |
-
* Replace the content of a token with a part of its current content.
|
656 |
-
*
|
657 |
-
* @param int $stackPtr The position of the token in the token stack.
|
658 |
-
* @param int $start The first character to keep.
|
659 |
-
* @param int $length The number of chacters to keep. If NULL, the content of
|
660 |
-
* the token from $start to the end of the content is kept.
|
661 |
-
*
|
662 |
-
* @return bool If the change was accepted.
|
663 |
-
*/
|
664 |
-
public function substrToken($stackPtr, $start, $length=null)
|
665 |
-
{
|
666 |
-
$current = $this->getTokenContent($stackPtr);
|
667 |
-
|
668 |
-
if ($length === null) {
|
669 |
-
$newContent = substr($current, $start);
|
670 |
-
} else {
|
671 |
-
$newContent = substr($current, $start, $length);
|
672 |
-
}
|
673 |
-
|
674 |
-
return $this->replaceToken($stackPtr, $newContent);
|
675 |
-
|
676 |
-
}//end substrToken()
|
677 |
-
|
678 |
-
|
679 |
-
/**
|
680 |
-
* Adds a newline to end of a token's content.
|
681 |
-
*
|
682 |
-
* @param int $stackPtr The position of the token in the token stack.
|
683 |
-
*
|
684 |
-
* @return bool If the change was accepted.
|
685 |
-
*/
|
686 |
-
public function addNewline($stackPtr)
|
687 |
-
{
|
688 |
-
$current = $this->getTokenContent($stackPtr);
|
689 |
-
return $this->replaceToken($stackPtr, $current.$this->_currentFile->eolChar);
|
690 |
-
|
691 |
-
}//end addNewline()
|
692 |
-
|
693 |
-
|
694 |
-
/**
|
695 |
-
* Adds a newline to the start of a token's content.
|
696 |
-
*
|
697 |
-
* @param int $stackPtr The position of the token in the token stack.
|
698 |
-
*
|
699 |
-
* @return bool If the change was accepted.
|
700 |
-
*/
|
701 |
-
public function addNewlineBefore($stackPtr)
|
702 |
-
{
|
703 |
-
$current = $this->getTokenContent($stackPtr);
|
704 |
-
return $this->replaceToken($stackPtr, $this->_currentFile->eolChar.$current);
|
705 |
-
|
706 |
-
}//end addNewlineBefore()
|
707 |
-
|
708 |
-
|
709 |
-
/**
|
710 |
-
* Adds content to the end of a token's current content.
|
711 |
-
*
|
712 |
-
* @param int $stackPtr The position of the token in the token stack.
|
713 |
-
* @param string $content The content to add.
|
714 |
-
*
|
715 |
-
* @return bool If the change was accepted.
|
716 |
-
*/
|
717 |
-
public function addContent($stackPtr, $content)
|
718 |
-
{
|
719 |
-
$current = $this->getTokenContent($stackPtr);
|
720 |
-
return $this->replaceToken($stackPtr, $current.$content);
|
721 |
-
|
722 |
-
}//end addContent()
|
723 |
-
|
724 |
-
|
725 |
-
/**
|
726 |
-
* Adds content to the start of a token's current content.
|
727 |
-
*
|
728 |
-
* @param int $stackPtr The position of the token in the token stack.
|
729 |
-
* @param string $content The content to add.
|
730 |
-
*
|
731 |
-
* @return bool If the change was accepted.
|
732 |
-
*/
|
733 |
-
public function addContentBefore($stackPtr, $content)
|
734 |
-
{
|
735 |
-
$current = $this->getTokenContent($stackPtr);
|
736 |
-
return $this->replaceToken($stackPtr, $content.$current);
|
737 |
-
|
738 |
-
}//end addContentBefore()
|
739 |
-
|
740 |
-
|
741 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Report.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Represents a PHP_CodeSniffer report.
|
4 |
-
*
|
5 |
-
* PHP version 5.
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Represents a PHP_CodeSniffer report.
|
19 |
-
*
|
20 |
-
* @category PHP
|
21 |
-
* @package PHP_CodeSniffer
|
22 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
23 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
24 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
25 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
26 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
27 |
-
* @version Release: @package_version@
|
28 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
29 |
-
*/
|
30 |
-
interface PHP_CodeSniffer_Report
|
31 |
-
{
|
32 |
-
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Generate a partial report for a single processed file.
|
36 |
-
*
|
37 |
-
* Function should return TRUE if it printed or stored data about the file
|
38 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
39 |
-
* its data should be counted in the grand totals.
|
40 |
-
*
|
41 |
-
* @param array $report Prepared report data.
|
42 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
43 |
-
* @param boolean $showSources Show sources?
|
44 |
-
* @param int $width Maximum allowed line width.
|
45 |
-
*
|
46 |
-
* @return boolean
|
47 |
-
*/
|
48 |
-
public function generateFileReport(
|
49 |
-
$report,
|
50 |
-
PHP_CodeSniffer_File $phpcsFile,
|
51 |
-
$showSources=false,
|
52 |
-
$width=80
|
53 |
-
);
|
54 |
-
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Generate the actual report.
|
58 |
-
*
|
59 |
-
* @param string $cachedData Any partial report data that was returned from
|
60 |
-
* generateFileReport during the run.
|
61 |
-
* @param int $totalFiles Total number of files processed during the run.
|
62 |
-
* @param int $totalErrors Total number of errors found during the run.
|
63 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
64 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
65 |
-
* @param boolean $showSources Show sources?
|
66 |
-
* @param int $width Maximum allowed line width.
|
67 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
68 |
-
*
|
69 |
-
* @return void
|
70 |
-
*/
|
71 |
-
public function generate(
|
72 |
-
$cachedData,
|
73 |
-
$totalFiles,
|
74 |
-
$totalErrors,
|
75 |
-
$totalWarnings,
|
76 |
-
$totalFixable,
|
77 |
-
$showSources=false,
|
78 |
-
$width=80,
|
79 |
-
$toScreen=true
|
80 |
-
);
|
81 |
-
|
82 |
-
|
83 |
-
}//end interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reporting.php
DELETED
@@ -1,425 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A class to manage reporting.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* A class to manage reporting.
|
19 |
-
*
|
20 |
-
* @category PHP
|
21 |
-
* @package PHP_CodeSniffer
|
22 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
23 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
24 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
25 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
26 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
27 |
-
* @version Release: @package_version@
|
28 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
29 |
-
*/
|
30 |
-
class PHP_CodeSniffer_Reporting
|
31 |
-
{
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Total number of files that contain errors or warnings.
|
35 |
-
*
|
36 |
-
* @var int
|
37 |
-
*/
|
38 |
-
public $totalFiles = 0;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Total number of errors found during the run.
|
42 |
-
*
|
43 |
-
* @var int
|
44 |
-
*/
|
45 |
-
public $totalErrors = 0;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Total number of warnings found during the run.
|
49 |
-
*
|
50 |
-
* @var int
|
51 |
-
*/
|
52 |
-
public $totalWarnings = 0;
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Total number of errors/warnings that can be fixed.
|
56 |
-
*
|
57 |
-
* @var int
|
58 |
-
*/
|
59 |
-
public $totalFixable = 0;
|
60 |
-
|
61 |
-
/**
|
62 |
-
* When the PHPCS run started.
|
63 |
-
*
|
64 |
-
* @var float
|
65 |
-
*/
|
66 |
-
public static $startTime = 0;
|
67 |
-
|
68 |
-
/**
|
69 |
-
* A list of reports that have written partial report output.
|
70 |
-
*
|
71 |
-
* @var array
|
72 |
-
*/
|
73 |
-
private $_cachedReports = array();
|
74 |
-
|
75 |
-
/**
|
76 |
-
* A cache of report objects.
|
77 |
-
*
|
78 |
-
* @var array
|
79 |
-
*/
|
80 |
-
private $_reports = array();
|
81 |
-
|
82 |
-
/**
|
83 |
-
* A cache of opened tmp files.
|
84 |
-
*
|
85 |
-
* @var array
|
86 |
-
*/
|
87 |
-
private $_tmpFiles = array();
|
88 |
-
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Produce the appropriate report object based on $type parameter.
|
92 |
-
*
|
93 |
-
* @param string $type The type of the report.
|
94 |
-
*
|
95 |
-
* @return PHP_CodeSniffer_Report
|
96 |
-
* @throws PHP_CodeSniffer_Exception If report is not available.
|
97 |
-
*/
|
98 |
-
public function factory($type)
|
99 |
-
{
|
100 |
-
$type = ucfirst($type);
|
101 |
-
if (isset($this->_reports[$type]) === true) {
|
102 |
-
return $this->_reports[$type];
|
103 |
-
}
|
104 |
-
|
105 |
-
if (strpos($type, '.') !== false) {
|
106 |
-
// This is a path to a custom report class.
|
107 |
-
$filename = realpath($type);
|
108 |
-
if ($filename === false) {
|
109 |
-
echo 'ERROR: Custom report "'.$type.'" not found'.PHP_EOL;
|
110 |
-
exit(2);
|
111 |
-
}
|
112 |
-
|
113 |
-
$reportClassName = 'PHP_CodeSniffer_Reports_'.basename($filename);
|
114 |
-
$reportClassName = substr($reportClassName, 0, strpos($reportClassName, '.'));
|
115 |
-
include_once $filename;
|
116 |
-
} else {
|
117 |
-
$filename = $type.'.php';
|
118 |
-
$reportClassName = 'PHP_CodeSniffer_Reports_'.$type;
|
119 |
-
if (class_exists($reportClassName, true) === false) {
|
120 |
-
echo 'ERROR: Report type "'.$type.'" not found'.PHP_EOL;
|
121 |
-
exit(2);
|
122 |
-
}
|
123 |
-
}//end if
|
124 |
-
|
125 |
-
$reportClass = new $reportClassName();
|
126 |
-
if (false === ($reportClass instanceof PHP_CodeSniffer_Report)) {
|
127 |
-
throw new PHP_CodeSniffer_Exception('Class "'.$reportClassName.'" must implement the "PHP_CodeSniffer_Report" interface.');
|
128 |
-
}
|
129 |
-
|
130 |
-
$this->_reports[$type] = $reportClass;
|
131 |
-
return $this->_reports[$type];
|
132 |
-
|
133 |
-
}//end factory()
|
134 |
-
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Actually generates the report.
|
138 |
-
*
|
139 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file that has been processed.
|
140 |
-
* @param array $cliValues An array of command line arguments.
|
141 |
-
*
|
142 |
-
* @return void
|
143 |
-
*/
|
144 |
-
public function cacheFileReport(PHP_CodeSniffer_File $phpcsFile, array $cliValues)
|
145 |
-
{
|
146 |
-
if (isset($cliValues['reports']) === false) {
|
147 |
-
// This happens during unit testing, or any time someone just wants
|
148 |
-
// the error data and not the printed report.
|
149 |
-
return;
|
150 |
-
}
|
151 |
-
|
152 |
-
$reportData = $this->prepareFileReport($phpcsFile);
|
153 |
-
$errorsShown = false;
|
154 |
-
|
155 |
-
foreach ($cliValues['reports'] as $report => $output) {
|
156 |
-
$reportClass = $this->factory($report);
|
157 |
-
$report = get_class($reportClass);
|
158 |
-
|
159 |
-
ob_start();
|
160 |
-
$result = $reportClass->generateFileReport($reportData, $phpcsFile, $cliValues['showSources'], $cliValues['reportWidth']);
|
161 |
-
if ($result === true) {
|
162 |
-
$errorsShown = true;
|
163 |
-
}
|
164 |
-
|
165 |
-
$generatedReport = ob_get_contents();
|
166 |
-
ob_end_clean();
|
167 |
-
|
168 |
-
if ($output === null && $cliValues['reportFile'] !== null) {
|
169 |
-
$output = $cliValues['reportFile'];
|
170 |
-
}
|
171 |
-
|
172 |
-
if ($output === null) {
|
173 |
-
// Using a temp file.
|
174 |
-
if (isset($this->_tmpFiles[$report]) === false) {
|
175 |
-
if (function_exists('sys_get_temp_dir') === true) {
|
176 |
-
// This is needed for HHVM support, but only available from 5.2.1.
|
177 |
-
$this->_tmpFiles[$report] = fopen(tempnam(sys_get_temp_dir(), 'phpcs'), 'w');
|
178 |
-
} else {
|
179 |
-
$this->_tmpFiles[$report] = tmpfile();
|
180 |
-
}
|
181 |
-
}
|
182 |
-
|
183 |
-
fwrite($this->_tmpFiles[$report], $generatedReport);
|
184 |
-
} else {
|
185 |
-
$flags = FILE_APPEND;
|
186 |
-
if (isset($this->_cachedReports[$report]) === false) {
|
187 |
-
$this->_cachedReports[$report] = true;
|
188 |
-
$flags = null;
|
189 |
-
}
|
190 |
-
|
191 |
-
file_put_contents($output, $generatedReport, $flags);
|
192 |
-
}//end if
|
193 |
-
}//end foreach
|
194 |
-
|
195 |
-
if ($errorsShown === true) {
|
196 |
-
$this->totalFiles++;
|
197 |
-
$this->totalErrors += $reportData['errors'];
|
198 |
-
$this->totalWarnings += $reportData['warnings'];
|
199 |
-
$this->totalFixable += $reportData['fixable'];
|
200 |
-
}
|
201 |
-
|
202 |
-
}//end cacheFileReport()
|
203 |
-
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Generates and prints a final report.
|
207 |
-
*
|
208 |
-
* Returns an array with the number of errors and the number of
|
209 |
-
* warnings, in the form ['errors' => int, 'warnings' => int].
|
210 |
-
*
|
211 |
-
* @param string $report Report type.
|
212 |
-
* @param boolean $showSources Show sources?
|
213 |
-
* @param array $cliValues An array of command line arguments.
|
214 |
-
* @param string $reportFile Report file to generate.
|
215 |
-
* @param integer $reportWidth Report max width.
|
216 |
-
*
|
217 |
-
* @return int[]
|
218 |
-
*/
|
219 |
-
public function printReport(
|
220 |
-
$report,
|
221 |
-
$showSources,
|
222 |
-
array $cliValues,
|
223 |
-
$reportFile='',
|
224 |
-
$reportWidth=80
|
225 |
-
) {
|
226 |
-
$reportClass = $this->factory($report);
|
227 |
-
$report = get_class($reportClass);
|
228 |
-
|
229 |
-
if ($reportFile !== null) {
|
230 |
-
$filename = $reportFile;
|
231 |
-
$toScreen = false;
|
232 |
-
|
233 |
-
if (file_exists($filename) === true
|
234 |
-
&& isset($this->_cachedReports[$report]) === true
|
235 |
-
) {
|
236 |
-
$reportCache = file_get_contents($filename);
|
237 |
-
} else {
|
238 |
-
$reportCache = '';
|
239 |
-
}
|
240 |
-
} else {
|
241 |
-
if (isset($this->_tmpFiles[$report]) === true) {
|
242 |
-
$data = stream_get_meta_data($this->_tmpFiles[$report]);
|
243 |
-
$filename = $data['uri'];
|
244 |
-
$reportCache = file_get_contents($filename);
|
245 |
-
fclose($this->_tmpFiles[$report]);
|
246 |
-
} else {
|
247 |
-
$reportCache = '';
|
248 |
-
$filename = null;
|
249 |
-
}
|
250 |
-
|
251 |
-
$toScreen = true;
|
252 |
-
}//end if
|
253 |
-
|
254 |
-
ob_start();
|
255 |
-
$reportClass->generate(
|
256 |
-
$reportCache,
|
257 |
-
$this->totalFiles,
|
258 |
-
$this->totalErrors,
|
259 |
-
$this->totalWarnings,
|
260 |
-
$this->totalFixable,
|
261 |
-
$showSources,
|
262 |
-
$reportWidth,
|
263 |
-
$toScreen
|
264 |
-
);
|
265 |
-
$generatedReport = ob_get_contents();
|
266 |
-
ob_end_clean();
|
267 |
-
|
268 |
-
if ($cliValues['colors'] !== true || $reportFile !== null) {
|
269 |
-
$generatedReport = preg_replace('`\033\[[0-9]+m`', '', $generatedReport);
|
270 |
-
}
|
271 |
-
|
272 |
-
if ($reportFile !== null) {
|
273 |
-
if (PHP_CODESNIFFER_VERBOSITY > 0) {
|
274 |
-
echo $generatedReport;
|
275 |
-
}
|
276 |
-
|
277 |
-
file_put_contents($reportFile, $generatedReport.PHP_EOL);
|
278 |
-
} else {
|
279 |
-
echo $generatedReport;
|
280 |
-
if ($filename !== null && file_exists($filename) === true) {
|
281 |
-
unlink($filename);
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
return array(
|
286 |
-
'errors' => $this->totalErrors,
|
287 |
-
'warnings' => $this->totalWarnings,
|
288 |
-
);
|
289 |
-
|
290 |
-
}//end printReport()
|
291 |
-
|
292 |
-
|
293 |
-
/**
|
294 |
-
* Pre-process and package violations for all files.
|
295 |
-
*
|
296 |
-
* Used by error reports to get a packaged list of all errors in each file.
|
297 |
-
*
|
298 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file that has been processed.
|
299 |
-
*
|
300 |
-
* @return array
|
301 |
-
*/
|
302 |
-
public function prepareFileReport(PHP_CodeSniffer_File $phpcsFile)
|
303 |
-
{
|
304 |
-
$report = array(
|
305 |
-
'filename' => $phpcsFile->getFilename(),
|
306 |
-
'errors' => $phpcsFile->getErrorCount(),
|
307 |
-
'warnings' => $phpcsFile->getWarningCount(),
|
308 |
-
'fixable' => $phpcsFile->getFixableCount(),
|
309 |
-
'messages' => array(),
|
310 |
-
);
|
311 |
-
|
312 |
-
if ($report['errors'] === 0 && $report['warnings'] === 0) {
|
313 |
-
// Prefect score!
|
314 |
-
return $report;
|
315 |
-
}
|
316 |
-
|
317 |
-
$errors = array();
|
318 |
-
|
319 |
-
// Merge errors and warnings.
|
320 |
-
foreach ($phpcsFile->getErrors() as $line => $lineErrors) {
|
321 |
-
if (is_array($lineErrors) === false) {
|
322 |
-
continue;
|
323 |
-
}
|
324 |
-
|
325 |
-
foreach ($lineErrors as $column => $colErrors) {
|
326 |
-
$newErrors = array();
|
327 |
-
foreach ($colErrors as $data) {
|
328 |
-
$newErrors[] = array(
|
329 |
-
'message' => $data['message'],
|
330 |
-
'source' => $data['source'],
|
331 |
-
'severity' => $data['severity'],
|
332 |
-
'fixable' => $data['fixable'],
|
333 |
-
'type' => 'ERROR',
|
334 |
-
);
|
335 |
-
}//end foreach
|
336 |
-
|
337 |
-
$errors[$line][$column] = $newErrors;
|
338 |
-
}//end foreach
|
339 |
-
|
340 |
-
ksort($errors[$line]);
|
341 |
-
}//end foreach
|
342 |
-
|
343 |
-
foreach ($phpcsFile->getWarnings() as $line => $lineWarnings) {
|
344 |
-
if (is_array($lineWarnings) === false) {
|
345 |
-
continue;
|
346 |
-
}
|
347 |
-
|
348 |
-
foreach ($lineWarnings as $column => $colWarnings) {
|
349 |
-
$newWarnings = array();
|
350 |
-
foreach ($colWarnings as $data) {
|
351 |
-
$newWarnings[] = array(
|
352 |
-
'message' => $data['message'],
|
353 |
-
'source' => $data['source'],
|
354 |
-
'severity' => $data['severity'],
|
355 |
-
'fixable' => $data['fixable'],
|
356 |
-
'type' => 'WARNING',
|
357 |
-
);
|
358 |
-
}//end foreach
|
359 |
-
|
360 |
-
if (isset($errors[$line]) === false) {
|
361 |
-
$errors[$line] = array();
|
362 |
-
}
|
363 |
-
|
364 |
-
if (isset($errors[$line][$column]) === true) {
|
365 |
-
$errors[$line][$column] = array_merge(
|
366 |
-
$newWarnings,
|
367 |
-
$errors[$line][$column]
|
368 |
-
);
|
369 |
-
} else {
|
370 |
-
$errors[$line][$column] = $newWarnings;
|
371 |
-
}
|
372 |
-
}//end foreach
|
373 |
-
|
374 |
-
ksort($errors[$line]);
|
375 |
-
}//end foreach
|
376 |
-
|
377 |
-
ksort($errors);
|
378 |
-
$report['messages'] = $errors;
|
379 |
-
return $report;
|
380 |
-
|
381 |
-
}//end prepareFileReport()
|
382 |
-
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Start recording time for the run.
|
386 |
-
*
|
387 |
-
* @return void
|
388 |
-
*/
|
389 |
-
public static function startTiming()
|
390 |
-
{
|
391 |
-
|
392 |
-
self::$startTime = microtime(true);
|
393 |
-
|
394 |
-
}//end startTiming()
|
395 |
-
|
396 |
-
|
397 |
-
/**
|
398 |
-
* Print information about the run.
|
399 |
-
*
|
400 |
-
* @return void
|
401 |
-
*/
|
402 |
-
public static function printRunTime()
|
403 |
-
{
|
404 |
-
$time = ((microtime(true) - self::$startTime) * 1000);
|
405 |
-
|
406 |
-
if ($time > 60000) {
|
407 |
-
$mins = floor($time / 60000);
|
408 |
-
$secs = round((($time % 60000) / 1000), 2);
|
409 |
-
$time = $mins.' mins';
|
410 |
-
if ($secs !== 0) {
|
411 |
-
$time .= ", $secs secs";
|
412 |
-
}
|
413 |
-
} else if ($time > 1000) {
|
414 |
-
$time = round(($time / 1000), 2).' secs';
|
415 |
-
} else {
|
416 |
-
$time = round($time).'ms';
|
417 |
-
}
|
418 |
-
|
419 |
-
$mem = round((memory_get_peak_usage(true) / (1024 * 1024)), 2).'Mb';
|
420 |
-
echo "Time: $time; Memory: $mem".PHP_EOL.PHP_EOL;
|
421 |
-
|
422 |
-
}//end printRunTime()
|
423 |
-
|
424 |
-
|
425 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Cbf.php
DELETED
@@ -1,151 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CBF report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* This report implements the various auto-fixing features of the
|
6 |
-
* PHPCBF script and is not intended (or allowed) to be selected as a
|
7 |
-
* report from the command line.
|
8 |
-
*
|
9 |
-
* PHP version 5
|
10 |
-
*
|
11 |
-
* @category PHP
|
12 |
-
* @package PHP_CodeSniffer
|
13 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
14 |
-
* @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)
|
15 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
16 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
17 |
-
*/
|
18 |
-
|
19 |
-
/**
|
20 |
-
* CBF report for PHP_CodeSniffer.
|
21 |
-
*
|
22 |
-
* This report implements the various auto-fixing features of the
|
23 |
-
* PHPCBF script and is not intended (or allowed) to be selected as a
|
24 |
-
* report from the command line.
|
25 |
-
*
|
26 |
-
* PHP version 5
|
27 |
-
*
|
28 |
-
* @category PHP
|
29 |
-
* @package PHP_CodeSniffer
|
30 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
31 |
-
* @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)
|
32 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
33 |
-
* @version Release: @package_version@
|
34 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
35 |
-
*/
|
36 |
-
class PHP_CodeSniffer_Reports_Cbf implements PHP_CodeSniffer_Report
|
37 |
-
{
|
38 |
-
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Generate a partial report for a single processed file.
|
42 |
-
*
|
43 |
-
* Function should return TRUE if it printed or stored data about the file
|
44 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
45 |
-
* its data should be counted in the grand totals.
|
46 |
-
*
|
47 |
-
* @param array $report Prepared report data.
|
48 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
49 |
-
* @param boolean $showSources Show sources?
|
50 |
-
* @param int $width Maximum allowed line width.
|
51 |
-
*
|
52 |
-
* @return boolean
|
53 |
-
*/
|
54 |
-
public function generateFileReport(
|
55 |
-
$report,
|
56 |
-
PHP_CodeSniffer_File $phpcsFile,
|
57 |
-
$showSources=false,
|
58 |
-
$width=80
|
59 |
-
) {
|
60 |
-
$cliValues = $phpcsFile->phpcs->cli->getCommandLineValues();
|
61 |
-
$errors = $phpcsFile->getFixableCount();
|
62 |
-
if ($errors !== 0) {
|
63 |
-
if (empty($cliValues['files']) === false) {
|
64 |
-
ob_end_clean();
|
65 |
-
$errors = $phpcsFile->getFixableCount();
|
66 |
-
$startTime = microtime(true);
|
67 |
-
echo "\t=> Fixing file: $errors/$errors violations remaining";
|
68 |
-
}
|
69 |
-
|
70 |
-
$fixed = $phpcsFile->fixer->fixFile();
|
71 |
-
}
|
72 |
-
|
73 |
-
if (empty($cliValues['files']) === true) {
|
74 |
-
// Replacing STDIN, so output current file to STDOUT
|
75 |
-
// even if nothing was fixed. Exit here because we
|
76 |
-
// can't process any more than 1 file in this setup.
|
77 |
-
echo $phpcsFile->fixer->getContents();
|
78 |
-
ob_end_flush();
|
79 |
-
exit(1);
|
80 |
-
}
|
81 |
-
|
82 |
-
if ($errors === 0) {
|
83 |
-
return false;
|
84 |
-
}
|
85 |
-
|
86 |
-
if ($fixed === false) {
|
87 |
-
echo 'ERROR';
|
88 |
-
} else {
|
89 |
-
echo 'DONE';
|
90 |
-
}
|
91 |
-
|
92 |
-
$timeTaken = ((microtime(true) - $startTime) * 1000);
|
93 |
-
if ($timeTaken < 1000) {
|
94 |
-
$timeTaken = round($timeTaken);
|
95 |
-
echo " in {$timeTaken}ms".PHP_EOL;
|
96 |
-
} else {
|
97 |
-
$timeTaken = round(($timeTaken / 1000), 2);
|
98 |
-
echo " in $timeTaken secs".PHP_EOL;
|
99 |
-
}
|
100 |
-
|
101 |
-
if ($fixed === true) {
|
102 |
-
$newFilename = $report['filename'].$cliValues['phpcbf-suffix'];
|
103 |
-
$newContent = $phpcsFile->fixer->getContents();
|
104 |
-
file_put_contents($newFilename, $newContent);
|
105 |
-
|
106 |
-
if ($newFilename === $report['filename']) {
|
107 |
-
echo "\t=> File was overwritten".PHP_EOL;
|
108 |
-
} else {
|
109 |
-
echo "\t=> Fixed file written to ".basename($newFilename).PHP_EOL;
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
ob_start();
|
114 |
-
|
115 |
-
return $fixed;
|
116 |
-
|
117 |
-
}//end generateFileReport()
|
118 |
-
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Prints all errors and warnings for each file processed.
|
122 |
-
*
|
123 |
-
* @param string $cachedData Any partial report data that was returned from
|
124 |
-
* generateFileReport during the run.
|
125 |
-
* @param int $totalFiles Total number of files processed during the run.
|
126 |
-
* @param int $totalErrors Total number of errors found during the run.
|
127 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
128 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
129 |
-
* @param boolean $showSources Show sources?
|
130 |
-
* @param int $width Maximum allowed line width.
|
131 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
132 |
-
*
|
133 |
-
* @return void
|
134 |
-
*/
|
135 |
-
public function generate(
|
136 |
-
$cachedData,
|
137 |
-
$totalFiles,
|
138 |
-
$totalErrors,
|
139 |
-
$totalWarnings,
|
140 |
-
$totalFixable,
|
141 |
-
$showSources=false,
|
142 |
-
$width=80,
|
143 |
-
$toScreen=true
|
144 |
-
) {
|
145 |
-
echo $cachedData;
|
146 |
-
echo "Fixed $totalFiles files".PHP_EOL;
|
147 |
-
|
148 |
-
}//end generate()
|
149 |
-
|
150 |
-
|
151 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Checkstyle.php
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Checkstyle report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Checkstyle report for PHP_CodeSniffer.
|
19 |
-
*
|
20 |
-
* PHP version 5
|
21 |
-
*
|
22 |
-
* @category PHP
|
23 |
-
* @package PHP_CodeSniffer
|
24 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
25 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
26 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
27 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
28 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
29 |
-
* @version Release: @package_version@
|
30 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
31 |
-
*/
|
32 |
-
class PHP_CodeSniffer_Reports_Checkstyle implements PHP_CodeSniffer_Report
|
33 |
-
{
|
34 |
-
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Generate a partial report for a single processed file.
|
38 |
-
*
|
39 |
-
* Function should return TRUE if it printed or stored data about the file
|
40 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
41 |
-
* its data should be counted in the grand totals.
|
42 |
-
*
|
43 |
-
* @param array $report Prepared report data.
|
44 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
45 |
-
* @param boolean $showSources Show sources?
|
46 |
-
* @param int $width Maximum allowed line width.
|
47 |
-
*
|
48 |
-
* @return boolean
|
49 |
-
*/
|
50 |
-
public function generateFileReport(
|
51 |
-
$report,
|
52 |
-
PHP_CodeSniffer_File $phpcsFile,
|
53 |
-
$showSources=false,
|
54 |
-
$width=80
|
55 |
-
) {
|
56 |
-
$out = new XMLWriter;
|
57 |
-
$out->openMemory();
|
58 |
-
$out->setIndent(true);
|
59 |
-
|
60 |
-
if ($report['errors'] === 0 && $report['warnings'] === 0) {
|
61 |
-
// Nothing to print.
|
62 |
-
return false;
|
63 |
-
}
|
64 |
-
|
65 |
-
$out->startElement('file');
|
66 |
-
$out->writeAttribute('name', $report['filename']);
|
67 |
-
|
68 |
-
foreach ($report['messages'] as $line => $lineErrors) {
|
69 |
-
foreach ($lineErrors as $column => $colErrors) {
|
70 |
-
foreach ($colErrors as $error) {
|
71 |
-
$error['type'] = strtolower($error['type']);
|
72 |
-
if (PHP_CODESNIFFER_ENCODING !== 'utf-8') {
|
73 |
-
$error['message'] = iconv(PHP_CODESNIFFER_ENCODING, 'utf-8', $error['message']);
|
74 |
-
}
|
75 |
-
|
76 |
-
$out->startElement('error');
|
77 |
-
$out->writeAttribute('line', $line);
|
78 |
-
$out->writeAttribute('column', $column);
|
79 |
-
$out->writeAttribute('severity', $error['type']);
|
80 |
-
$out->writeAttribute('message', $error['message']);
|
81 |
-
$out->writeAttribute('source', $error['source']);
|
82 |
-
$out->endElement();
|
83 |
-
}
|
84 |
-
}
|
85 |
-
}//end foreach
|
86 |
-
|
87 |
-
$out->endElement();
|
88 |
-
echo $out->flush();
|
89 |
-
|
90 |
-
return true;
|
91 |
-
|
92 |
-
}//end generateFileReport()
|
93 |
-
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Prints all violations for processed files, in a Checkstyle format.
|
97 |
-
*
|
98 |
-
* @param string $cachedData Any partial report data that was returned from
|
99 |
-
* generateFileReport during the run.
|
100 |
-
* @param int $totalFiles Total number of files processed during the run.
|
101 |
-
* @param int $totalErrors Total number of errors found during the run.
|
102 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
103 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
104 |
-
* @param boolean $showSources Show sources?
|
105 |
-
* @param int $width Maximum allowed line width.
|
106 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
107 |
-
*
|
108 |
-
* @return void
|
109 |
-
*/
|
110 |
-
public function generate(
|
111 |
-
$cachedData,
|
112 |
-
$totalFiles,
|
113 |
-
$totalErrors,
|
114 |
-
$totalWarnings,
|
115 |
-
$totalFixable,
|
116 |
-
$showSources=false,
|
117 |
-
$width=80,
|
118 |
-
$toScreen=true
|
119 |
-
) {
|
120 |
-
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
121 |
-
echo '<checkstyle version="'.PHP_CodeSniffer::VERSION.'">'.PHP_EOL;
|
122 |
-
echo $cachedData;
|
123 |
-
echo '</checkstyle>'.PHP_EOL;
|
124 |
-
|
125 |
-
}//end generate()
|
126 |
-
|
127 |
-
|
128 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Csv.php
DELETED
@@ -1,111 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Csv report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Csv report for PHP_CodeSniffer.
|
19 |
-
*
|
20 |
-
* PHP version 5
|
21 |
-
*
|
22 |
-
* @category PHP
|
23 |
-
* @package PHP_CodeSniffer
|
24 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
25 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
26 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
27 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
28 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
29 |
-
* @version Release: @package_version@
|
30 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
31 |
-
*/
|
32 |
-
class PHP_CodeSniffer_Reports_Csv implements PHP_CodeSniffer_Report
|
33 |
-
{
|
34 |
-
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Generate a partial report for a single processed file.
|
38 |
-
*
|
39 |
-
* Function should return TRUE if it printed or stored data about the file
|
40 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
41 |
-
* its data should be counted in the grand totals.
|
42 |
-
*
|
43 |
-
* @param array $report Prepared report data.
|
44 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
45 |
-
* @param boolean $showSources Show sources?
|
46 |
-
* @param int $width Maximum allowed line width.
|
47 |
-
*
|
48 |
-
* @return boolean
|
49 |
-
*/
|
50 |
-
public function generateFileReport(
|
51 |
-
$report,
|
52 |
-
PHP_CodeSniffer_File $phpcsFile,
|
53 |
-
$showSources=false,
|
54 |
-
$width=80
|
55 |
-
) {
|
56 |
-
if ($report['errors'] === 0 && $report['warnings'] === 0) {
|
57 |
-
// Nothing to print.
|
58 |
-
return false;
|
59 |
-
}
|
60 |
-
|
61 |
-
foreach ($report['messages'] as $line => $lineErrors) {
|
62 |
-
foreach ($lineErrors as $column => $colErrors) {
|
63 |
-
foreach ($colErrors as $error) {
|
64 |
-
$filename = str_replace('"', '\"', $report['filename']);
|
65 |
-
$message = str_replace('"', '\"', $error['message']);
|
66 |
-
$type = strtolower($error['type']);
|
67 |
-
$source = $error['source'];
|
68 |
-
$severity = $error['severity'];
|
69 |
-
$fixable = (int) $error['fixable'];
|
70 |
-
echo "\"$filename\",$line,$column,$type,\"$message\",$source,$severity,$fixable".PHP_EOL;
|
71 |
-
}
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
return true;
|
76 |
-
|
77 |
-
}//end generateFileReport()
|
78 |
-
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Generates a csv report.
|
82 |
-
*
|
83 |
-
* @param string $cachedData Any partial report data that was returned from
|
84 |
-
* generateFileReport during the run.
|
85 |
-
* @param int $totalFiles Total number of files processed during the run.
|
86 |
-
* @param int $totalErrors Total number of errors found during the run.
|
87 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
88 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
89 |
-
* @param boolean $showSources Show sources?
|
90 |
-
* @param int $width Maximum allowed line width.
|
91 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
92 |
-
*
|
93 |
-
* @return void
|
94 |
-
*/
|
95 |
-
public function generate(
|
96 |
-
$cachedData,
|
97 |
-
$totalFiles,
|
98 |
-
$totalErrors,
|
99 |
-
$totalWarnings,
|
100 |
-
$totalFixable,
|
101 |
-
$showSources=false,
|
102 |
-
$width=80,
|
103 |
-
$toScreen=true
|
104 |
-
) {
|
105 |
-
echo 'File,Line,Column,Type,Message,Source,Severity,Fixable'.PHP_EOL;
|
106 |
-
echo $cachedData;
|
107 |
-
|
108 |
-
}//end generate()
|
109 |
-
|
110 |
-
|
111 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Diff.php
DELETED
@@ -1,149 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Diff report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
10 |
-
* @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)
|
11 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
12 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Diff report for PHP_CodeSniffer.
|
17 |
-
*
|
18 |
-
* PHP version 5
|
19 |
-
*
|
20 |
-
* @category PHP
|
21 |
-
* @package PHP_CodeSniffer
|
22 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
23 |
-
* @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)
|
24 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
25 |
-
* @version Release: @package_version@
|
26 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
27 |
-
*/
|
28 |
-
class PHP_CodeSniffer_Reports_Diff implements PHP_CodeSniffer_Report
|
29 |
-
{
|
30 |
-
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Generate a partial report for a single processed file.
|
34 |
-
*
|
35 |
-
* Function should return TRUE if it printed or stored data about the file
|
36 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
37 |
-
* its data should be counted in the grand totals.
|
38 |
-
*
|
39 |
-
* @param array $report Prepared report data.
|
40 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
41 |
-
* @param boolean $showSources Show sources?
|
42 |
-
* @param int $width Maximum allowed line width.
|
43 |
-
*
|
44 |
-
* @return boolean
|
45 |
-
*/
|
46 |
-
public function generateFileReport(
|
47 |
-
$report,
|
48 |
-
PHP_CodeSniffer_File $phpcsFile,
|
49 |
-
$showSources=false,
|
50 |
-
$width=80
|
51 |
-
) {
|
52 |
-
$errors = $phpcsFile->getFixableCount();
|
53 |
-
if ($errors === 0) {
|
54 |
-
return false;
|
55 |
-
}
|
56 |
-
|
57 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
58 |
-
ob_end_clean();
|
59 |
-
echo "\t*** START FILE FIXING ***".PHP_EOL;
|
60 |
-
}
|
61 |
-
|
62 |
-
if (PHP_CODESNIFFER_CBF === true) {
|
63 |
-
ob_end_clean();
|
64 |
-
$startTime = microtime(true);
|
65 |
-
echo "\t=> Fixing file: $errors/$errors violations remaining";
|
66 |
-
}
|
67 |
-
|
68 |
-
$fixed = $phpcsFile->fixer->fixFile();
|
69 |
-
|
70 |
-
if (PHP_CODESNIFFER_CBF === true) {
|
71 |
-
if ($fixed === false) {
|
72 |
-
echo "\033[31mERROR\033[0m";
|
73 |
-
} else {
|
74 |
-
echo "\033[32mDONE\033[0m";
|
75 |
-
}
|
76 |
-
|
77 |
-
$timeTaken = ((microtime(true) - $startTime) * 1000);
|
78 |
-
if ($timeTaken < 1000) {
|
79 |
-
$timeTaken = round($timeTaken);
|
80 |
-
echo " in {$timeTaken}ms".PHP_EOL;
|
81 |
-
} else {
|
82 |
-
$timeTaken = round(($timeTaken / 1000), 2);
|
83 |
-
echo " in $timeTaken secs".PHP_EOL;
|
84 |
-
}
|
85 |
-
|
86 |
-
ob_start();
|
87 |
-
}
|
88 |
-
|
89 |
-
if (PHP_CODESNIFFER_VERBOSITY > 1) {
|
90 |
-
echo "\t*** END FILE FIXING ***".PHP_EOL;
|
91 |
-
ob_start();
|
92 |
-
}
|
93 |
-
|
94 |
-
if ($fixed === false) {
|
95 |
-
return false;
|
96 |
-
}
|
97 |
-
|
98 |
-
if (PHP_CODESNIFFER_CBF === true) {
|
99 |
-
// Diff without colours.
|
100 |
-
$diff = $phpcsFile->fixer->generateDiff(null, false);
|
101 |
-
} else {
|
102 |
-
$diff = $phpcsFile->fixer->generateDiff();
|
103 |
-
}
|
104 |
-
|
105 |
-
if ($diff === '') {
|
106 |
-
// Nothing to print.
|
107 |
-
return false;
|
108 |
-
}
|
109 |
-
|
110 |
-
echo $diff.PHP_EOL;
|
111 |
-
return true;
|
112 |
-
|
113 |
-
}//end generateFileReport()
|
114 |
-
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Prints all errors and warnings for each file processed.
|
118 |
-
*
|
119 |
-
* @param string $cachedData Any partial report data that was returned from
|
120 |
-
* generateFileReport during the run.
|
121 |
-
* @param int $totalFiles Total number of files processed during the run.
|
122 |
-
* @param int $totalErrors Total number of errors found during the run.
|
123 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
124 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
125 |
-
* @param boolean $showSources Show sources?
|
126 |
-
* @param int $width Maximum allowed line width.
|
127 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
128 |
-
*
|
129 |
-
* @return void
|
130 |
-
*/
|
131 |
-
public function generate(
|
132 |
-
$cachedData,
|
133 |
-
$totalFiles,
|
134 |
-
$totalErrors,
|
135 |
-
$totalWarnings,
|
136 |
-
$totalFixable,
|
137 |
-
$showSources=false,
|
138 |
-
$width=80,
|
139 |
-
$toScreen=true
|
140 |
-
) {
|
141 |
-
echo $cachedData;
|
142 |
-
if ($toScreen === true) {
|
143 |
-
echo PHP_EOL;
|
144 |
-
}
|
145 |
-
|
146 |
-
}//end generate()
|
147 |
-
|
148 |
-
|
149 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Emacs.php
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Emacs report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Emacs report for PHP_CodeSniffer.
|
19 |
-
*
|
20 |
-
* PHP version 5
|
21 |
-
*
|
22 |
-
* @category PHP
|
23 |
-
* @package PHP_CodeSniffer
|
24 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
25 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
26 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
27 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
28 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
29 |
-
* @version Release: @package_version@
|
30 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
31 |
-
*/
|
32 |
-
class PHP_CodeSniffer_Reports_Emacs implements PHP_CodeSniffer_Report
|
33 |
-
{
|
34 |
-
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Generate a partial report for a single processed file.
|
38 |
-
*
|
39 |
-
* Function should return TRUE if it printed or stored data about the file
|
40 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
41 |
-
* its data should be counted in the grand totals.
|
42 |
-
*
|
43 |
-
* @param array $report Prepared report data.
|
44 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
45 |
-
* @param boolean $showSources Show sources?
|
46 |
-
* @param int $width Maximum allowed line width.
|
47 |
-
*
|
48 |
-
* @return boolean
|
49 |
-
*/
|
50 |
-
public function generateFileReport(
|
51 |
-
$report,
|
52 |
-
PHP_CodeSniffer_File $phpcsFile,
|
53 |
-
$showSources=false,
|
54 |
-
$width=80
|
55 |
-
) {
|
56 |
-
if ($report['errors'] === 0 && $report['warnings'] === 0) {
|
57 |
-
// Nothing to print.
|
58 |
-
return false;
|
59 |
-
}
|
60 |
-
|
61 |
-
foreach ($report['messages'] as $line => $lineErrors) {
|
62 |
-
foreach ($lineErrors as $column => $colErrors) {
|
63 |
-
foreach ($colErrors as $error) {
|
64 |
-
$message = $error['message'];
|
65 |
-
if ($showSources === true) {
|
66 |
-
$message .= ' ('.$error['source'].')';
|
67 |
-
}
|
68 |
-
|
69 |
-
$type = strtolower($error['type']);
|
70 |
-
echo $report['filename'].':'.$line.':'.$column.': '.$type.' - '.$message.PHP_EOL;
|
71 |
-
}
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
return true;
|
76 |
-
|
77 |
-
}//end generateFileReport()
|
78 |
-
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Generates an emacs report.
|
82 |
-
*
|
83 |
-
* @param string $cachedData Any partial report data that was returned from
|
84 |
-
* generateFileReport during the run.
|
85 |
-
* @param int $totalFiles Total number of files processed during the run.
|
86 |
-
* @param int $totalErrors Total number of errors found during the run.
|
87 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
88 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
89 |
-
* @param boolean $showSources Show sources?
|
90 |
-
* @param int $width Maximum allowed line width.
|
91 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
92 |
-
*
|
93 |
-
* @return void
|
94 |
-
*/
|
95 |
-
public function generate(
|
96 |
-
$cachedData,
|
97 |
-
$totalFiles,
|
98 |
-
$totalErrors,
|
99 |
-
$totalWarnings,
|
100 |
-
$totalFixable,
|
101 |
-
$showSources=false,
|
102 |
-
$width=80,
|
103 |
-
$toScreen=true
|
104 |
-
) {
|
105 |
-
echo $cachedData;
|
106 |
-
|
107 |
-
}//end generate()
|
108 |
-
|
109 |
-
|
110 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Full.php
DELETED
@@ -1,237 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Full report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Full report for PHP_CodeSniffer.
|
19 |
-
*
|
20 |
-
* PHP version 5
|
21 |
-
*
|
22 |
-
* @category PHP
|
23 |
-
* @package PHP_CodeSniffer
|
24 |
-
* @author Gabriele Santini <gsantini@sqli.com>
|
25 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
26 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
27 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
28 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
29 |
-
* @version Release: @package_version@
|
30 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
31 |
-
*/
|
32 |
-
class PHP_CodeSniffer_Reports_Full implements PHP_CodeSniffer_Report
|
33 |
-
{
|
34 |
-
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Generate a partial report for a single processed file.
|
38 |
-
*
|
39 |
-
* Function should return TRUE if it printed or stored data about the file
|
40 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
41 |
-
* its data should be counted in the grand totals.
|
42 |
-
*
|
43 |
-
* @param array $report Prepared report data.
|
44 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
45 |
-
* @param boolean $showSources Show sources?
|
46 |
-
* @param int $width Maximum allowed line width.
|
47 |
-
*
|
48 |
-
* @return boolean
|
49 |
-
*/
|
50 |
-
public function generateFileReport(
|
51 |
-
$report,
|
52 |
-
PHP_CodeSniffer_File $phpcsFile,
|
53 |
-
$showSources=false,
|
54 |
-
$width=80
|
55 |
-
) {
|
56 |
-
if ($report['errors'] === 0 && $report['warnings'] === 0) {
|
57 |
-
// Nothing to print.
|
58 |
-
return false;
|
59 |
-
}
|
60 |
-
|
61 |
-
// The length of the word ERROR or WARNING; used for padding.
|
62 |
-
if ($report['warnings'] > 0) {
|
63 |
-
$typeLength = 7;
|
64 |
-
} else {
|
65 |
-
$typeLength = 5;
|
66 |
-
}
|
67 |
-
|
68 |
-
// Work out the max line number length for formatting.
|
69 |
-
$maxLineNumLength = max(array_map('strlen', array_keys($report['messages'])));
|
70 |
-
|
71 |
-
// The padding that all lines will require that are
|
72 |
-
// printing an error message overflow.
|
73 |
-
$paddingLine2 = str_repeat(' ', ($maxLineNumLength + 1));
|
74 |
-
$paddingLine2 .= ' | ';
|
75 |
-
$paddingLine2 .= str_repeat(' ', $typeLength);
|
76 |
-
$paddingLine2 .= ' | ';
|
77 |
-
if ($report['fixable'] > 0) {
|
78 |
-
$paddingLine2 .= ' ';
|
79 |
-
}
|
80 |
-
|
81 |
-
$paddingLength = strlen($paddingLine2);
|
82 |
-
|
83 |
-
// Make sure the report width isn't too big.
|
84 |
-
$maxErrorLength = 0;
|
85 |
-
foreach ($report['messages'] as $line => $lineErrors) {
|
86 |
-
foreach ($lineErrors as $column => $colErrors) {
|
87 |
-
foreach ($colErrors as $error) {
|
88 |
-
$length = strlen($error['message']);
|
89 |
-
if ($showSources === true) {
|
90 |
-
$length += (strlen($error['source']) + 3);
|
91 |
-
}
|
92 |
-
|
93 |
-
$maxErrorLength = max($maxErrorLength, ($length + 1));
|
94 |
-
}
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
-
$file = $report['filename'];
|
99 |
-
$fileLength = strlen($file);
|
100 |
-
$maxWidth = max(($fileLength + 6), ($maxErrorLength + $paddingLength));
|
101 |
-
$width = min($width, $maxWidth);
|
102 |
-
if ($width < 70) {
|
103 |
-
$width = 70;
|
104 |
-
}
|
105 |
-
|
106 |
-
echo PHP_EOL."\033[1mFILE: ";
|
107 |
-
if ($fileLength <= ($width - 6)) {
|
108 |
-
echo $file;
|
109 |
-
} else {
|
110 |
-
echo '...'.substr($file, ($fileLength - ($width - 6)));
|
111 |
-
}
|
112 |
-
|
113 |
-
echo "\033[0m".PHP_EOL;
|
114 |
-
echo str_repeat('-', $width).PHP_EOL;
|
115 |
-
|
116 |
-
echo "\033[1m".'FOUND '.$report['errors'].' ERROR';
|
117 |
-
if ($report['errors'] !== 1) {
|
118 |
-
echo 'S';
|
119 |
-
}
|
120 |
-
|
121 |
-
if ($report['warnings'] > 0) {
|
122 |
-
echo ' AND '.$report['warnings'].' WARNING';
|
123 |
-
if ($report['warnings'] !== 1) {
|
124 |
-
echo 'S';
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
echo ' AFFECTING '.count($report['messages']).' LINE';
|
129 |
-
if (count($report['messages']) !== 1) {
|
130 |
-
echo 'S';
|
131 |
-
}
|
132 |
-
|
133 |
-
echo "\033[0m".PHP_EOL;
|
134 |
-
echo str_repeat('-', $width).PHP_EOL;
|
135 |
-
|
136 |
-
// The maximum amount of space an error message can use.
|
137 |
-
$maxErrorSpace = ($width - $paddingLength - 1);
|
138 |
-
if ($showSources === true) {
|
139 |
-
// Account for the chars used to print colors.
|
140 |
-
$maxErrorSpace += 8;
|
141 |
-
}
|
142 |
-
|
143 |
-
foreach ($report['messages'] as $line => $lineErrors) {
|
144 |
-
foreach ($lineErrors as $column => $colErrors) {
|
145 |
-
foreach ($colErrors as $error) {
|
146 |
-
$message = $error['message'];
|
147 |
-
$message = str_replace("\n", "\n".$paddingLine2, $message);
|
148 |
-
if ($showSources === true) {
|
149 |
-
$message = "\033[1m".$message."\033[0m".' ('.$error['source'].')';
|
150 |
-
}
|
151 |
-
|
152 |
-
// The padding that goes on the front of the line.
|
153 |
-
$padding = ($maxLineNumLength - strlen($line));
|
154 |
-
$errorMsg = wordwrap(
|
155 |
-
$message,
|
156 |
-
$maxErrorSpace,
|
157 |
-
PHP_EOL.$paddingLine2
|
158 |
-
);
|
159 |
-
|
160 |
-
echo ' '.str_repeat(' ', $padding).$line.' | ';
|
161 |
-
if ($error['type'] === 'ERROR') {
|
162 |
-
echo "\033[31mERROR\033[0m";
|
163 |
-
if ($report['warnings'] > 0) {
|
164 |
-
echo ' ';
|
165 |
-
}
|
166 |
-
} else {
|
167 |
-
echo "\033[33mWARNING\033[0m";
|
168 |
-
}
|
169 |
-
|
170 |
-
echo ' | ';
|
171 |
-
if ($report['fixable'] > 0) {
|
172 |
-
echo '[';
|
173 |
-
if ($error['fixable'] === true) {
|
174 |
-
echo 'x';
|
175 |
-
} else {
|
176 |
-
echo ' ';
|
177 |
-
}
|
178 |
-
|
179 |
-
echo '] ';
|
180 |
-
}
|
181 |
-
|
182 |
-
echo $errorMsg.PHP_EOL;
|
183 |
-
}//end foreach
|
184 |
-
}//end foreach
|
185 |
-
}//end foreach
|
186 |
-
|
187 |
-
echo str_repeat('-', $width).PHP_EOL;
|
188 |
-
if ($report['fixable'] > 0) {
|
189 |
-
echo "\033[1m".'PHPCBF CAN FIX THE '.$report['fixable'].' MARKED SNIFF VIOLATIONS AUTOMATICALLY'."\033[0m".PHP_EOL;
|
190 |
-
echo str_repeat('-', $width).PHP_EOL;
|
191 |
-
}
|
192 |
-
|
193 |
-
echo PHP_EOL;
|
194 |
-
return true;
|
195 |
-
|
196 |
-
}//end generateFileReport()
|
197 |
-
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Prints all errors and warnings for each file processed.
|
201 |
-
*
|
202 |
-
* @param string $cachedData Any partial report data that was returned from
|
203 |
-
* generateFileReport during the run.
|
204 |
-
* @param int $totalFiles Total number of files processed during the run.
|
205 |
-
* @param int $totalErrors Total number of errors found during the run.
|
206 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
207 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
208 |
-
* @param boolean $showSources Show sources?
|
209 |
-
* @param int $width Maximum allowed line width.
|
210 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
211 |
-
*
|
212 |
-
* @return void
|
213 |
-
*/
|
214 |
-
public function generate(
|
215 |
-
$cachedData,
|
216 |
-
$totalFiles,
|
217 |
-
$totalErrors,
|
218 |
-
$totalWarnings,
|
219 |
-
$totalFixable,
|
220 |
-
$showSources=false,
|
221 |
-
$width=80,
|
222 |
-
$toScreen=true
|
223 |
-
) {
|
224 |
-
if ($cachedData === '') {
|
225 |
-
return;
|
226 |
-
}
|
227 |
-
|
228 |
-
echo $cachedData;
|
229 |
-
|
230 |
-
if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
|
231 |
-
PHP_CodeSniffer_Reporting::printRunTime();
|
232 |
-
}
|
233 |
-
|
234 |
-
}//end generate()
|
235 |
-
|
236 |
-
|
237 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Gitblame.php
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Gitblame report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Ben Selby <benmatselby@gmail.com>
|
10 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
11 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
12 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
13 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
14 |
-
*/
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Gitblame report for PHP_CodeSniffer.
|
18 |
-
*
|
19 |
-
* PHP version 5
|
20 |
-
*
|
21 |
-
* @category PHP
|
22 |
-
* @package PHP_CodeSniffer
|
23 |
-
* @author Ben Selby <benmatselby@gmail.com>
|
24 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
25 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
26 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
27 |
-
* @version Release: 1.2.2
|
28 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
29 |
-
*/
|
30 |
-
class PHP_CodeSniffer_Reports_Gitblame extends PHP_CodeSniffer_Reports_VersionControl
|
31 |
-
{
|
32 |
-
|
33 |
-
/**
|
34 |
-
* The name of the report we want in the output
|
35 |
-
*
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
protected $reportName = 'GIT';
|
39 |
-
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Extract the author from a blame line.
|
43 |
-
*
|
44 |
-
* @param string $line Line to parse.
|
45 |
-
*
|
46 |
-
* @return mixed string or false if impossible to recover.
|
47 |
-
*/
|
48 |
-
protected function getAuthor($line)
|
49 |
-
{
|
50 |
-
$blameParts = array();
|
51 |
-
$line = preg_replace('|\s+|', ' ', $line);
|
52 |
-
preg_match(
|
53 |
-
'|\(.+[0-9]{4}-[0-9]{2}-[0-9]{2}\s+[0-9]+\)|',
|
54 |
-
$line,
|
55 |
-
$blameParts
|
56 |
-
);
|
57 |
-
|
58 |
-
if (isset($blameParts[0]) === false) {
|
59 |
-
return false;
|
60 |
-
}
|
61 |
-
|
62 |
-
$parts = explode(' ', $blameParts[0]);
|
63 |
-
|
64 |
-
if (count($parts) < 2) {
|
65 |
-
return false;
|
66 |
-
}
|
67 |
-
|
68 |
-
$parts = array_slice($parts, 0, (count($parts) - 2));
|
69 |
-
$author = preg_replace('|\(|', '', implode($parts, ' '));
|
70 |
-
return $author;
|
71 |
-
|
72 |
-
}//end getAuthor()
|
73 |
-
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Gets the blame output.
|
77 |
-
*
|
78 |
-
* @param string $filename File to blame.
|
79 |
-
*
|
80 |
-
* @return array
|
81 |
-
*/
|
82 |
-
protected function getBlameContent($filename)
|
83 |
-
{
|
84 |
-
$cwd = getcwd();
|
85 |
-
|
86 |
-
chdir(dirname($filename));
|
87 |
-
$command = 'git blame --date=short "'.$filename.'" 2>&1';
|
88 |
-
$handle = popen($command, 'r');
|
89 |
-
if ($handle === false) {
|
90 |
-
echo 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
|
91 |
-
exit(2);
|
92 |
-
}
|
93 |
-
|
94 |
-
$rawContent = stream_get_contents($handle);
|
95 |
-
fclose($handle);
|
96 |
-
|
97 |
-
$blames = explode("\n", $rawContent);
|
98 |
-
chdir($cwd);
|
99 |
-
|
100 |
-
return $blames;
|
101 |
-
|
102 |
-
}//end getBlameContent()
|
103 |
-
|
104 |
-
|
105 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Hgblame.php
DELETED
@@ -1,124 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Mercurial report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Ben Selby <benmatselby@gmail.com>
|
10 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
11 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
12 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
13 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
14 |
-
*/
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Mercurial report for PHP_CodeSniffer.
|
18 |
-
*
|
19 |
-
* PHP version 5
|
20 |
-
*
|
21 |
-
* @category PHP
|
22 |
-
* @package PHP_CodeSniffer
|
23 |
-
* @author Ben Selby <benmatselby@gmail.com>
|
24 |
-
* @copyright 2009-2014 SQLI <www.sqli.com>
|
25 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
26 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
27 |
-
* @version Release: @package_version@
|
28 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
29 |
-
*/
|
30 |
-
class PHP_CodeSniffer_Reports_Hgblame extends PHP_CodeSniffer_Reports_VersionControl
|
31 |
-
{
|
32 |
-
|
33 |
-
/**
|
34 |
-
* The name of the report we want in the output
|
35 |
-
*
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
protected $reportName = 'MERCURIAL';
|
39 |
-
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Extract the author from a blame line.
|
43 |
-
*
|
44 |
-
* @param string $line Line to parse.
|
45 |
-
*
|
46 |
-
* @return mixed string or false if impossible to recover.
|
47 |
-
*/
|
48 |
-
protected function getAuthor($line)
|
49 |
-
{
|
50 |
-
$blameParts = array();
|
51 |
-
$line = preg_replace('|\s+|', ' ', $line);
|
52 |
-
|
53 |
-
preg_match(
|
54 |
-
'|(.+[0-9]{2}:[0-9]{2}:[0-9]{2}\s[0-9]{4}\s.[0-9]{4}:)|',
|
55 |
-
$line,
|
56 |
-
$blameParts
|
57 |
-
);
|
58 |
-
|
59 |
-
if (isset($blameParts[0]) === false) {
|
60 |
-
return false;
|
61 |
-
}
|
62 |
-
|
63 |
-
$parts = explode(' ', $blameParts[0]);
|
64 |
-
|
65 |
-
if (count($parts) < 6) {
|
66 |
-
return false;
|
67 |
-
}
|
68 |
-
|
69 |
-
$parts = array_slice($parts, 0, (count($parts) - 6));
|
70 |
-
|
71 |
-
return trim(preg_replace('|<.+>|', '', implode($parts, ' ')));
|
72 |
-
|
73 |
-
}//end getAuthor()
|
74 |
-
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Gets the blame output.
|
78 |
-
*
|
79 |
-
* @param string $filename File to blame.
|
80 |
-
*
|
81 |
-
* @return array
|
82 |
-
*/
|
83 |
-
protected function getBlameContent($filename)
|
84 |
-
{
|
85 |
-
$cwd = getcwd();
|
86 |
-
|
87 |
-
$fileParts = explode(DIRECTORY_SEPARATOR, $filename);
|
88 |
-
$found = false;
|
89 |
-
$location = '';
|
90 |
-
while (empty($fileParts) === false) {
|
91 |
-
array_pop($fileParts);
|
92 |
-
$location = implode($fileParts, DIRECTORY_SEPARATOR);
|
93 |
-
if (is_dir($location.DIRECTORY_SEPARATOR.'.hg') === true) {
|
94 |
-
$found = true;
|
95 |
-
break;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
if ($found === true) {
|
100 |
-
chdir($location);
|
101 |
-
} else {
|
102 |
-
echo 'ERROR: Could not locate .hg directory '.PHP_EOL.PHP_EOL;
|
103 |
-
exit(2);
|
104 |
-
}
|
105 |
-
|
106 |
-
$command = 'hg blame -u -d -v "'.$filename.'" 2>&1';
|
107 |
-
$handle = popen($command, 'r');
|
108 |
-
if ($handle === false) {
|
109 |
-
echo 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
|
110 |
-
exit(2);
|
111 |
-
}
|
112 |
-
|
113 |
-
$rawContent = stream_get_contents($handle);
|
114 |
-
fclose($handle);
|
115 |
-
|
116 |
-
$blames = explode("\n", $rawContent);
|
117 |
-
chdir($cwd);
|
118 |
-
|
119 |
-
return $blames;
|
120 |
-
|
121 |
-
}//end getBlameContent()
|
122 |
-
|
123 |
-
|
124 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Info.php
DELETED
@@ -1,162 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Info report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
10 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
11 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
12 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Info report for PHP_CodeSniffer.
|
17 |
-
*
|
18 |
-
* PHP version 5
|
19 |
-
*
|
20 |
-
* @category PHP
|
21 |
-
* @package PHP_CodeSniffer
|
22 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
23 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
24 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
25 |
-
* @version Release: @package_version@
|
26 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
27 |
-
*/
|
28 |
-
class PHP_CodeSniffer_Reports_Info implements PHP_CodeSniffer_Report
|
29 |
-
{
|
30 |
-
|
31 |
-
/**
|
32 |
-
* TRUE if this report needs error messages instead of just totals.
|
33 |
-
*
|
34 |
-
* @var boolean
|
35 |
-
*/
|
36 |
-
public $recordErrors = false;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* A cache of metrics collected during the run.
|
40 |
-
*
|
41 |
-
* @var array
|
42 |
-
*/
|
43 |
-
private $_metricCache = array();
|
44 |
-
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Generate a partial report for a single processed file.
|
48 |
-
*
|
49 |
-
* Function should return TRUE if it printed or stored data about the file
|
50 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
51 |
-
* its data should be counted in the grand totals.
|
52 |
-
*
|
53 |
-
* @param array $report Prepared report data.
|
54 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
55 |
-
* @param boolean $showSources Show sources?
|
56 |
-
* @param int $width Maximum allowed line width.
|
57 |
-
*
|
58 |
-
* @return boolean
|
59 |
-
*/
|
60 |
-
public function generateFileReport(
|
61 |
-
$report,
|
62 |
-
PHP_CodeSniffer_File $phpcsFile,
|
63 |
-
$showSources=false,
|
64 |
-
$width=80
|
65 |
-
) {
|
66 |
-
$metrics = $phpcsFile->getMetrics();
|
67 |
-
foreach ($metrics as $metric => $data) {
|
68 |
-
if (isset($this->_metricCache[$metric]) === false) {
|
69 |
-
$this->_metricCache[$metric] = array();
|
70 |
-
}
|
71 |
-
|
72 |
-
foreach ($data['values'] as $value => $locations) {
|
73 |
-
$locations = array_unique($locations);
|
74 |
-
$count = count($locations);
|
75 |
-
|
76 |
-
if (isset($this->_metricCache[$metric][$value]) === false) {
|
77 |
-
$this->_metricCache[$metric][$value] = $count;
|
78 |
-
} else {
|
79 |
-
$this->_metricCache[$metric][$value] += $count;
|
80 |
-
}
|
81 |
-
}
|
82 |
-
}//end foreach
|
83 |
-
|
84 |
-
return true;
|
85 |
-
|
86 |
-
}//end generateFileReport()
|
87 |
-
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Prints the source of all errors and warnings.
|
91 |
-
*
|
92 |
-
* @param string $cachedData Any partial report data that was returned from
|
93 |
-
* generateFileReport during the run.
|
94 |
-
* @param int $totalFiles Total number of files processed during the run.
|
95 |
-
* @param int $totalErrors Total number of errors found during the run.
|
96 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
97 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
98 |
-
* @param boolean $showSources Show sources?
|
99 |
-
* @param int $width Maximum allowed line width.
|
100 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
101 |
-
*
|
102 |
-
* @return void
|
103 |
-
*/
|
104 |
-
public function generate(
|
105 |
-
$cachedData,
|
106 |
-
$totalFiles,
|
107 |
-
$totalErrors,
|
108 |
-
$totalWarnings,
|
109 |
-
$totalFixable,
|
110 |
-
$showSources=false,
|
111 |
-
$width=80,
|
112 |
-
$toScreen=true
|
113 |
-
) {
|
114 |
-
if (empty($this->_metricCache) === true) {
|
115 |
-
// Nothing to show.
|
116 |
-
return;
|
117 |
-
}
|
118 |
-
|
119 |
-
ksort($this->_metricCache);
|
120 |
-
|
121 |
-
echo PHP_EOL."\033[1m".'PHP CODE SNIFFER INFORMATION REPORT'."\033[0m".PHP_EOL;
|
122 |
-
echo str_repeat('-', 70).PHP_EOL;
|
123 |
-
|
124 |
-
foreach ($this->_metricCache as $metric => $values) {
|
125 |
-
$winner = '';
|
126 |
-
$winnerCount = 0;
|
127 |
-
$totalCount = 0;
|
128 |
-
foreach ($values as $value => $count) {
|
129 |
-
$totalCount += $count;
|
130 |
-
if ($count > $winnerCount) {
|
131 |
-
$winner = $value;
|
132 |
-
$winnerCount = $count;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
$winPercent = round(($winnerCount / $totalCount * 100), 2);
|
137 |
-
echo "$metric: \033[4m$winner\033[0m [$winnerCount/$totalCount, $winPercent%]".PHP_EOL;
|
138 |
-
|
139 |
-
asort($values);
|
140 |
-
$values = array_reverse($values, true);
|
141 |
-
foreach ($values as $value => $count) {
|
142 |
-
if ($value === $winner) {
|
143 |
-
continue;
|
144 |
-
}
|
145 |
-
|
146 |
-
$percent = round(($count / $totalCount * 100), 2);
|
147 |
-
echo "\t$value => $count ($percent%)".PHP_EOL;
|
148 |
-
}
|
149 |
-
|
150 |
-
echo PHP_EOL;
|
151 |
-
}//end foreach
|
152 |
-
|
153 |
-
echo str_repeat('-', 70).PHP_EOL;
|
154 |
-
|
155 |
-
if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
|
156 |
-
PHP_CodeSniffer_Reporting::printRunTime();
|
157 |
-
}
|
158 |
-
|
159 |
-
}//end generate()
|
160 |
-
|
161 |
-
|
162 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Json.php
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Json report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Jeffrey Fisher <jeffslofish@gmail.com>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
12 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
13 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
14 |
-
*/
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Json report for PHP_CodeSniffer.
|
18 |
-
*
|
19 |
-
* PHP version 5
|
20 |
-
*
|
21 |
-
* @category PHP
|
22 |
-
* @package PHP_CodeSniffer
|
23 |
-
* @author Jeffrey Fisher <jeffslofish@gmail.com>
|
24 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
25 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
26 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
27 |
-
* @version Release: @package_version@
|
28 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
29 |
-
*/
|
30 |
-
class PHP_CodeSniffer_Reports_Json implements PHP_CodeSniffer_Report
|
31 |
-
{
|
32 |
-
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Generate a partial report for a single processed file.
|
36 |
-
*
|
37 |
-
* Function should return TRUE if it printed or stored data about the file
|
38 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
39 |
-
* its data should be counted in the grand totals.
|
40 |
-
*
|
41 |
-
* @param array $report Prepared report data.
|
42 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
43 |
-
* @param boolean $showSources Show sources?
|
44 |
-
* @param int $width Maximum allowed line width.
|
45 |
-
*
|
46 |
-
* @return boolean
|
47 |
-
*/
|
48 |
-
public function generateFileReport(
|
49 |
-
$report,
|
50 |
-
PHP_CodeSniffer_File $phpcsFile,
|
51 |
-
$showSources=false,
|
52 |
-
$width=80
|
53 |
-
) {
|
54 |
-
$filename = str_replace('\\', '\\\\', $report['filename']);
|
55 |
-
$filename = str_replace('"', '\"', $filename);
|
56 |
-
$filename = str_replace('/', '\/', $filename);
|
57 |
-
echo '"'.$filename.'":{';
|
58 |
-
echo '"errors":'.$report['errors'].',"warnings":'.$report['warnings'].',"messages":[';
|
59 |
-
|
60 |
-
$messages = '';
|
61 |
-
foreach ($report['messages'] as $line => $lineErrors) {
|
62 |
-
foreach ($lineErrors as $column => $colErrors) {
|
63 |
-
foreach ($colErrors as $error) {
|
64 |
-
$error['message'] = str_replace('\\', '\\\\', $error['message']);
|
65 |
-
$error['message'] = str_replace('"', '\"', $error['message']);
|
66 |
-
$error['message'] = str_replace('/', '\/', $error['message']);
|
67 |
-
$error['message'] = str_replace("\n", '\n', $error['message']);
|
68 |
-
$error['message'] = str_replace("\r", '\r', $error['message']);
|
69 |
-
$error['message'] = str_replace("\t", '\t', $error['message']);
|
70 |
-
|
71 |
-
$fixable = 'false';
|
72 |
-
if ($error['fixable'] === true) {
|
73 |
-
$fixable = 'true';
|
74 |
-
}
|
75 |
-
|
76 |
-
$messages .= '{"message":"'.$error['message'].'",';
|
77 |
-
$messages .= '"source":"'.$error['source'].'",';
|
78 |
-
$messages .= '"severity":'.$error['severity'].',';
|
79 |
-
$messages .= '"type":"'.$error['type'].'",';
|
80 |
-
$messages .= '"line":'.$line.',';
|
81 |
-
$messages .= '"column":'.$column.',';
|
82 |
-
$messages .= '"fixable":'.$fixable;
|
83 |
-
$messages .= '},';
|
84 |
-
}//end foreach
|
85 |
-
}//end foreach
|
86 |
-
}//end foreach
|
87 |
-
|
88 |
-
echo rtrim($messages, ',');
|
89 |
-
echo ']},';
|
90 |
-
|
91 |
-
return true;
|
92 |
-
|
93 |
-
}//end generateFileReport()
|
94 |
-
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Generates a JSON report.
|
98 |
-
*
|
99 |
-
* @param string $cachedData Any partial report data that was returned from
|
100 |
-
* generateFileReport during the run.
|
101 |
-
* @param int $totalFiles Total number of files processed during the run.
|
102 |
-
* @param int $totalErrors Total number of errors found during the run.
|
103 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
104 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
105 |
-
* @param boolean $showSources Show sources?
|
106 |
-
* @param int $width Maximum allowed line width.
|
107 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
108 |
-
*
|
109 |
-
* @return void
|
110 |
-
*/
|
111 |
-
public function generate(
|
112 |
-
$cachedData,
|
113 |
-
$totalFiles,
|
114 |
-
$totalErrors,
|
115 |
-
$totalWarnings,
|
116 |
-
$totalFixable,
|
117 |
-
$showSources=false,
|
118 |
-
$width=80,
|
119 |
-
$toScreen=true
|
120 |
-
) {
|
121 |
-
echo '{"totals":{"errors":'.$totalErrors.',"warnings":'.$totalWarnings.',"fixable":'.$totalFixable.'},"files":{';
|
122 |
-
echo rtrim($cachedData, ',');
|
123 |
-
echo "}}";
|
124 |
-
|
125 |
-
}//end generate()
|
126 |
-
|
127 |
-
|
128 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Junit.php
DELETED
@@ -1,149 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* JUnit report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Oleg Lobach <oleg@lobach.info>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
12 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
13 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
14 |
-
*/
|
15 |
-
|
16 |
-
/**
|
17 |
-
* JUnit report for PHP_CodeSniffer.
|
18 |
-
*
|
19 |
-
* PHP version 5
|
20 |
-
*
|
21 |
-
* @category PHP
|
22 |
-
* @package PHP_CodeSniffer
|
23 |
-
* @author Oleg Lobach <oleg@lobach.info>
|
24 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
25 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
26 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
27 |
-
* @version Release: @package_version@
|
28 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
29 |
-
*/
|
30 |
-
class PHP_CodeSniffer_Reports_Junit implements PHP_CodeSniffer_Report
|
31 |
-
{
|
32 |
-
|
33 |
-
/**
|
34 |
-
* A count of tests that have been performed.
|
35 |
-
*
|
36 |
-
* @var int
|
37 |
-
*/
|
38 |
-
private $_tests = 0;
|
39 |
-
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Generate a partial report for a single processed file.
|
43 |
-
*
|
44 |
-
* Function should return TRUE if it printed or stored data about the file
|
45 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
46 |
-
* its data should be counted in the grand totals.
|
47 |
-
*
|
48 |
-
* @param array $report Prepared report data.
|
49 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
50 |
-
* @param boolean $showSources Show sources?
|
51 |
-
* @param int $width Maximum allowed line width.
|
52 |
-
*
|
53 |
-
* @return boolean
|
54 |
-
*/
|
55 |
-
public function generateFileReport(
|
56 |
-
$report,
|
57 |
-
PHP_CodeSniffer_File $phpcsFile,
|
58 |
-
$showSources=false,
|
59 |
-
$width=80
|
60 |
-
) {
|
61 |
-
if (count($report['messages']) === 0) {
|
62 |
-
$this->_tests++;
|
63 |
-
} else {
|
64 |
-
$this->_tests += ($report['errors'] + $report['warnings']);
|
65 |
-
}
|
66 |
-
|
67 |
-
$out = new XMLWriter;
|
68 |
-
$out->openMemory();
|
69 |
-
$out->setIndent(true);
|
70 |
-
|
71 |
-
$out->startElement('testsuite');
|
72 |
-
$out->writeAttribute('name', $report['filename']);
|
73 |
-
|
74 |
-
if (count($report['messages']) === 0) {
|
75 |
-
$out->writeAttribute('tests', 1);
|
76 |
-
$out->writeAttribute('failures', 0);
|
77 |
-
|
78 |
-
$out->startElement('testcase');
|
79 |
-
$out->writeAttribute('name', $report['filename']);
|
80 |
-
$out->endElement();
|
81 |
-
} else {
|
82 |
-
$failures = ($report['errors'] + $report['warnings']);
|
83 |
-
$out->writeAttribute('tests', $failures);
|
84 |
-
$out->writeAttribute('failures', $failures);
|
85 |
-
|
86 |
-
foreach ($report['messages'] as $line => $lineErrors) {
|
87 |
-
foreach ($lineErrors as $column => $colErrors) {
|
88 |
-
foreach ($colErrors as $error) {
|
89 |
-
$out->startElement('testcase');
|
90 |
-
$out->writeAttribute('name', $error['source'].' at '.$report['filename']." ($line:$column)");
|
91 |
-
|
92 |
-
$error['type'] = strtolower($error['type']);
|
93 |
-
if (PHP_CODESNIFFER_ENCODING !== 'utf-8') {
|
94 |
-
$error['message'] = iconv(PHP_CODESNIFFER_ENCODING, 'utf-8', $error['message']);
|
95 |
-
}
|
96 |
-
|
97 |
-
$out->startElement('failure');
|
98 |
-
$out->writeAttribute('type', $error['type']);
|
99 |
-
$out->writeAttribute('message', $error['message']);
|
100 |
-
$out->endElement();
|
101 |
-
|
102 |
-
$out->endElement();
|
103 |
-
}
|
104 |
-
}
|
105 |
-
}
|
106 |
-
}//end if
|
107 |
-
|
108 |
-
$out->endElement();
|
109 |
-
echo $out->flush();
|
110 |
-
return true;
|
111 |
-
|
112 |
-
}//end generateFileReport()
|
113 |
-
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Prints all violations for processed files, in a proprietary XML format.
|
117 |
-
*
|
118 |
-
* @param string $cachedData Any partial report data that was returned from
|
119 |
-
* generateFileReport during the run.
|
120 |
-
* @param int $totalFiles Total number of files processed during the run.
|
121 |
-
* @param int $totalErrors Total number of errors found during the run.
|
122 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
123 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
124 |
-
* @param boolean $showSources Show sources?
|
125 |
-
* @param int $width Maximum allowed line width.
|
126 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
127 |
-
*
|
128 |
-
* @return void
|
129 |
-
*/
|
130 |
-
public function generate(
|
131 |
-
$cachedData,
|
132 |
-
$totalFiles,
|
133 |
-
$totalErrors,
|
134 |
-
$totalWarnings,
|
135 |
-
$totalFixable,
|
136 |
-
$showSources=false,
|
137 |
-
$width=80,
|
138 |
-
$toScreen=true
|
139 |
-
) {
|
140 |
-
$failures = ($totalErrors + $totalWarnings);
|
141 |
-
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
|
142 |
-
echo '<testsuites name="PHP_CodeSniffer '.PHP_CodeSniffer::VERSION.'" tests="'.$this->_tests.'" failures="'.$failures.'">'.PHP_EOL;
|
143 |
-
echo $cachedData;
|
144 |
-
echo '</testsuites>'.PHP_EOL;
|
145 |
-
|
146 |
-
}//end generate()
|
147 |
-
|
148 |
-
|
149 |
-
}//end class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/Notifysend.php
DELETED
@@ -1,262 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Notify-send report for PHP_CodeSniffer.
|
4 |
-
*
|
5 |
-
* PHP version 5
|
6 |
-
*
|
7 |
-
* @category PHP
|
8 |
-
* @package PHP_CodeSniffer
|
9 |
-
* @author Christian Weiske <christian.weiske@netresearch.de>
|
10 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
11 |
-
* @copyright 2012-2014 Christian Weiske
|
12 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
13 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
14 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
15 |
-
*/
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Notify-send report for PHP_CodeSniffer.
|
19 |
-
*
|
20 |
-
* Supported configuration parameters:
|
21 |
-
* - notifysend_path - Full path to notify-send cli command
|
22 |
-
* - notifysend_timeout - Timeout in milliseconds
|
23 |
-
* - notifysend_showok - Show "ok, all fine" messages (0/1)
|
24 |
-
*
|
25 |
-
* @category PHP
|
26 |
-
* @package PHP_CodeSniffer
|
27 |
-
* @author Christian Weiske <christian.weiske@netresearch.de>
|
28 |
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
29 |
-
* @copyright 2012-2014 Christian Weiske
|
30 |
-
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
|
31 |
-
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
32 |
-
* @version Release: @package_version@
|
33 |
-
* @link http://pear.php.net/package/PHP_CodeSniffer
|
34 |
-
*/
|
35 |
-
class PHP_CodeSniffer_Reports_Notifysend implements PHP_CodeSniffer_Report
|
36 |
-
{
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Notification timeout in milliseconds.
|
40 |
-
*
|
41 |
-
* @var integer
|
42 |
-
*/
|
43 |
-
protected $timeout = 3000;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Path to notify-send command.
|
47 |
-
*
|
48 |
-
* @var string
|
49 |
-
*/
|
50 |
-
protected $path = 'notify-send';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Show "ok, all fine" messages.
|
54 |
-
*
|
55 |
-
* @var boolean
|
56 |
-
*/
|
57 |
-
protected $showOk = true;
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Version of installed notify-send executable.
|
61 |
-
*
|
62 |
-
* @var string
|
63 |
-
*/
|
64 |
-
protected $version = null;
|
65 |
-
|
66 |
-
/**
|
67 |
-
* A record of the last file checked.
|
68 |
-
*
|
69 |
-
* This is used in case we only checked one file and need to print
|
70 |
-
* the name/path of the file. We wont have access to the checked file list
|
71 |
-
* after the run has been completed.
|
72 |
-
*
|
73 |
-
* @var string
|
74 |
-
*/
|
75 |
-
private $_lastCheckedFile = '';
|
76 |
-
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Load configuration data.
|
80 |
-
*/
|
81 |
-
public function __construct()
|
82 |
-
{
|
83 |
-
$path = PHP_CodeSniffer::getConfigData('notifysend_path');
|
84 |
-
if ($path !== null) {
|
85 |
-
$this->path = escapeshellcmd($path);
|
86 |
-
}
|
87 |
-
|
88 |
-
$timeout = PHP_CodeSniffer::getConfigData('notifysend_timeout');
|
89 |
-
if ($timeout !== null) {
|
90 |
-
$this->timeout = (int) $timeout;
|
91 |
-
}
|
92 |
-
|
93 |
-
$showOk = PHP_CodeSniffer::getConfigData('notifysend_showok');
|
94 |
-
if ($showOk !== null) {
|
95 |
-
$this->showOk = (boolean) $showOk;
|
96 |
-
}
|
97 |
-
|
98 |
-
$this->version = str_replace(
|
99 |
-
'notify-send ',
|
100 |
-
'',
|
101 |
-
exec($this->path.' --version')
|
102 |
-
);
|
103 |
-
|
104 |
-
}//end __construct()
|
105 |
-
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Generate a partial report for a single processed file.
|
109 |
-
*
|
110 |
-
* Function should return TRUE if it printed or stored data about the file
|
111 |
-
* and FALSE if it ignored the file. Returning TRUE indicates that the file and
|
112 |
-
* its data should be counted in the grand totals.
|
113 |
-
*
|
114 |
-
* @param array $report Prepared report data.
|
115 |
-
* @param PHP_CodeSniffer_File $phpcsFile The file being reported on.
|
116 |
-
* @param boolean $showSources Show sources?
|
117 |
-
* @param int $width Maximum allowed line width.
|
118 |
-
*
|
119 |
-
* @return boolean
|
120 |
-
*/
|
121 |
-
public function generateFileReport(
|
122 |
-
$report,
|
123 |
-
PHP_CodeSniffer_File $phpcsFile,
|
124 |
-
$showSources=false,
|
125 |
-
$width=80
|
126 |
-
) {
|
127 |
-
// We don't need to print anything, but we want this file counted
|
128 |
-
// in the total number of checked files even if it has no errors.
|
129 |
-
$this->_lastCheckedFile = $report['filename'];
|
130 |
-
return true;
|
131 |
-
|
132 |
-
}//end generateFileReport()
|
133 |
-
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Generates a summary of errors and warnings for each file processed.
|
137 |
-
*
|
138 |
-
* @param string $cachedData Any partial report data that was returned from
|
139 |
-
* generateFileReport during the run.
|
140 |
-
* @param int $totalFiles Total number of files processed during the run.
|
141 |
-
* @param int $totalErrors Total number of errors found during the run.
|
142 |
-
* @param int $totalWarnings Total number of warnings found during the run.
|
143 |
-
* @param int $totalFixable Total number of problems that can be fixed.
|
144 |
-
* @param boolean $showSources Show sources?
|
145 |
-
* @param int $width Maximum allowed line width.
|
146 |
-
* @param boolean $toScreen Is the report being printed to screen?
|
147 |
-
*
|
148 |
-
* @return void
|
149 |
-
*/
|
150 |
-
public function generate(
|
151 |
-
$cachedData,
|
152 |
-
$totalFiles,
|
153 |
-
$totalErrors,
|
154 |
-
$totalWarnings,
|
155 |
-
$totalFixable,
|
156 |
-
$showSources=false,
|
157 |
-
$width=80,
|
158 |
-
$toScreen=true
|
159 |
-
) {
|
160 |
-
$msg = $this->generateMessage($totalFiles, $totalErrors, $totalWarnings);
|
161 |
-
if ($msg === null) {
|
162 |
-
if ($this->showOk === true) {
|
163 |
-
$this->notifyAllFine();
|
164 |
-
}
|
165 |
-
} else {
|
166 |
-
$this->notifyErrors($msg);
|
167 |
-
}
|
168 |
-
|
169 |
-
}//end generate()
|
170 |
-
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Generate the error message to show to the user.
|
174 |
-
*
|
175 |
-
* @param int $totalFiles Total number of files processed during the run.
|
176 |
-
* @param int $totalErrors Total number of errors found during the run.
|
177 |
-
* @param int $totalWarnings Total number of warnings found durin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|