These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * (c) Christian Gripp <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Core23\SitemapBundle\DependencyInjection; |
||
13 | |||
14 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||
15 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
16 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||
17 | |||
18 | final class Configuration implements ConfigurationInterface |
||
19 | { |
||
20 | public function getConfigTreeBuilder() |
||
21 | { |
||
22 | $treeBuilder = new TreeBuilder('core23_sitemap'); |
||
23 | |||
24 | // Keep compatibility with symfony/config < 4.2 |
||
25 | if (!method_exists(TreeBuilder::class, 'getRootNode')) { |
||
26 | $rootNode = $treeBuilder->root('core23_sitemap'); |
||
0 ignored issues
–
show
|
|||
27 | } else { |
||
28 | $rootNode = $treeBuilder->getRootNode(); |
||
29 | } |
||
30 | \assert($rootNode instanceof ArrayNodeDefinition); |
||
31 | |||
32 | $this->addStaticUrlsSection($rootNode); |
||
33 | $this->addCacheSection($rootNode); |
||
34 | |||
35 | return $treeBuilder; |
||
36 | } |
||
37 | |||
38 | private function addCacheSection(ArrayNodeDefinition $node): void |
||
39 | { |
||
40 | $node |
||
41 | ->children() |
||
42 | ->arrayNode('cache') |
||
43 | ->addDefaultsIfNotSet() |
||
44 | ->children() |
||
45 | ->scalarNode('service')->defaultNull()->end() |
||
46 | ->end() |
||
47 | ->end() |
||
48 | ->end() |
||
49 | ; |
||
50 | } |
||
51 | |||
52 | private function addStaticUrlsSection(ArrayNodeDefinition $node): void |
||
53 | { |
||
54 | $node |
||
55 | ->children() |
||
56 | ->arrayNode('static') |
||
57 | ->defaultValue([]) |
||
58 | ->prototype('array') |
||
59 | ->children() |
||
60 | ->scalarNode('url')->end() |
||
61 | ->integerNode('priority')->defaultNull()->end() |
||
62 | ->scalarNode('changefreq')->defaultNull()->end() |
||
63 | ->end() |
||
64 | ->end() |
||
65 | ->end() |
||
66 | ->end() |
||
67 | ; |
||
68 | } |
||
69 | } |
||
70 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.