PhingTaskConfiguration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 0
cts 17
cp 0
rs 8.9713
c 0
b 0
f 0
cc 1
eloc 18
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Conveyor package.
5
 *
6
 * (c) Jeroen Fiege <[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 Webcreate\Conveyor\Task\Configuration;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
class PhingTaskConfiguration implements ConfigurationInterface
18
{
19
    public function getConfigTreeBuilder()
20
    {
21
        $treeBuilder = new TreeBuilder();
22
        $rootNode = $treeBuilder->root('task');
23
24
        $rootNode
25
            ->children()
26
                ->scalarNode('buildfile')->defaultNull()->end()
27
                ->arrayNode('target')
28
                    ->isRequired()
29
                    ->requiresAtLeastOneElement()
30
                    ->prototype('scalar')->end()
31
                    ->beforeNormalization()
32
                        ->ifString()
33
                        ->then(function ($v) {
34
                            return array($v);
35
                        })
36
                    ->end()
37
                ->end()
38
            ->end()
39
        ;
40
41
        return $treeBuilder;
42
    }
43
}
44