Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of the PsyshBundle package.
5
 *
6
 * (c) Théo FIDRY <[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 Fidry\PsyshBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * @private
19
 */
20
final class Configuration implements ConfigurationInterface
21
{
22
    public function getConfigTreeBuilder(): TreeBuilder
23
    {
24
        $treeBuilder = new TreeBuilder('psysh');
25
        $rootNode = $treeBuilder->getRootNode();
26
27
        $rootNode
28
            ->children()
29
                ->arrayNode('variables')
30
                    ->info('Define additional variables to be exposed in Psysh')
31
                    ->useAttributeAsKey('variable_name')
32
                    ->example([
33
                        'debug' => '%kernel.debug%',
34
                        'my_service' => '@my.service',
35
                        'os' => ['linux', 'macos', 'losedows'],
36
                    ])
37
                    ->prototype('variable')->end()
38
                ->end()
39
            ->end();
40
41
        return $treeBuilder;
42
    }
43
}
44