1 | <?php |
||
21 | class SubstepDefinition extends AbstractFormDefinitionComponent |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | * @validate NotEmpty |
||
26 | */ |
||
27 | protected $substep; |
||
28 | |||
29 | /** |
||
30 | * @var \Romm\Formz\Form\Definition\Condition\Activation |
||
31 | * @validate Romm.Formz:Internal\ConditionIsValid |
||
32 | */ |
||
33 | protected $activation; |
||
34 | |||
35 | /** |
||
36 | * @var \Romm\Formz\Form\Definition\Step\Step\Substep\SubstepDefinition |
||
37 | */ |
||
38 | protected $next; |
||
39 | |||
40 | /** |
||
41 | * @var \Romm\Formz\Form\Definition\Step\Step\Substep\DivergenceSubstepDefinition[] |
||
42 | */ |
||
43 | protected $divergence; |
||
44 | |||
45 | /** |
||
46 | * @return Substep |
||
47 | */ |
||
48 | public function getSubstep() |
||
57 | |||
58 | /** |
||
59 | * @return Activation |
||
60 | */ |
||
61 | public function getActivation() |
||
65 | |||
66 | /** |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function hasActivation() |
||
73 | |||
74 | public function getLevel() |
||
75 | { |
||
76 | $level = 1; |
||
77 | |||
78 | $this->alongParents(function ($parent) use (&$level) { |
||
79 | if ($parent instanceof self) { |
||
80 | $level++; |
||
81 | } |
||
82 | |||
83 | if ($parent instanceof Step) { |
||
84 | return false; |
||
85 | } |
||
86 | |||
87 | return true; |
||
88 | }); |
||
89 | |||
90 | return $level; |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @todo |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function isLast() |
||
103 | |||
104 | /** |
||
105 | * @return bool |
||
106 | */ |
||
107 | public function hasNextSubstep() |
||
111 | |||
112 | /** |
||
113 | * @return SubstepDefinition |
||
114 | */ |
||
115 | public function getNextSubstep() |
||
123 | |||
124 | /** |
||
125 | * @return DivergenceSubstepDefinition[] |
||
126 | */ |
||
127 | public function getDivergenceSubsteps() |
||
131 | |||
132 | /** |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function hasDivergence() |
||
139 | } |
||
140 |