1 | <?php |
||
18 | class OutlineNode implements ScenarioInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $title; |
||
24 | /** |
||
25 | * @var string[] |
||
26 | */ |
||
27 | private $tags; |
||
28 | /** |
||
29 | * @var StepNode[] |
||
30 | */ |
||
31 | private $steps; |
||
32 | /** |
||
33 | * @var ExampleTableNode|ExampleTableNode[] |
||
34 | */ |
||
35 | private $tables; |
||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $keyword; |
||
40 | /** |
||
41 | * @var integer |
||
42 | */ |
||
43 | private $line; |
||
44 | /** |
||
45 | * @var null|ExampleNode[] |
||
46 | */ |
||
47 | private $examples; |
||
48 | |||
49 | /** |
||
50 | * Initializes outline. |
||
51 | * |
||
52 | * @param null|string $title |
||
53 | * @param string[] $tags |
||
54 | * @param StepNode[] $steps |
||
55 | * @param ExampleTableNode|ExampleTableNode[] $tables |
||
56 | * @param string $keyword |
||
57 | * @param integer $line |
||
58 | */ |
||
59 | 226 | public function __construct( |
|
78 | |||
79 | /** |
||
80 | * Returns node type string |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getNodeType() |
||
88 | |||
89 | /** |
||
90 | * Returns outline title. |
||
91 | * |
||
92 | * @return null|string |
||
93 | */ |
||
94 | 5 | public function getTitle() |
|
98 | |||
99 | /** |
||
100 | * Checks if outline is tagged with tag. |
||
101 | * |
||
102 | * @param string $tag |
||
103 | * |
||
104 | * @return Boolean |
||
105 | */ |
||
106 | public function hasTag($tag) |
||
110 | |||
111 | /** |
||
112 | * Checks if outline has tags (both inherited from feature and own). |
||
113 | * |
||
114 | * @return Boolean |
||
115 | */ |
||
116 | 1 | public function hasTags() |
|
120 | |||
121 | /** |
||
122 | * Returns outline tags (including inherited from feature). |
||
123 | * |
||
124 | * @return string[] |
||
125 | */ |
||
126 | 5 | public function getTags() |
|
130 | |||
131 | /** |
||
132 | * Checks if outline has steps. |
||
133 | * |
||
134 | * @return Boolean |
||
135 | */ |
||
136 | 1 | public function hasSteps() |
|
140 | |||
141 | /** |
||
142 | * Returns outline steps. |
||
143 | * |
||
144 | * @return StepNode[] |
||
145 | */ |
||
146 | 8 | public function getSteps() |
|
150 | |||
151 | /** |
||
152 | * Checks if outline has examples. |
||
153 | * |
||
154 | * @return Boolean |
||
155 | */ |
||
156 | 12 | public function hasExamples() |
|
160 | |||
161 | /** |
||
162 | * Builds and returns examples table for the outline. |
||
163 | * |
||
164 | * WARNING: it returns a merged table with tags lost. |
||
165 | * |
||
166 | * @deprecated use getExampleTables instead |
||
167 | * @return ExampleTableNode |
||
168 | */ |
||
169 | 11 | public function getExampleTable() |
|
183 | |||
184 | /** |
||
185 | * Returns list of examples for the outline. |
||
186 | * @return ExampleNode[] |
||
187 | */ |
||
188 | 6 | public function getExamples() |
|
192 | |||
193 | /** |
||
194 | * Returns examples tables array for the outline. |
||
195 | * @return ExampleTableNode[] |
||
196 | */ |
||
197 | 10 | public function getExampleTables() |
|
201 | |||
202 | /** |
||
203 | * Returns outline keyword. |
||
204 | * |
||
205 | * @return string |
||
206 | */ |
||
207 | 3 | public function getKeyword() |
|
211 | |||
212 | /** |
||
213 | * Returns outline declaration line number. |
||
214 | * |
||
215 | * @return integer |
||
216 | */ |
||
217 | 16 | public function getLine() |
|
221 | |||
222 | /** |
||
223 | * Creates examples for this outline using examples table. |
||
224 | * |
||
225 | * @return ExampleNode[] |
||
226 | */ |
||
227 | 6 | protected function createExamples() |
|
245 | } |
||
246 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: