SchematorFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 6
c 2
b 1
f 1
dl 0
loc 32
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createBuilder() 0 3 1
A create() 0 5 1
A createMass() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Smoren\Schemator\Factories;
6
7
use Smoren\Schemator\Components\MassSchemator;
8
use Smoren\Schemator\Filters\BaseFiltersStorage;
9
use Smoren\Schemator\Interfaces\MassSchematorInterface;
10
use Smoren\Schemator\Interfaces\SchematorBuilderInterface;
11
use Smoren\Schemator\Interfaces\SchematorInterface;
12
13
/**
14
 * Schemator factory
15
 */
16
class SchematorFactory
17
{
18
    /**
19
     * Creates new Schemator instance with default config.
20
     *
21
     * @return SchematorInterface
22
     */
23
    public static function create(): SchematorInterface
24
    {
25
        return static::createBuilder()
26
            ->withFilters(new BaseFiltersStorage())
27
            ->get();
28
    }
29
30
    /**
31
     * Creates SchematorBuilder instance.
32
     *
33
     * @return SchematorBuilderInterface
34
     */
35
    public static function createBuilder(): SchematorBuilderInterface
36
    {
37
        return new SchematorBuilder();
38
    }
39
40
    /**
41
     * Creates new MassSchemator instance with default config.
42
     *
43
     * @return MassSchematorInterface
44
     */
45
    public static function createMass(): MassSchematorInterface
46
    {
47
        return new MassSchemator(static::create());
48
    }
49
}
50