bootSpecificationFacadeTrait()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 Railt\SDL\CompilerInterface;
15
use Railt\SDL\Spec\Railt;
16
use Railt\SDL\Spec\SpecificationInterface;
17
18
/**
19
 * @mixin CompilerInterface
20
 */
21
trait SpecificationFacadeTrait
22
{
23
    /**
24
     * @var SpecificationInterface
25
     */
26
    protected SpecificationInterface $spec;
27
28
    /**
29
     * @param SpecificationInterface|null $spec
30
     * @return $this
31
     */
32
    public function setSpecification(SpecificationInterface $spec = null): self
33
    {
34
        $this->spec = $spec ?? new Railt();
35
36
        return $this;
37
    }
38
39
    /**
40
     * @return void
41
     */
42
    private function bootSpecificationFacadeTrait(): void
43
    {
44
        $this->spec->load($this);
0 ignored issues
show
Bug introduced by
$this of type Railt\SDL\Compiler\SpecificationFacadeTrait is incompatible with the type Railt\SDL\CompilerInterface expected by parameter $compiler of Railt\SDL\Spec\SpecificationInterface::load(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
        $this->spec->load(/** @scrutinizer ignore-type */ $this);
Loading history...
45
    }
46
47
    /**
48
     * @return SpecificationInterface
49
     */
50
    public function getSpecification(): SpecificationInterface
51
    {
52
        return $this->spec;
53
    }
54
}
55