1 | <?php |
||
26 | class DataCollector extends BaseDataCollector implements EventSubscriberInterface |
||
27 | { |
||
28 | use ControllerAnnotationExtractorTrait; |
||
29 | |||
30 | public const COLLECTOR_NAME = 'spiechu_symfony_commons.data_collector'; |
||
31 | |||
32 | /** |
||
33 | * @var RouterInterface |
||
34 | */ |
||
35 | protected $router; |
||
36 | |||
37 | /** |
||
38 | * @var Reader |
||
39 | */ |
||
40 | protected $reader; |
||
41 | |||
42 | /** |
||
43 | * @var ControllerResolverInterface |
||
44 | */ |
||
45 | protected $controllerResolver; |
||
46 | |||
47 | /** |
||
48 | * @var DataCollectorExtension |
||
49 | */ |
||
50 | protected $dataCollectorExtension; |
||
51 | |||
52 | /** |
||
53 | * @param RouterInterface $router |
||
54 | * @param Reader $reader |
||
55 | * @param ControllerResolverInterface $controllerResolver |
||
56 | * @param DataCollectorExtension $dataCollectorExtension |
||
57 | */ |
||
58 | 13 | public function __construct( |
|
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | 13 | public function collect(Request $request, Response $response, \Exception $exception = null): void |
|
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 13 | public function getName(): string |
|
93 | |||
94 | /** |
||
95 | * Forward compatibility with Symfony 3.4. |
||
96 | */ |
||
97 | public function reset(): void |
||
101 | |||
102 | /** |
||
103 | * @return array |
||
104 | */ |
||
105 | public function getGlobalResponseSchemas(): array |
||
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | 7 | public static function getSubscribedEvents(): array |
|
120 | |||
121 | /** |
||
122 | * @param CheckResult $checkResult |
||
123 | */ |
||
124 | 2 | public function onCheckResult(CheckResult $checkResult): void |
|
128 | |||
129 | /** |
||
130 | * @param ApiVersionSetEvent $apiVersionSetEvent |
||
131 | */ |
||
132 | 9 | public function onApiVersionSet(ApiVersionSetEvent $apiVersionSetEvent): void |
|
136 | |||
137 | /** |
||
138 | * @return array |
||
139 | */ |
||
140 | 9 | public function getKnownRouteResponseSchemas(): array |
|
144 | |||
145 | /** |
||
146 | * @return int |
||
147 | */ |
||
148 | 9 | public function getKnownRouteResponseSchemaNumber(): int |
|
158 | |||
159 | /** |
||
160 | * @return int |
||
161 | */ |
||
162 | 9 | public function getAllPotentialErrorsCount(): int |
|
166 | |||
167 | /** |
||
168 | * @return bool |
||
169 | */ |
||
170 | 11 | public function responseWasChecked(): bool |
|
174 | |||
175 | /** |
||
176 | * @return bool |
||
177 | */ |
||
178 | 9 | public function apiVersionWasSet(): bool |
|
182 | |||
183 | /** |
||
184 | * @return null|string |
||
185 | */ |
||
186 | 9 | public function getApiVersion(): ?string |
|
190 | |||
191 | /** |
||
192 | * @return ValidationViolation[] |
||
193 | */ |
||
194 | 9 | public function getValidationErrors(): array |
|
202 | |||
203 | /** |
||
204 | * @return bool |
||
205 | */ |
||
206 | public function isGetMethodWasOverridden(): bool |
||
210 | |||
211 | /** |
||
212 | * @return null|string |
||
213 | */ |
||
214 | public function getGetMethodOverriddenTo(): ?string |
||
218 | |||
219 | 13 | protected function extractRoutesData(): void |
|
246 | |||
247 | /** |
||
248 | * @throws \Exception |
||
249 | * |
||
250 | * @return \Generator string $name => [Route $route, string $controllerDefinition, ResponseSchemaValidator $methodAnnotation] |
||
251 | */ |
||
252 | 13 | protected function getRouteCollectionGenerator(): \Generator |
|
267 | |||
268 | /** |
||
269 | * @param string $controllerDefinition |
||
270 | * |
||
271 | * @throws \Exception |
||
272 | * |
||
273 | * @return null|ResponseSchemaValidator |
||
274 | */ |
||
275 | 13 | protected function extractControllerResponseValidator(string $controllerDefinition): ?ResponseSchemaValidator |
|
291 | |||
292 | /** |
||
293 | * @return int |
||
294 | */ |
||
295 | 9 | protected function getGlobalNonExistingSchemaFiles(): int |
|
299 | |||
300 | /** |
||
301 | * {@inheritdoc} |
||
302 | */ |
||
303 | 13 | protected function getAnnotationReader(): Reader |
|
307 | } |
||
308 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.