Config   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A build() 0 6 2
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