Validator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A validates() 0 4 1
1
<?php
2
3
/*
4
 * (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Hal\Component\Config;
11
use Symfony\Component\Config\Definition\Processor;
12
use \Symfony\Component\Config\Definition\NodeInterface;
13
14
/**
15
 * Valides a config file
16
 *
17
 * @author Jean-François Lépine <https://twitter.com/Halleck45>
18
 */
19
class Validator
20
{
21
    /**
22
     * @var NodeInterface
23
     */
24
    private $tree;
25
26
    /**
27
     * Constructor
28
     *
29
     * @param NodeInterface $tree
30
     */
31
    public function __construct(NodeInterface $tree) {
32
        $this->tree = $tree;
33
    }
34
35
    /**
36
     * Validates the config file according tree
37
     *
38
     * @param array $config
39
     * @return array
40
     */
41
    public function validates(array $config) {
42
        $processor = new Processor();
43
        return $processor->process($this->tree, $config);
44
    }
45
}