1 | <?php |
||
14 | class SpiechuSymfonyCommonsExtension extends Extension |
||
15 | { |
||
16 | /** |
||
17 | * {@inheritdoc} |
||
18 | * |
||
19 | * @throws OutOfBoundsException |
||
20 | * @throws ServiceNotFoundException |
||
21 | * @throws \Exception |
||
22 | * @throws InvalidArgumentException |
||
23 | */ |
||
24 | 8 | public function load(array $configs, ContainerBuilder $container): void |
|
25 | { |
||
26 | 8 | $processedConfig = $this->processConfiguration(new Configuration(), $configs); |
|
27 | |||
28 | 8 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
29 | |||
30 | 8 | $this->processGetMethodOverride($loader, $container, $processedConfig['get_method_override']); |
|
31 | 8 | $this->processResponseSchemaValidation($loader, $container, $processedConfig['response_schema_validation']); |
|
32 | |||
33 | 8 | if ($container->getParameter('kernel.debug')) { |
|
34 | 1 | $loader->load('debug_services.xml'); |
|
35 | } |
||
36 | 8 | } |
|
37 | |||
38 | 8 | protected function processGetMethodOverride(XmlFileLoader $loader, ContainerBuilder $container, array $options): void |
|
53 | |||
54 | 8 | protected function processResponseSchemaValidation(XmlFileLoader $loader, ContainerBuilder $container, array $options): void |
|
76 | |||
77 | 6 | protected function addOrReplaceDefinitionArgument(Definition $definition, int $index, $value): void |
|
78 | { |
||
79 | 6 | if (array_key_exists($index, $definition->getArguments())) { |
|
80 | 1 | $definition->replaceArgument($index, $value); |
|
81 | } else { |
||
82 | 6 | $definition->setArgument($index, $value); |
|
83 | } |
||
84 | 6 | } |
|
85 | |||
86 | 2 | protected function clearListenerTags(Definition $definition): void |
|
93 | } |
||
94 |