@@ -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 | } |
@@ -209,8 +207,7 @@ discard block |
||
| 209 | 207 | */ |
| 210 | 208 | public function disableColourSupport() |
| 211 | 209 | { |
| 212 | - foreach ($this->plugins as $plugin) |
|
| 213 | - { |
|
| 210 | + foreach ($this->plugins as $plugin) { |
|
| 214 | 211 | $plugin->disableColourSupport(); |
| 215 | 212 | } |
| 216 | 213 | } |
@@ -222,8 +219,7 @@ discard block |
||
| 222 | 219 | */ |
| 223 | 220 | public function enforceColourSupport() |
| 224 | 221 | { |
| 225 | - foreach ($this->plugins as $plugin) |
|
| 226 | - { |
|
| 222 | + foreach ($this->plugins as $plugin) { |
|
| 227 | 223 | $plugin->enforceColourSupport(); |
| 228 | 224 | } |
| 229 | 225 | } |
@@ -240,8 +236,7 @@ discard block |
||
| 240 | 236 | */ |
| 241 | 237 | public function enableColourSupport() |
| 242 | 238 | { |
| 243 | - foreach ($this->plugins as $plugin) |
|
| 244 | - { |
|
| 239 | + foreach ($this->plugins as $plugin) { |
|
| 245 | 240 | $plugin->enableColourSupport(); |
| 246 | 241 | } |
| 247 | 242 | } |
@@ -264,8 +259,7 @@ discard block |
||
| 264 | 259 | Contract::RequiresValue($license, is_string($license)); |
| 265 | 260 | |
| 266 | 261 | // call all of our plugins |
| 267 | - foreach ($this->plugins as $plugin) |
|
| 268 | - { |
|
| 262 | + foreach ($this->plugins as $plugin) { |
|
| 269 | 263 | $plugin->startStoryplayer($version, $url, $copyright, $license); |
| 270 | 264 | } |
| 271 | 265 | } |
@@ -279,8 +273,7 @@ discard block |
||
| 279 | 273 | */ |
| 280 | 274 | public function endStoryplayer($duration) |
| 281 | 275 | { |
| 282 | - foreach ($this->plugins as $plugin) |
|
| 283 | - { |
|
| 276 | + foreach ($this->plugins as $plugin) { |
|
| 284 | 277 | $plugin->endStoryplayer($duration); |
| 285 | 278 | } |
| 286 | 279 | } |
@@ -301,8 +294,7 @@ discard block |
||
| 301 | 294 | Contract::RequiresValue($name, is_string($name)); |
| 302 | 295 | |
| 303 | 296 | // call our plugins |
| 304 | - foreach ($this->plugins as $plugin) |
|
| 305 | - { |
|
| 297 | + foreach ($this->plugins as $plugin) { |
|
| 306 | 298 | $plugin->startPhaseGroup($activity, $name); |
| 307 | 299 | } |
| 308 | 300 | } |
@@ -323,8 +315,7 @@ discard block |
||
| 323 | 315 | Contract::Requires($result instanceof PhaseGroup_Result); |
| 324 | 316 | |
| 325 | 317 | // call our plugins |
| 326 | - foreach ($this->plugins as $plugin) |
|
| 327 | - { |
|
| 318 | + foreach ($this->plugins as $plugin) { |
|
| 328 | 319 | $plugin->endPhaseGroup($result); |
| 329 | 320 | } |
| 330 | 321 | } |
@@ -341,8 +332,7 @@ discard block |
||
| 341 | 332 | // enforce our input type |
| 342 | 333 | Contract::Requires($phase instanceof Phase); |
| 343 | 334 | |
| 344 | - foreach ($this->plugins as $plugin) |
|
| 345 | - { |
|
| 335 | + foreach ($this->plugins as $plugin) { |
|
| 346 | 336 | $plugin->startPhase($phase); |
| 347 | 337 | } |
| 348 | 338 | } |
@@ -367,8 +357,7 @@ discard block |
||
| 367 | 357 | $this->activityLog=[]; |
| 368 | 358 | |
| 369 | 359 | // pass the phase on |
| 370 | - foreach ($this->plugins as $plugin) |
|
| 371 | - { |
|
| 360 | + foreach ($this->plugins as $plugin) { |
|
| 372 | 361 | $plugin->endPhase($phase, $phaseResult); |
| 373 | 362 | } |
| 374 | 363 | } |
@@ -400,8 +389,7 @@ discard block |
||
| 400 | 389 | ]; |
| 401 | 390 | |
| 402 | 391 | // call all of our plugins |
| 403 | - foreach ($this->plugins as $plugin) |
|
| 404 | - { |
|
| 392 | + foreach ($this->plugins as $plugin) { |
|
| 405 | 393 | $plugin->logPhaseActivity($msg, $codeLine); |
| 406 | 394 | } |
| 407 | 395 | } |
@@ -428,8 +416,7 @@ discard block |
||
| 428 | 416 | ]; |
| 429 | 417 | |
| 430 | 418 | // call all of our plugins |
| 431 | - foreach ($this->plugins as $plugin) |
|
| 432 | - { |
|
| 419 | + foreach ($this->plugins as $plugin) { |
|
| 433 | 420 | $plugin->logPhaseSubprocessOutput($msg); |
| 434 | 421 | } |
| 435 | 422 | } |
@@ -458,8 +445,7 @@ discard block |
||
| 458 | 445 | ]; |
| 459 | 446 | |
| 460 | 447 | // call all of our plugins |
| 461 | - foreach ($this->plugins as $plugin) |
|
| 462 | - { |
|
| 448 | + foreach ($this->plugins as $plugin) { |
|
| 463 | 449 | $plugin->logPhaseError($phaseName, $msg); |
| 464 | 450 | } |
| 465 | 451 | } |
@@ -488,8 +474,7 @@ discard block |
||
| 488 | 474 | ]; |
| 489 | 475 | |
| 490 | 476 | // call all of our plugins |
| 491 | - foreach ($this->plugins as $plugin) |
|
| 492 | - { |
|
| 477 | + foreach ($this->plugins as $plugin) { |
|
| 493 | 478 | $plugin->logPhaseSkipped($phaseName, $msg); |
| 494 | 479 | } |
| 495 | 480 | } |
@@ -508,8 +493,7 @@ discard block |
||
| 508 | 493 | Contract::RequiresValue($codeLine, is_array($codeLine)); |
| 509 | 494 | |
| 510 | 495 | // pass it on to all of our plugins |
| 511 | - foreach ($this->plugins as $plugin) |
|
| 512 | - { |
|
| 496 | + foreach ($this->plugins as $plugin) { |
|
| 513 | 497 | $plugin->logPhaseCodeLine($codeLine); |
| 514 | 498 | } |
| 515 | 499 | } |
@@ -528,8 +512,7 @@ discard block |
||
| 528 | 512 | Contract::RequiresValue($msg, is_string($msg)); |
| 529 | 513 | |
| 530 | 514 | // pass it on to our plugins |
| 531 | - foreach ($this->plugins as $plugin) |
|
| 532 | - { |
|
| 515 | + foreach ($this->plugins as $plugin) { |
|
| 533 | 516 | $plugin->logCliError($msg); |
| 534 | 517 | } |
| 535 | 518 | } |
@@ -550,8 +533,7 @@ discard block |
||
| 550 | 533 | Contract::RequiresValue($e, $e instanceof Exception); |
| 551 | 534 | |
| 552 | 535 | // pass this on to our plugins |
| 553 | - foreach ($this->plugins as $plugin) |
|
| 554 | - { |
|
| 536 | + foreach ($this->plugins as $plugin) { |
|
| 555 | 537 | $plugin->logCliErrorWithException($msg, $e); |
| 556 | 538 | } |
| 557 | 539 | } |
@@ -570,8 +552,7 @@ discard block |
||
| 570 | 552 | Contract::RequiresValue($msg, is_string($msg)); |
| 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->logCliWarning($msg); |
| 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->logCliInfo($msg); |
| 596 | 576 | } |
| 597 | 577 | } |
@@ -614,8 +594,7 @@ discard block |
||
| 614 | 594 | // $var can be anything, so there is no contract to enforce |
| 615 | 595 | |
| 616 | 596 | // pass this on to our plugins |
| 617 | - foreach ($this->plugins as $plugin) |
|
| 618 | - { |
|
| 597 | + foreach ($this->plugins as $plugin) { |
|
| 619 | 598 | $plugin->logVardump($name, $var); |
| 620 | 599 | } |
| 621 | 600 | } |
@@ -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; |
@@ -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" |
@@ -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 | |