1 | <?php |
||
24 | class DataCollector extends BaseDataCollector implements EventSubscriberInterface |
||
25 | { |
||
26 | use ControllerAnnotationExtractorTrait; |
||
27 | |||
28 | public const COLLECTOR_NAME = 'spiechu_symfony_commons.data_collector'; |
||
29 | |||
30 | /** |
||
31 | * @var RouterInterface |
||
32 | */ |
||
33 | protected $router; |
||
34 | |||
35 | /** |
||
36 | * @var Reader |
||
37 | */ |
||
38 | protected $reader; |
||
39 | |||
40 | /** |
||
41 | * @var ControllerResolverInterface |
||
42 | */ |
||
43 | protected $controllerResolver; |
||
44 | |||
45 | /** |
||
46 | * @var DataCollectorExtension |
||
47 | */ |
||
48 | protected $dataCollectorExtension; |
||
49 | |||
50 | /** |
||
51 | * @param RouterInterface $router |
||
52 | * @param Reader $reader |
||
53 | * @param ControllerResolverInterface $controllerResolver |
||
54 | * @param DataCollectorExtension $dataCollectorExtension |
||
55 | */ |
||
56 | 12 | public function __construct( |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | 12 | public function collect(Request $request, Response $response, \Exception $exception = null): void |
|
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | 12 | public function getName(): string |
|
87 | |||
88 | /** |
||
89 | * Forward compatibility with Symfony 3.4. |
||
90 | */ |
||
91 | public function reset(): void |
||
95 | |||
96 | /** |
||
97 | * @return array |
||
98 | */ |
||
99 | public function getGlobalResponseSchemas(): array |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | 6 | public static function getSubscribedEvents(): array |
|
114 | |||
115 | /** |
||
116 | * @param CheckResult $checkResult |
||
117 | */ |
||
118 | 2 | public function onCheckResult(CheckResult $checkResult): void |
|
122 | |||
123 | /** |
||
124 | * @param ApiVersionSetEvent $apiVersionSetEvent |
||
125 | */ |
||
126 | 9 | public function onApiVersionSet(ApiVersionSetEvent $apiVersionSetEvent): void |
|
130 | |||
131 | /** |
||
132 | * @return array |
||
133 | */ |
||
134 | public function getKnownRouteResponseSchemas(): array |
||
138 | |||
139 | /** |
||
140 | * @return int |
||
141 | */ |
||
142 | public function getKnownRouteResponseSchemaNumber(): int |
||
152 | |||
153 | /** |
||
154 | * @return int |
||
155 | */ |
||
156 | public function getAllPotentialErrorsCount(): int |
||
160 | |||
161 | /** |
||
162 | * @return bool |
||
163 | */ |
||
164 | 2 | public function responseWasChecked(): bool |
|
168 | |||
169 | /** |
||
170 | * @return bool |
||
171 | */ |
||
172 | 5 | public function apiVersionWasSet(): bool |
|
176 | |||
177 | /** |
||
178 | * @return null|string |
||
179 | */ |
||
180 | 5 | public function getApiVersion(): ?string |
|
184 | |||
185 | /** |
||
186 | * @return ValidationViolation[] |
||
187 | */ |
||
188 | public function getValidationErrors(): array |
||
196 | |||
197 | 12 | protected function extractRoutesData(): void |
|
230 | |||
231 | /** |
||
232 | * @param string $controllerDefinition |
||
233 | * |
||
234 | * @throws \Exception |
||
235 | * |
||
236 | * @return null|ResponseSchemaValidator |
||
237 | */ |
||
238 | 12 | protected function extractControllerResponseValidator(string $controllerDefinition): ?ResponseSchemaValidator |
|
254 | |||
255 | /** |
||
256 | * @return int |
||
257 | */ |
||
258 | protected function getGlobalNonExistingSchemaFiles(): int |
||
262 | |||
263 | /** |
||
264 | * {@inheritdoc} |
||
265 | */ |
||
266 | 12 | protected function getAnnotationReader(): Reader |
|
270 | } |
||
271 |