SchematorFactory::createBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
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