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 | 222 | public function __construct( |
|
78 | |||
79 | /** |
||
80 | * Returns node type string |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getNodeType() |
||
88 | |||
89 | /** |
||
90 | 7 | * Returns outline title. |
|
91 | * |
||
92 | 7 | * @return null|string |
|
93 | */ |
||
94 | 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 | 1 | * Checks if outline has tags (both inherited from feature and own). |
|
113 | * |
||
114 | 1 | * @return Boolean |
|
115 | */ |
||
116 | public function hasTags() |
||
120 | |||
121 | /** |
||
122 | 3 | * Returns outline tags (including inherited from feature). |
|
123 | * |
||
124 | 3 | * @return string[] |
|
125 | */ |
||
126 | public function getTags() |
||
130 | |||
131 | /** |
||
132 | 1 | * Checks if outline has steps. |
|
133 | * |
||
134 | 1 | * @return Boolean |
|
135 | */ |
||
136 | public function hasSteps() |
||
140 | |||
141 | /** |
||
142 | 6 | * Returns outline steps. |
|
143 | * |
||
144 | 6 | * @return StepNode[] |
|
145 | */ |
||
146 | public function getSteps() |
||
150 | |||
151 | /** |
||
152 | 10 | * Checks if outline has examples. |
|
153 | * |
||
154 | 10 | * @return Boolean |
|
155 | */ |
||
156 | public function hasExamples() |
||
160 | |||
161 | /** |
||
162 | 5 | * Builds and returns examples table for the outline. |
|
163 | * |
||
164 | 5 | * WARNING: it returns a merged table with tags lost. |
|
165 | * |
||
166 | * @deprecated use getExampleTables instead |
||
167 | * @return ExampleTableNode |
||
168 | */ |
||
169 | public function getExampleTable() |
||
183 | |||
184 | 2 | /** |
|
185 | * Returns list of examples for the outline. |
||
186 | * @return ExampleNode[] |
||
187 | */ |
||
188 | public function getExamples() |
||
192 | 15 | ||
193 | /** |
||
194 | 15 | * Returns examples tables array for the outline. |
|
195 | * @return ExampleTableNode[] |
||
196 | */ |
||
197 | public function getExampleTables() |
||
201 | |||
202 | 5 | /** |
|
203 | * Returns outline keyword. |
||
204 | 5 | * |
|
205 | 5 | * @return string |
|
206 | 3 | */ |
|
207 | 3 | public function getKeyword() |
|
211 | 3 | ||
212 | 3 | /** |
|
213 | 3 | * Returns outline declaration line number. |
|
214 | 5 | * |
|
215 | * @return integer |
||
216 | 5 | */ |
|
217 | public function getLine() |
||
221 | |||
222 | /** |
||
223 | * Creates examples for this outline using examples table. |
||
224 | * |
||
225 | * @return ExampleNode[] |
||
226 | */ |
||
227 | 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: