railt /
sdl
| 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
Loading history...
|
|||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return SpecificationInterface |
||
| 49 | */ |
||
| 50 | public function getSpecification(): SpecificationInterface |
||
| 51 | { |
||
| 52 | return $this->spec; |
||
| 53 | } |
||
| 54 | } |
||
| 55 |