Test Setup Failed
Push — master ( 1595cb...050b68 )
by Kirill
21:00
created

ValidatorFacadeTrait::assertValid()   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
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of Railt package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Railt\SDL\Compiler;
13
14
use GraphQL\Contracts\TypeSystem\DefinitionInterface;
15
use Railt\SDL\Validator\Factory;
16
use Railt\SDL\Validator\ValidatorInterface;
17
18
/**
19
 * Trait ValidatorFacadeTrait
20
 */
21
trait ValidatorFacadeTrait
22
{
23
    /**
24
     * @var ValidatorInterface
25
     */
26
    protected ValidatorInterface $validator;
27
28
    /**
29
     * @return void
30
     */
31
    private function bootValidatorFacadeTrait(): void
32
    {
33
        $this->validator = new Factory();
34
    }
35
36
    /**
37
     * @return ValidatorInterface
38
     */
39
    public function getValidator(): ValidatorInterface
40
    {
41
        return $this->validator;
42
    }
43
44
    /**
45
     * @param DefinitionInterface $definition
46
     * @return void
47
     */
48
    public function assertValid(DefinitionInterface $definition): void
49
    {
50
        $this->validator->assert($definition);
51
    }
52
}
53