Completed
Pull Request — master (#9)
by Rafael Gonçalves
02:11
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 7
Bugs 0 Features 0
Metric Value
c 7
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Kendrick\SymfonyDebugToolbarGit\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
/**
10
 * Class Configuration
11
 * @package Kendrick\SymfonyDebugToolbarGit\DependencyInjection
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
	/**
16
	 * {@inheritdoc}
17
	 */
18
	public function getConfigTreeBuilder()
19
	{
20
		$treeBuilder = new TreeBuilder();
21
		$rootNode = $treeBuilder->root('symfony_debug_toolbar_git');
22
23
		$this->addRepositoryCommitUrl($rootNode);
24
		$this->addDirGitLocal($rootNode);
25
26
		return $treeBuilder;
27
	}
28
29
	private function addRepositoryCommitUrl(ArrayNodeDefinition $node)
30
	{
31
		$node
32
			->children()
33
			->scalarNode('repository_commit_url')
34
			->defaultValue('')
35
			->end();
36
	}
37
38
	private function addDirGitLocal(ArrayNodeDefinition $node)
39
	{
40
		$node
41
			->children()
42
			->scalarNode('repository_local_dir')
43
			->defaultValue('/')
44
			->end();
45
	}
46
}
47
48