ResourcesValidator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 25
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 22 3
1
<?php
2
3
/**
4
 * This file is part of sensorario/resources repository
5
 *
6
 * (c) Simone Gentili <[email protected]> *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Sensorario\Resources\Validators;
12
13
use Sensorario\Resources\MagicResource;
14
15
final class ResourcesValidator
16
{
17 42
    public function validate(MagicResource $resource)
18
    {
19 42
        $container = ValidatorContainer::load();
20
21
        $validators = [
22 42
            'right.type',
23
            'mandatory.conditional',
24
            'mandatory.property',
25
            'mandatory.without.default',
26
            'allowed.properties',
27
            'allowed.values',
28
            'rewrite.values',
29
            'allowed.ranges',
30
            'right.type',
31
        ];
32
33 42
        foreach ($validators as $name) {
34 42
            if ($container->contains($name)) {
35 42
                $container->get($name)->check($resource);
36
            }
37
        }
38 27
    }
39
}
40