1 | <?php |
||
18 | class ExampleNode 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 $outlineSteps; |
||
32 | /** |
||
33 | * @var string[] |
||
34 | */ |
||
35 | private $tokens; |
||
36 | /** |
||
37 | * @var integer |
||
38 | */ |
||
39 | private $line; |
||
40 | /** |
||
41 | * @var null|StepNode[] |
||
42 | */ |
||
43 | private $steps; |
||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | private $outlineTitle; |
||
48 | |||
49 | /** |
||
50 | * Initializes outline. |
||
51 | * |
||
52 | * @param string $title |
||
53 | * @param string[] $tags |
||
54 | * @param StepNode[] $outlineSteps |
||
55 | * @param string[] $tokens |
||
56 | * @param integer $line |
||
57 | * @param string|null $outlineTitle |
||
58 | */ |
||
59 | 4 | public function __construct($title, array $tags, $outlineSteps, array $tokens, $line, $outlineTitle = null) |
|
68 | |||
69 | /** |
||
70 | * Returns node type string |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getNodeType() |
||
78 | |||
79 | /** |
||
80 | * Returns node keyword. |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getKeyword() |
||
88 | |||
89 | /** |
||
90 | * Returns example title. |
||
91 | * |
||
92 | * @return 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 | 1 | public function hasTag($tag) |
|
107 | { |
||
108 | 1 | return in_array($tag, $this->getTags()); |
|
109 | } |
||
110 | |||
111 | /** |
||
112 | * Checks if outline has tags (both inherited from feature and own). |
||
113 | * |
||
114 | * @return Boolean |
||
115 | */ |
||
116 | public function hasTags() |
||
120 | |||
121 | /** |
||
122 | * Returns outline tags (including inherited from feature). |
||
123 | * |
||
124 | * @return string[] |
||
125 | */ |
||
126 | 1 | public function getTags() |
|
127 | { |
||
128 | 1 | return $this->tags; |
|
129 | } |
||
130 | |||
131 | /** |
||
132 | * Checks if outline has steps. |
||
133 | * |
||
134 | * @return Boolean |
||
135 | */ |
||
136 | public function hasSteps() |
||
140 | |||
141 | /** |
||
142 | * Returns outline steps. |
||
143 | * |
||
144 | * @return StepNode[] |
||
145 | */ |
||
146 | 2 | public function getSteps() |
|
150 | |||
151 | /** |
||
152 | * Returns example tokens. |
||
153 | * |
||
154 | * @return string[] |
||
155 | */ |
||
156 | 2 | public function getTokens() |
|
160 | |||
161 | /** |
||
162 | * Returns outline declaration line number. |
||
163 | * |
||
164 | * @return integer |
||
165 | */ |
||
166 | 2 | public function getLine() |
|
170 | |||
171 | /** |
||
172 | * Returns outline title. |
||
173 | * |
||
174 | * @return string |
||
175 | */ |
||
176 | public function getOutlineTitle() |
||
180 | |||
181 | /** |
||
182 | * Creates steps for this example from abstract outline steps. |
||
183 | * |
||
184 | * @return StepNode[] |
||
185 | */ |
||
186 | 2 | protected function createExampleSteps() |
|
201 | |||
202 | /** |
||
203 | * Replaces tokens in arguments with row values. |
||
204 | * |
||
205 | * @param ArgumentInterface[] $arguments |
||
206 | * |
||
207 | * @return ArgumentInterface[] |
||
208 | */ |
||
209 | 2 | protected function replaceArgumentsTokens(array $arguments) |
|
222 | |||
223 | /** |
||
224 | * Replaces tokens in table with row values. |
||
225 | * |
||
226 | * @param TableNode $argument |
||
227 | * |
||
228 | * @return TableNode |
||
229 | */ |
||
230 | 1 | protected function replaceTableArgumentTokens(TableNode $argument) |
|
241 | |||
242 | /** |
||
243 | * Replaces tokens in PyString with row values. |
||
244 | * |
||
245 | * @param PyStringNode $argument |
||
246 | * |
||
247 | * @return PyStringNode |
||
248 | */ |
||
249 | 1 | protected function replacePyStringArgumentTokens(PyStringNode $argument) |
|
258 | |||
259 | /** |
||
260 | * Replaces tokens in text with row values. |
||
261 | * |
||
262 | * @param string $text |
||
263 | * |
||
264 | * @return string |
||
265 | */ |
||
266 | 2 | protected function replaceTextTokens($text) |
|
274 | } |
||
275 |