Completed
Pull Request — master (#9)
by ANTHONIUS
02:56
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 51
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 49 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the dotfiles project.
7
 *
8
 *     (c) Anthonius Munthi <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Dotfiles\Core;
15
16
use Dotfiles\Core\Config\DefinitionInterface;
17
use Dotfiles\Core\Util\Toolkit;
18
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
19
20
class Configuration implements DefinitionInterface
21
{
22
    public function getConfigTreeBuilder()
23
    {
24
        $builder = new TreeBuilder();
25
        $root = $builder->root('dotfiles');
26
        $root
27
            ->children()
28
                ->scalarNode('env')
29
                    ->defaultValue('%env(DOTFILES_ENV)%')
30
                ->end()
31
                ->booleanNode('debug')
32
                    ->defaultValue('%env(DOTFILES_DEBUG)%')
33
                ->end()
34
                ->booleanNode('phar_mode')
35
                    ->defaultValue(getenv('DOTFILES_PHAR_MODE'))
36
                ->end()
37
                ->scalarNode('machine_name')
38
                    ->defaultValue('%env(DOTFILES_MACHINE_NAME)%')
39
                ->end()
40
                ->scalarNode('backup_dir')
41
                    ->defaultValue('%env(DOTFILES_BACKUP_DIR)%')
42
                ->end()
43
                ->scalarNode('log_dir')
44
                    ->defaultValue('%env(DOTFILES_LOG_DIR)%')
45
                ->end()
46
                ->scalarNode('cache_dir')
47
                    ->defaultValue('%env(DOTFILES_CACHE_DIR)%')
48
                ->end()
49
                ->scalarNode('home_dir')
50
                    ->defaultValue('%env(DOTFILES_HOME_DIR)%')
51
                ->end()
52
                ->scalarNode('base_dir')
53
                    ->defaultValue(Toolkit::getBaseDir())
54
                ->end()
55
                ->scalarNode('temp_dir')
56
                    ->defaultValue('%env(DOTFILES_TEMP_DIR)%')
57
                ->end()
58
                ->scalarNode('install_dir')
59
                    ->defaultValue('%env(DOTFILES_INSTALL_DIR)%')
60
                ->end()
61
                ->scalarNode('bin_dir')
62
                    ->defaultValue('%env(DOTFILES_INSTALL_DIR)%/bin')
63
                ->end()
64
                ->scalarNode('vendor_dir')
65
                    ->defaultValue('%env(DOTFILES_INSTALL_DIR)%/vendor')
66
                ->end()
67
            ->end()
68
        ;
69
70
        return $builder;
71
    }
72
}
73