@@ -61,7 +61,7 @@ |
||
61 | 61 | public function __construct($envName) |
62 | 62 | { |
63 | 63 | $msg = "Unknown test environment '{$envName}'; we have no config for it" . PHP_EOL . PHP_EOL |
64 | - . "Use 'storyplayer list-test-environments' to see the list of known test environments"; |
|
64 | + . "Use 'storyplayer list-test-environments' to see the list of known test environments"; |
|
65 | 65 | parent::__construct(400, $msg, $msg); |
66 | 66 | } |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -221,7 +221,7 @@ |
||
221 | 221 | |
222 | 222 | // SSH in and have a look |
223 | 223 | $command = "ps -ef | grep '{$pid}'"; |
224 | - $result = $this->runCommand($hostDetails, $command); |
|
224 | + $result = $this->runCommand($hostDetails, $command); |
|
225 | 225 | |
226 | 226 | // what did we find? |
227 | 227 | if ($result->didCommandFail() || empty($result->output)) { |
@@ -76,8 +76,7 @@ |
||
76 | 76 | // how do we do this? |
77 | 77 | if (isset($hostDetails->hostname)) { |
78 | 78 | $ipAddress = gethostbyname($hostDetails->hostname); |
79 | - if ($ipAddress != $hostDetails->hostname) |
|
80 | - { |
|
79 | + if ($ipAddress != $hostDetails->hostname) { |
|
81 | 80 | $log->endAction(["IP address is", $ipAddress]); |
82 | 81 | return $ipAddress; |
83 | 82 | } |
@@ -128,7 +128,7 @@ |
||
128 | 128 | // |
129 | 129 | // most of the world uses 127.0.0.1 |
130 | 130 | // ubuntu uses 127.0.1.1 (no idea why) |
131 | - $validIps = [ '127.0.0.1', '127.0.1.1' ]; |
|
131 | + $validIps = ['127.0.0.1', '127.0.1.1']; |
|
132 | 132 | if (!in_array($hostDetails->ipAddress, $validIps)) { |
133 | 133 | // this hostname is *not* safe |
134 | 134 | // |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | public function startStoryplayer($version, $url, $copyright, $license) |
259 | 259 | { |
260 | 260 | // enforce our inputs |
261 | - Contract::RequiresValue($version, is_string($version)); |
|
262 | - Contract::RequiresValue($url, is_string($url)); |
|
261 | + Contract::RequiresValue($version, is_string($version)); |
|
262 | + Contract::RequiresValue($url, is_string($url)); |
|
263 | 263 | Contract::RequiresValue($copyright, is_string($copyright)); |
264 | - Contract::RequiresValue($license, is_string($license)); |
|
264 | + Contract::RequiresValue($license, is_string($license)); |
|
265 | 265 | |
266 | 266 | // call all of our plugins |
267 | 267 | foreach ($this->plugins as $plugin) |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | { |
299 | 299 | // ensure our inputs! |
300 | 300 | Contract::RequiresValue($activity, is_string($activity)); |
301 | - Contract::RequiresValue($name, is_string($name)); |
|
301 | + Contract::RequiresValue($name, is_string($name)); |
|
302 | 302 | |
303 | 303 | // call our plugins |
304 | 304 | foreach ($this->plugins as $plugin) |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | // inject the captured activity into the phase |
366 | 366 | $phaseResult->activityLog = $this->activityLog; |
367 | - $this->activityLog=[]; |
|
367 | + $this->activityLog = []; |
|
368 | 368 | |
369 | 369 | // pass the phase on |
370 | 370 | foreach ($this->plugins as $plugin) |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | { |
448 | 448 | // enforce our inputs |
449 | 449 | Contract::RequiresValue($phaseName, is_string($phaseName)); |
450 | - Contract::RequiresValue($msg, is_string($msg)); |
|
450 | + Contract::RequiresValue($msg, is_string($msg)); |
|
451 | 451 | |
452 | 452 | // keep track of what was attempted, in case we need to show |
453 | 453 | // the user what was attempted |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | { |
478 | 478 | // enforce our inputs |
479 | 479 | Contract::RequiresValue($phaseName, is_string($phaseName)); |
480 | - Contract::RequiresValue($msg, is_string($msg)); |
|
480 | + Contract::RequiresValue($msg, is_string($msg)); |
|
481 | 481 | |
482 | 482 | // keep track of what was attempted, in case we need to show |
483 | 483 | // the user what was attempted |
@@ -179,8 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function resetSilentMode() |
181 | 181 | { |
182 | - foreach ($this->plugins as $plugin) |
|
183 | - { |
|
182 | + foreach ($this->plugins as $plugin) { |
|
184 | 183 | $plugin->resetSilentMode(); |
185 | 184 | } |
186 | 185 | } |
@@ -196,8 +195,7 @@ discard block |
||
196 | 195 | */ |
197 | 196 | public function setSilentMode() |
198 | 197 | { |
199 | - foreach ($this->plugins as $plugin) |
|
200 | - { |
|
198 | + foreach ($this->plugins as $plugin) { |
|
201 | 199 | $plugin->setSilentMode(); |
202 | 200 | } |
203 | 201 | } |
@@ -213,8 +211,7 @@ discard block |
||
213 | 211 | */ |
214 | 212 | public function setIsVerbose($isVerbose) |
215 | 213 | { |
216 | - foreach ($this->plugins as $plugin) |
|
217 | - { |
|
214 | + foreach ($this->plugins as $plugin) { |
|
218 | 215 | $plugin->setIsVerbose($isVerbose); |
219 | 216 | } |
220 | 217 | } |
@@ -226,8 +223,7 @@ discard block |
||
226 | 223 | */ |
227 | 224 | public function disableColourSupport() |
228 | 225 | { |
229 | - foreach ($this->plugins as $plugin) |
|
230 | - { |
|
226 | + foreach ($this->plugins as $plugin) { |
|
231 | 227 | $plugin->disableColourSupport(); |
232 | 228 | } |
233 | 229 | } |
@@ -239,8 +235,7 @@ discard block |
||
239 | 235 | */ |
240 | 236 | public function enforceColourSupport() |
241 | 237 | { |
242 | - foreach ($this->plugins as $plugin) |
|
243 | - { |
|
238 | + foreach ($this->plugins as $plugin) { |
|
244 | 239 | $plugin->enforceColourSupport(); |
245 | 240 | } |
246 | 241 | } |
@@ -257,8 +252,7 @@ discard block |
||
257 | 252 | */ |
258 | 253 | public function enableColourSupport() |
259 | 254 | { |
260 | - foreach ($this->plugins as $plugin) |
|
261 | - { |
|
255 | + foreach ($this->plugins as $plugin) { |
|
262 | 256 | $plugin->enableColourSupport(); |
263 | 257 | } |
264 | 258 | } |
@@ -281,8 +275,7 @@ discard block |
||
281 | 275 | Contract::RequiresValue($license, is_string($license)); |
282 | 276 | |
283 | 277 | // call all of our plugins |
284 | - foreach ($this->plugins as $plugin) |
|
285 | - { |
|
278 | + foreach ($this->plugins as $plugin) { |
|
286 | 279 | $plugin->startStoryplayer($version, $url, $copyright, $license); |
287 | 280 | } |
288 | 281 | } |
@@ -296,8 +289,7 @@ discard block |
||
296 | 289 | */ |
297 | 290 | public function endStoryplayer($duration) |
298 | 291 | { |
299 | - foreach ($this->plugins as $plugin) |
|
300 | - { |
|
292 | + foreach ($this->plugins as $plugin) { |
|
301 | 293 | $plugin->endStoryplayer($duration); |
302 | 294 | } |
303 | 295 | } |
@@ -321,8 +313,7 @@ discard block |
||
321 | 313 | Contract::RequiresValue($name, is_string($name)); |
322 | 314 | |
323 | 315 | // call our plugins |
324 | - foreach ($this->plugins as $plugin) |
|
325 | - { |
|
316 | + foreach ($this->plugins as $plugin) { |
|
326 | 317 | $plugin->startPhaseGroup($activity, $name, $details); |
327 | 318 | } |
328 | 319 | } |
@@ -343,8 +334,7 @@ discard block |
||
343 | 334 | Contract::Requires($result instanceof PhaseGroup_Result); |
344 | 335 | |
345 | 336 | // call our plugins |
346 | - foreach ($this->plugins as $plugin) |
|
347 | - { |
|
337 | + foreach ($this->plugins as $plugin) { |
|
348 | 338 | $plugin->endPhaseGroup($result); |
349 | 339 | } |
350 | 340 | } |
@@ -361,8 +351,7 @@ discard block |
||
361 | 351 | // enforce our input type |
362 | 352 | Contract::Requires($phase instanceof Phase); |
363 | 353 | |
364 | - foreach ($this->plugins as $plugin) |
|
365 | - { |
|
354 | + foreach ($this->plugins as $plugin) { |
|
366 | 355 | $plugin->startPhase($phase); |
367 | 356 | } |
368 | 357 | } |
@@ -387,8 +376,7 @@ discard block |
||
387 | 376 | $this->activityLog=[]; |
388 | 377 | |
389 | 378 | // pass the phase on |
390 | - foreach ($this->plugins as $plugin) |
|
391 | - { |
|
379 | + foreach ($this->plugins as $plugin) { |
|
392 | 380 | $plugin->endPhase($phase, $phaseResult); |
393 | 381 | } |
394 | 382 | } |
@@ -420,8 +408,7 @@ discard block |
||
420 | 408 | ]; |
421 | 409 | |
422 | 410 | // call all of our plugins |
423 | - foreach ($this->plugins as $plugin) |
|
424 | - { |
|
411 | + foreach ($this->plugins as $plugin) { |
|
425 | 412 | $plugin->logPhaseActivity($msg, $codeLine); |
426 | 413 | } |
427 | 414 | } |
@@ -448,8 +435,7 @@ discard block |
||
448 | 435 | ]; |
449 | 436 | |
450 | 437 | // call all of our plugins |
451 | - foreach ($this->plugins as $plugin) |
|
452 | - { |
|
438 | + foreach ($this->plugins as $plugin) { |
|
453 | 439 | $plugin->logPhaseSubprocessOutput($msg); |
454 | 440 | } |
455 | 441 | } |
@@ -478,8 +464,7 @@ discard block |
||
478 | 464 | ]; |
479 | 465 | |
480 | 466 | // call all of our plugins |
481 | - foreach ($this->plugins as $plugin) |
|
482 | - { |
|
467 | + foreach ($this->plugins as $plugin) { |
|
483 | 468 | $plugin->logPhaseError($phaseName, $msg); |
484 | 469 | } |
485 | 470 | } |
@@ -508,8 +493,7 @@ discard block |
||
508 | 493 | ]; |
509 | 494 | |
510 | 495 | // call all of our plugins |
511 | - foreach ($this->plugins as $plugin) |
|
512 | - { |
|
496 | + foreach ($this->plugins as $plugin) { |
|
513 | 497 | $plugin->logPhaseSkipped($phaseName, $msg); |
514 | 498 | } |
515 | 499 | } |
@@ -528,8 +512,7 @@ discard block |
||
528 | 512 | Contract::RequiresValue($codeLine, is_array($codeLine)); |
529 | 513 | |
530 | 514 | // pass it on to all of our plugins |
531 | - foreach ($this->plugins as $plugin) |
|
532 | - { |
|
515 | + foreach ($this->plugins as $plugin) { |
|
533 | 516 | $plugin->logPhaseCodeLine($codeLine); |
534 | 517 | } |
535 | 518 | } |
@@ -548,8 +531,7 @@ discard block |
||
548 | 531 | Contract::RequiresValue($msg, is_string($msg)); |
549 | 532 | |
550 | 533 | // pass it on to our plugins |
551 | - foreach ($this->plugins as $plugin) |
|
552 | - { |
|
534 | + foreach ($this->plugins as $plugin) { |
|
553 | 535 | $plugin->logCliError($msg); |
554 | 536 | } |
555 | 537 | } |
@@ -570,8 +552,7 @@ discard block |
||
570 | 552 | Contract::RequiresValue($e, $e instanceof Exception); |
571 | 553 | |
572 | 554 | // pass this on to our plugins |
573 | - foreach ($this->plugins as $plugin) |
|
574 | - { |
|
555 | + foreach ($this->plugins as $plugin) { |
|
575 | 556 | $plugin->logCliErrorWithException($msg, $e); |
576 | 557 | } |
577 | 558 | } |
@@ -590,8 +571,7 @@ discard block |
||
590 | 571 | Contract::RequiresValue($msg, is_string($msg)); |
591 | 572 | |
592 | 573 | // pass this on to our plugins |
593 | - foreach ($this->plugins as $plugin) |
|
594 | - { |
|
574 | + foreach ($this->plugins as $plugin) { |
|
595 | 575 | $plugin->logCliWarning($msg); |
596 | 576 | } |
597 | 577 | } |
@@ -610,8 +590,7 @@ discard block |
||
610 | 590 | Contract::RequiresValue($msg, is_string($msg)); |
611 | 591 | |
612 | 592 | // pass this on to our plugins |
613 | - foreach ($this->plugins as $plugin) |
|
614 | - { |
|
593 | + foreach ($this->plugins as $plugin) { |
|
615 | 594 | $plugin->logCliInfo($msg); |
616 | 595 | } |
617 | 596 | } |
@@ -634,8 +613,7 @@ discard block |
||
634 | 613 | // $var can be anything, so there is no contract to enforce |
635 | 614 | |
636 | 615 | // pass this on to our plugins |
637 | - foreach ($this->plugins as $plugin) |
|
638 | - { |
|
616 | + foreach ($this->plugins as $plugin) { |
|
639 | 617 | $plugin->logVardump($name, $var); |
640 | 618 | } |
641 | 619 | } |
@@ -58,7 +58,8 @@ |
||
58 | 58 | */ |
59 | 59 | class E4xx_OutputFilenameIsAReservedName extends Exxx_Exception |
60 | 60 | { |
61 | - public function __construct($filename) { |
|
61 | + public function __construct($filename) |
|
62 | + { |
|
62 | 63 | $msg = "'{$filename}' is reserved for internal use; please use a different filename"; |
63 | 64 | parent::__construct(400, $msg, $msg); |
64 | 65 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | public function addOutputToFile($filename) |
99 | 99 | { |
100 | 100 | // make sure $filename isn't a reserved name |
101 | - switch($filename) |
|
101 | + switch ($filename) |
|
102 | 102 | { |
103 | 103 | case 'stdout': |
104 | 104 | case 'stderr': |
@@ -98,8 +98,7 @@ |
||
98 | 98 | public function addOutputToFile($filename) |
99 | 99 | { |
100 | 100 | // make sure $filename isn't a reserved name |
101 | - switch($filename) |
|
102 | - { |
|
101 | + switch($filename) { |
|
103 | 102 | case 'stdout': |
104 | 103 | case 'stderr': |
105 | 104 | case 'null': |
@@ -230,8 +230,8 @@ |
||
230 | 230 | { |
231 | 231 | // if we get here, then yes we do |
232 | 232 | return sprintf(ConsoleColor::ESCAPE_SEQUENCE, \implode(';', $style)) |
233 | - . $output |
|
234 | - . sprintf(ConsoleColor::ESCAPE_SEQUENCE, ConsoleColor::NONE); |
|
233 | + . $output |
|
234 | + . sprintf(ConsoleColor::ESCAPE_SEQUENCE, ConsoleColor::NONE); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // ================================================================== |
@@ -82,7 +82,7 @@ |
||
82 | 82 | public $argumentsHeadingStyle = null; |
83 | 83 | public $failedPhaseStyle = null; |
84 | 84 | |
85 | - protected $outputHandles = []; |
|
85 | + protected $outputHandles = []; |
|
86 | 86 | |
87 | 87 | public function __construct() |
88 | 88 | { |
@@ -171,8 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | public function setColourMode($mode) |
173 | 173 | { |
174 | - switch ($mode) |
|
175 | - { |
|
174 | + switch ($mode) { |
|
176 | 175 | case OutputPlugin::COLOUR_MODE_OFF: |
177 | 176 | foreach ($this->outputHandles as $index => $outputHandle) { |
178 | 177 | if ($outputHandle['colour']) { |
@@ -183,8 +182,7 @@ discard block |
||
183 | 182 | |
184 | 183 | case OutputPlugin::COLOUR_MODE_ON: |
185 | 184 | foreach ($this->outputHandles as $index => $outputHandle) { |
186 | - switch ($index) |
|
187 | - { |
|
185 | + switch ($index) { |
|
188 | 186 | case 'stdout': |
189 | 187 | case 'stderr': |
190 | 188 | $this->outputHandles[$index]['colour'] = true; |
@@ -128,6 +128,9 @@ discard block |
||
128 | 128 | ]; |
129 | 129 | } |
130 | 130 | |
131 | + /** |
|
132 | + * @param string $filename |
|
133 | + */ |
|
131 | 134 | public function addOutputToFile($filename) |
132 | 135 | { |
133 | 136 | // can we open the file? |
@@ -169,6 +172,9 @@ discard block |
||
169 | 172 | // |
170 | 173 | // ------------------------------------------------------------------ |
171 | 174 | |
175 | + /** |
|
176 | + * @param integer $mode |
|
177 | + */ |
|
172 | 178 | public function setColourMode($mode) |
173 | 179 | { |
174 | 180 | switch ($mode) |
@@ -73,8 +73,7 @@ |
||
73 | 73 | $phaseResult = $this->getNewPhaseResult(); |
74 | 74 | |
75 | 75 | // do we have anything to do? |
76 | - if (!$story->hasActions()) |
|
77 | - { |
|
76 | + if (!$story->hasActions()) { |
|
78 | 77 | $phaseResult->setContinuePlaying( |
79 | 78 | $phaseResult::HASNOACTIONS, |
80 | 79 | "story has no action instructions" |
@@ -89,7 +89,7 @@ |
||
89 | 89 | $callbacks = $story->getAction(); |
90 | 90 | foreach ($callbacks as $action) { |
91 | 91 | if (is_callable($action)) { |
92 | - call_user_func($action,$st); |
|
92 | + call_user_func($action, $st); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 |
@@ -113,8 +113,7 @@ discard block |
||
113 | 113 | $story = $st->getStory(); |
114 | 114 | |
115 | 115 | // do we have anything to do? |
116 | - if (!$story->hasPerPhaseSetup()) |
|
117 | - { |
|
116 | + if (!$story->hasPerPhaseSetup()) { |
|
118 | 117 | return; |
119 | 118 | } |
120 | 119 | |
@@ -136,8 +135,7 @@ discard block |
||
136 | 135 | $story = $st->getStory(); |
137 | 136 | |
138 | 137 | // do we have anything to do? |
139 | - if ($story->hasPerPhaseTeardown()) |
|
140 | - { |
|
138 | + if ($story->hasPerPhaseTeardown()) { |
|
141 | 139 | // get the callback to call |
142 | 140 | $callbacks = $story->getPerPhaseTeardown(); |
143 | 141 |