@@ -323,7 +323,8 @@ |
||
| 323 | 323 | $searchTerm = $methodArgs[0]; |
| 324 | 324 | |
| 325 | 325 | $searchType = $this->determineSearchType($words); |
| 326 | - if ($searchType === null) { // we do not understand how to find the target field |
|
| 326 | + if ($searchType === null) { |
|
| 327 | +// we do not understand how to find the target field |
|
| 327 | 328 | throw new E5xx_ActionFailed(__CLASS__ . '::' . $methodName, "could not work out how to find the target to action upon"); |
| 328 | 329 | } |
| 329 | 330 | |
@@ -245,8 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | // search all of the label elements to find an associated input |
| 247 | 247 | // element that we can safely use |
| 248 | - foreach ($labelElements as $labelElement) |
|
| 249 | - { |
|
| 248 | + foreach ($labelElements as $labelElement) { |
|
| 250 | 249 | try { |
| 251 | 250 | // add each element that matches this label |
| 252 | 251 | $retval[] = $this->getElementAssociatedWithLabelElement($labelElement, $labelText); |
@@ -289,8 +288,7 @@ discard block |
||
| 289 | 288 | } |
| 290 | 289 | |
| 291 | 290 | // what do we do next? |
| 292 | - if ($inputElementId !== null) |
|
| 293 | - { |
|
| 291 | + if ($inputElementId !== null) { |
|
| 294 | 292 | // where does the 'for' attribute go? |
| 295 | 293 | try { |
| 296 | 294 | $inputElement = $log->addStep("find the input element with the id '{$inputElementId}'", function() use($topElement, $inputElementId) { |
@@ -218,8 +218,7 @@ |
||
| 218 | 218 | // $this->playerList contains one or more things to play |
| 219 | 219 | // |
| 220 | 220 | // let's play each of them in order |
| 221 | - foreach ($this->playerList as $player) |
|
| 222 | - { |
|
| 221 | + foreach ($this->playerList as $player) { |
|
| 223 | 222 | // execute each player in turn |
| 224 | 223 | // |
| 225 | 224 | // they may also have their own list of nested players |
@@ -94,8 +94,7 @@ |
||
| 94 | 94 | $engine->options->defines = new stdClass; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - foreach ($params as $param) |
|
| 98 | - { |
|
| 97 | + foreach ($params as $param) { |
|
| 99 | 98 | // split up the setting |
| 100 | 99 | $parts = explode('=', $param); |
| 101 | 100 | $key = array_shift($parts); |
@@ -87,8 +87,7 @@ discard block |
||
| 87 | 87 | $output = $injectables->output; |
| 88 | 88 | |
| 89 | 89 | // are we keeping the test environment hanging around afterwards? |
| 90 | - if (isset($engine->options->persistTarget) && $engine->options->persistTarget) |
|
| 91 | - { |
|
| 90 | + if (isset($engine->options->persistTarget) && $engine->options->persistTarget) { |
|
| 92 | 91 | $injectables->activeConfig->setData('storyplayer.phases.testEnvShutdown.TestEnvironmentDestruction', false); |
| 93 | 92 | $injectables->activeConfig->unsetData('storyplayer.phases.userAbort.TestEnvironmentDestruction'); |
| 94 | 93 | $st->setPersistTestEnvironment(); |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | |
| 97 | 96 | // are we trying to use a test environment that has previously |
| 98 | 97 | // been persisted? |
| 99 | - if (isset($engine->options->reuseTarget) && $engine->options->reuseTarget) |
|
| 100 | - { |
|
| 98 | + if (isset($engine->options->reuseTarget) && $engine->options->reuseTarget) { |
|
| 101 | 99 | // does the target exist to be reused? |
| 102 | 100 | $output->setSilentMode(); |
| 103 | 101 | $hasTarget = $st->fromTargetsTable()->hasCurrentTestEnvironment(); |
@@ -128,8 +126,7 @@ discard block |
||
| 128 | 126 | // if we get here, then we do not need to create the test environment |
| 129 | 127 | $injectables->activeConfig->setData('storyplayer.phases.testEnvStartup.TestEnvironmentConstruction', false); |
| 130 | 128 | } |
| 131 | - else |
|
| 132 | - { |
|
| 129 | + else { |
|
| 133 | 130 | // do we already have this target? |
| 134 | 131 | // |
| 135 | 132 | // this can happen when the test environment was previously |
@@ -112,8 +112,7 @@ |
||
| 112 | 112 | if (isset($engine->options->readOnlyTestUsers) && $engine->options->readOnlyTestUsers) { |
| 113 | 113 | usingUsers()->setUsersFileIsReadOnly(); |
| 114 | 114 | } |
| 115 | - else |
|
| 116 | - { |
|
| 115 | + else { |
|
| 117 | 116 | $setting = fromTestEnvironment()->getModuleSetting("users.readOnly"); |
| 118 | 117 | if ($setting === true) { |
| 119 | 118 | usingUsers()->setUsersFileIsReadOnly(); |
@@ -123,20 +123,22 @@ discard block |
||
| 123 | 123 | $downloader = new FileDownloader(); |
| 124 | 124 | |
| 125 | 125 | // let's get the files downloaded |
| 126 | - foreach ($filesToDownload as $file){ |
|
| 126 | + foreach ($filesToDownload as $file) { |
|
| 127 | 127 | |
| 128 | - if (!is_object($file->url)){ |
|
| 128 | + if (!is_object($file->url)) { |
|
| 129 | 129 | $url = $file->url; |
| 130 | - } else { |
|
| 130 | + } |
|
| 131 | + else { |
|
| 131 | 132 | $platform = strtolower(php_uname("s") . '/' . php_uname("m")); |
| 132 | - if (isset($file->url->{$platform})){ |
|
| 133 | + if (isset($file->url->{$platform})) { |
|
| 133 | 134 | $url = $file->url->{$platform}; |
| 134 | - } else if (isset($file->url->generic)){ |
|
| 135 | + } |
|
| 136 | + else if (isset($file->url->generic)) { |
|
| 135 | 137 | $url = $file->url->generic; |
| 136 | 138 | } |
| 137 | 139 | } |
| 138 | 140 | |
| 139 | - if (!isset($url)){ |
|
| 141 | + if (!isset($url)) { |
|
| 140 | 142 | throw new Exception("No supported downloads for ".$file->name); |
| 141 | 143 | } |
| 142 | 144 | |
@@ -145,7 +147,8 @@ discard block |
||
| 145 | 147 | $headers = array_change_key_case(get_headers($url, 1),CASE_LOWER); |
| 146 | 148 | if ( !preg_match('/HTTP\/1\.(0|1) 200 OK/', $headers[0] ) ) { |
| 147 | 149 | $fileSize = $headers['content-length'][1]; |
| 148 | - } else { |
|
| 150 | + } |
|
| 151 | + else { |
|
| 149 | 152 | $fileSize = $headers['content-length']; |
| 150 | 153 | } |
| 151 | 154 | |
@@ -158,7 +161,7 @@ discard block |
||
| 158 | 161 | |
| 159 | 162 | // Make sure that the relevant files are executable |
| 160 | 163 | if (isset($file->makeExecutable)) { |
| 161 | - foreach ($file->makeExecutable as $exec){ |
|
| 164 | + foreach ($file->makeExecutable as $exec) { |
|
| 162 | 165 | chmod("./vendor/bin/".$exec, 0755); |
| 163 | 166 | } |
| 164 | 167 | } |
@@ -261,8 +261,7 @@ discard block |
||
| 261 | 261 | // $this->playerList contains one or more things to play |
| 262 | 262 | // |
| 263 | 263 | // let's play each of them in order |
| 264 | - foreach ($this->playerList as $player) |
|
| 265 | - { |
|
| 264 | + foreach ($this->playerList as $player) { |
|
| 266 | 265 | // execute each player in turn |
| 267 | 266 | // |
| 268 | 267 | // they may also have their own list of nested players |
@@ -314,8 +313,7 @@ discard block |
||
| 314 | 313 | |
| 315 | 314 | // setup the reports that have been requested |
| 316 | 315 | $injectables->initReportLoaderSupport($injectables); |
| 317 | - foreach ($engine->options->reports as $reportName => $reportFilename) |
|
| 318 | - { |
|
| 316 | + foreach ($engine->options->reports as $reportName => $reportFilename) { |
|
| 319 | 317 | try { |
| 320 | 318 | $report = $injectables->reportLoader->loadReport($reportName, [ 'filename' => $reportFilename]); |
| 321 | 319 | } |
@@ -532,8 +530,7 @@ discard block |
||
| 532 | 530 | echo "FINAL RESULTS\n"; |
| 533 | 531 | echo "\n"; |
| 534 | 532 | |
| 535 | - foreach ($storyResults as $result) |
|
| 536 | - { |
|
| 533 | + foreach ($storyResults as $result) { |
|
| 537 | 534 | echo Story_Player::$outcomeToText[$result->resultCode] . " :: " . $result->story->getName() . "\n"; |
| 538 | 535 | } |
| 539 | 536 | } |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | static $configDir = null; |
| 70 | 70 | |
| 71 | 71 | // do we have a configDir remembered yet? |
| 72 | - if (!$configDir) |
|
| 73 | - { |
|
| 72 | + if (!$configDir) { |
|
| 74 | 73 | $configDir = getcwd() . '/.storyplayer'; |
| 75 | 74 | } |
| 76 | 75 | |
@@ -87,11 +86,9 @@ discard block |
||
| 87 | 86 | $configDir = $this->getConfigDir(); |
| 88 | 87 | |
| 89 | 88 | // does it exist? |
| 90 | - if (!file_exists($configDir)) |
|
| 91 | - { |
|
| 89 | + if (!file_exists($configDir)) { |
|
| 92 | 90 | $success = mkdir($configDir, 0700, true); |
| 93 | - if (!$success) |
|
| 94 | - { |
|
| 91 | + if (!$success) { |
|
| 95 | 92 | // cannot create it - bail out now |
| 96 | 93 | $output->logCliError("unable to create config directory '{$configDir}'"); |
| 97 | 94 | exit(1); |