1 | <?php declare(strict_types = 1); |
||
14 | class ConditionGenerator extends AbstractGenerator |
||
15 | { |
||
16 | use CodeTrait; |
||
17 | |||
18 | /** @var string Condition statement definition */ |
||
19 | protected $definition = ''; |
||
20 | |||
21 | /** @var bool If condition statement is nested */ |
||
22 | protected $nested; |
||
23 | |||
24 | /** |
||
25 | * ConditionGenerator constructor. |
||
26 | * |
||
27 | * @param bool $nested Flag if condition statement is nested |
||
28 | * @param AbstractGenerator|null $parent Parent generator |
||
29 | */ |
||
30 | public function __construct(bool $nested = false, AbstractGenerator $parent = null) |
||
36 | |||
37 | /** |
||
38 | * Set condition statement definition. |
||
39 | * |
||
40 | * @param string $definition Condition statement definition |
||
41 | * |
||
42 | * @return ConditionGenerator Condition generator |
||
43 | */ |
||
44 | public function defDefinition(string $definition): ConditionGenerator |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | * |
||
54 | * @throws \Exception If condition is not nested and definition is not defined |
||
55 | */ |
||
56 | public function code(): string |
||
82 | } |
||
83 |