Config::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
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