We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
24 | class OverblogGraphQLTypesExtension extends Extension |
||
25 | { |
||
26 | private $yamlParser; |
||
27 | |||
28 | 15 | public function load(array $configs, ContainerBuilder $container) |
|
29 | { |
||
30 | 15 | $configuration = $this->getConfiguration($configs, $container); |
|
31 | 15 | $config = $this->processConfiguration($configuration, $configs); |
|
32 | |||
33 | 9 | $container->setParameter('overblog_graphql_types.config', $config); |
|
34 | 9 | } |
|
35 | |||
36 | 10 | public function containerPrependExtensionConfig(array $config, ContainerBuilder $container) |
|
37 | { |
||
38 | 10 | $typesMappings = array_merge( |
|
39 | 10 | $this->typesConfigsMappingFromConfig($config, $container), |
|
40 | 10 | $this->typesConfigsMappingFromBundles($container) |
|
41 | 10 | ); |
|
42 | |||
43 | // treats mappings |
||
44 | 10 | foreach ($typesMappings as $params) { |
|
45 | 10 | $this->prependExtensionConfigFromFiles($params['type'], $params['files'], $container); |
|
46 | 8 | } |
|
47 | 8 | } |
|
48 | |||
49 | /** |
||
50 | * @param $type |
||
51 | * @param SplFileInfo[] $files |
||
52 | * @param ContainerBuilder $container |
||
53 | */ |
||
54 | 10 | private function prependExtensionConfigFromFiles($type, $files, ContainerBuilder $container) |
|
62 | |||
63 | 2 | private function typesConfigFromXml(SplFileInfo $file, ContainerBuilder $container) |
|
84 | |||
85 | 9 | private function typesConfigFromYml(SplFileInfo $file, ContainerBuilder $container) |
|
86 | { |
||
87 | 9 | if (null === $this->yamlParser) { |
|
88 | 9 | $this->yamlParser = new YamlParser(); |
|
89 | 9 | } |
|
90 | |||
91 | try { |
||
92 | 9 | $typesConfig = $this->yamlParser->parse($file->getContents()); |
|
93 | 8 | $container->addResource(new FileResource($file->getRealPath())); |
|
94 | 9 | } catch (ParseException $e) { |
|
95 | 1 | throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e); |
|
96 | } |
||
97 | |||
98 | 8 | return $typesConfig; |
|
99 | } |
||
100 | |||
101 | 10 | private function typesConfigsMappingFromConfig(array $config, ContainerBuilder $container) |
|
119 | |||
120 | 10 | private function typesConfigsMappingFromBundles(ContainerBuilder $container) |
|
140 | |||
141 | 10 | private function detectConfigFiles(ContainerBuilder $container, $configPath, $type = null) |
|
171 | |||
172 | 8 | private function getMappingResourceConfigDirectory() |
|
176 | |||
177 | 10 | private function getMappingResourceExtension() |
|
181 | |||
182 | 8 | public function getAliasPrefix() |
|
186 | |||
187 | 8 | public function getAlias() |
|
191 | |||
192 | 15 | public function getConfiguration(array $config, ContainerBuilder $container) |
|
196 | } |
||
197 |