@@ -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 | } |
@@ -194,8 +194,7 @@ |
||
| 194 | 194 | // $this->scriptList contains one or more things to run |
| 195 | 195 | // |
| 196 | 196 | // let's play each of them in order |
| 197 | - foreach ($this->scriptList as $player) |
|
| 198 | - { |
|
| 197 | + foreach ($this->scriptList as $player) { |
|
| 199 | 198 | // play the story(ies) |
| 200 | 199 | $player->play($st, $injectables); |
| 201 | 200 | } |
@@ -102,8 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $return = []; |
| 105 | - foreach ($dirs as $dirToSearch) |
|
| 106 | - { |
|
| 105 | + foreach ($dirs as $dirToSearch) { |
|
| 107 | 106 | // find JSON config files |
| 108 | 107 | $files = $this->configHelper->getListOfConfigFilesIn($dirToSearch, 'json'); |
| 109 | 108 | foreach ($files as $filename) { |
@@ -124,8 +123,7 @@ discard block |
||
| 124 | 123 | $filenames = $this->getListOfConfigFiles($dirs); |
| 125 | 124 | |
| 126 | 125 | // load the files |
| 127 | - foreach ($filenames as $filename) |
|
| 128 | - { |
|
| 126 | + foreach ($filenames as $filename) { |
|
| 129 | 127 | $config = new BaseObject(); |
| 130 | 128 | $this->configHelper->loadConfigFile($config, $filename); |
| 131 | 129 | $return[basename($filename, '.json')] = $config; |
@@ -104,8 +104,7 @@ |
||
| 104 | 104 | // |
| 105 | 105 | // best thing to do is to keep reading from our pipes until |
| 106 | 106 | // the pipes no longer exist |
| 107 | - while (!feof($pipes[1]) || !feof($pipes[2])) |
|
| 108 | - { |
|
| 107 | + while (!feof($pipes[1]) || !feof($pipes[2])) { |
|
| 109 | 108 | // block until there is something to read, or until the |
| 110 | 109 | // timeout has happened |
| 111 | 110 | // |