Config::build()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Config;
5
6
use Innmind\Config\Exception\SchemaNotParseable;
7
8
final class Config
9
{
10
    private $structures;
11
    private $properties;
12
13 5
    public function __construct(
14
        Structures $structures = null,
15
        Properties $properties = null
16
   ) {
17 5
        $this->structures = $structures ?? new Structures;
18 5
        $this->properties = $properties ?? new Properties;
19 5
    }
20
21 5
    public function build(array $schema): Structure
22
    {
23
        try {
24 5
            return $this->structures->build($schema, $this->properties);
25 3
        } catch (SchemaNotParseable $e) {
26 3
            SchemaNotParseable::rethrow($e);
27
        }
28
    }
29
}
30