Passed
Push — master ( e3cdb6...cb4117 )
by Smoren
01:43
created

SchematorBuilder::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Smoren\Schemator\Factories;
4
5
use Smoren\Schemator\Components\Schemator;
6
use Smoren\Schemator\Interfaces\SchematorBuilderInterface;
7
use Smoren\Schemator\Interfaces\SchematorInterface;
8
9
class SchematorBuilder implements SchematorBuilderInterface
10
{
11
    protected SchematorInterface $schemator;
12
13
    public function __construct()
14
    {
15
        $this->create();
16
    }
17
18
    public function create(): SchematorBuilderInterface
19
    {
20
        $this->schemator = new Schemator();
21
        return $this;
22
    }
23
24
    public function withFilters(array $filters): SchematorBuilderInterface
25
    {
26
        foreach($filters as $filterName => $filter) {
27
            $this->schemator->addFilter($filterName, $filter);
28
        }
29
        return $this;
30
    }
31
32
    public function get(): SchematorInterface
33
    {
34
        return $this->schemator;
35
    }
36
}
37