@@ -72,7 +72,7 @@ |
||
| 72 | 72 | |
| 73 | 73 | try { |
| 74 | 74 | $args['build_filename'] = $this->packageGenerator->getPackageFilename($project->Name, $sha, $repository, $log); |
| 75 | - } catch (Exception $e) { |
|
| 75 | + } catch(Exception $e) { |
|
| 76 | 76 | $log->write($e->getMessage()); |
| 77 | 77 | throw $e; |
| 78 | 78 | } |
@@ -130,10 +130,10 @@ |
||
| 130 | 130 | */ |
| 131 | 131 | public function getChangesModificationNeeded() { |
| 132 | 132 | $filtered = []; |
| 133 | - foreach ($this->changes as $change => $details) { |
|
| 134 | - if (array_key_exists('description', $details)) { |
|
| 133 | + foreach($this->changes as $change => $details) { |
|
| 134 | + if(array_key_exists('description', $details)) { |
|
| 135 | 135 | $filtered[$change] = $details; |
| 136 | - } else if ( |
|
| 136 | + } else if( |
|
| 137 | 137 | (array_key_exists('from', $details) || array_key_exists('to', $details)) |
| 138 | 138 | && $details['from'] !== $details['to'] |
| 139 | 139 | ) { |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | // Make sure we write into the old path for existing logs. New logs use the sanitised file path instead. |
| 78 | 78 | $path = file_exists($this->getRawFilePath()) ? $this->getRawFilePath() : $this->getSanitisedLogFilePath(); |
| 79 | 79 | |
| 80 | - error_log('['.date('Y-m-d H:i:s').'] ' . $message .PHP_EOL, 3, $path); |
|
| 80 | + error_log('[' . date('Y-m-d H:i:s') . '] ' . $message . PHP_EOL, 3, $path); |
|
| 81 | 81 | @chmod($path, 0666); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function asJSONValidatorErrors($code, $validatorErrors) { |
| 65 | 65 | $fieldErrors = []; |
| 66 | - foreach ($validatorErrors as $error) { |
|
| 66 | + foreach($validatorErrors as $error) { |
|
| 67 | 67 | $fieldErrors[$error['fieldName']] = $error['message']; |
| 68 | 68 | } |
| 69 | 69 | return $this->asJSONFormFieldErrors($code, $fieldErrors); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | // To get around that, upon spotting an active redirect, we change the response code to 200, |
| 106 | 106 | // and move the redirect into the "RedirectTo" field in the JSON response. Frontend can |
| 107 | 107 | // then interpret this and trigger a redirect. |
| 108 | - if ($this->redirectedTo()) { |
|
| 108 | + if($this->redirectedTo()) { |
|
| 109 | 109 | $data['RedirectTo'] = $this->response->getHeader('Location'); |
| 110 | 110 | // Pop off the header - we are no longer redirecting via the usual mechanism. |
| 111 | 111 | $this->response->removeHeader('Location'); |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | class FrontendLink extends DataExtension { |
| 4 | 4 | |
| 5 | 5 | public function updateItemEditForm($form) { |
| 6 | - if ($this->owner->record->hasMethod('Link')) { |
|
| 6 | + if($this->owner->record->hasMethod('Link')) { |
|
| 7 | 7 | $link = sprintf( |
| 8 | 8 | '<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview »</a>', |
| 9 | 9 | $this->owner->record->Link() |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @return bool |
| 263 | 263 | */ |
| 264 | 264 | public function canRestore($member = null) { |
| 265 | - if ($this->allowedAny( |
|
| 265 | + if($this->allowedAny( |
|
| 266 | 266 | array( |
| 267 | 267 | DNRoot::ALLOW_PROD_SNAPSHOT, |
| 268 | 268 | DNRoot::ALLOW_NON_PROD_SNAPSHOT |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @return bool |
| 283 | 283 | */ |
| 284 | 284 | public function canBackup($member = null) { |
| 285 | - if ($this->allowedAny( |
|
| 285 | + if($this->allowedAny( |
|
| 286 | 286 | array( |
| 287 | 287 | DNRoot::ALLOW_PROD_SNAPSHOT, |
| 288 | 288 | DNRoot::ALLOW_NON_PROD_SNAPSHOT |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * @return bool |
| 303 | 303 | */ |
| 304 | 304 | public function canUploadArchive($member = null) { |
| 305 | - if ($this->allowedAny( |
|
| 305 | + if($this->allowedAny( |
|
| 306 | 306 | array( |
| 307 | 307 | DNRoot::ALLOW_PROD_SNAPSHOT, |
| 308 | 308 | DNRoot::ALLOW_NON_PROD_SNAPSHOT |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * @return bool |
| 323 | 323 | */ |
| 324 | 324 | public function canDownloadArchive($member = null) { |
| 325 | - if ($this->allowedAny( |
|
| 325 | + if($this->allowedAny( |
|
| 326 | 326 | array( |
| 327 | 327 | DNRoot::ALLOW_PROD_SNAPSHOT, |
| 328 | 328 | DNRoot::ALLOW_NON_PROD_SNAPSHOT |
@@ -498,14 +498,14 @@ discard block |
||
| 498 | 498 | * @return false|DNDeployment |
| 499 | 499 | */ |
| 500 | 500 | public function currentBuilds() { |
| 501 | - if(!isset(self::$relation_cache['currentBuilds.'.$this->ID])) { |
|
| 501 | + if(!isset(self::$relation_cache['currentBuilds.' . $this->ID])) { |
|
| 502 | 502 | $currentBuilds = array(); |
| 503 | 503 | foreach($this->Environments() as $env) { |
| 504 | 504 | $currentBuilds[$env->Name] = $env->CurrentBuild(); |
| 505 | 505 | } |
| 506 | - self::$relation_cache['currentBuilds.'.$this->ID] = $currentBuilds; |
|
| 506 | + self::$relation_cache['currentBuilds.' . $this->ID] = $currentBuilds; |
|
| 507 | 507 | } |
| 508 | - return self::$relation_cache['currentBuilds.'.$this->ID]; |
|
| 508 | + return self::$relation_cache['currentBuilds.' . $this->ID]; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | /** |
@@ -987,14 +987,14 @@ discard block |
||
| 987 | 987 | * @return bool |
| 988 | 988 | */ |
| 989 | 989 | public function allowedAny($codes, $member = null) { |
| 990 | - if (!$member) { |
|
| 990 | + if(!$member) { |
|
| 991 | 991 | $member = Member::currentUser(); |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | if(Permission::checkMember($member, 'ADMIN')) return true; |
| 995 | 995 | |
| 996 | 996 | $hits = $this->whoIsAllowedAny($codes)->filter('Member.ID', $member->ID)->count(); |
| 997 | - return ($hits>0 ? true : false); |
|
| 997 | + return ($hits > 0 ? true : false); |
|
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | /** |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function getFullDeployMessages() { |
| 203 | 203 | $strategy = $this->getDeploymentStrategy(); |
| 204 | - if ($strategy->getActionCode()!=='full') return null; |
|
| 204 | + if($strategy->getActionCode() !== 'full') return null; |
|
| 205 | 205 | |
| 206 | 206 | $changes = $strategy->getChangesModificationNeeded(); |
| 207 | 207 | $messages = []; |
| 208 | - foreach ($changes as $change => $details) { |
|
| 209 | - if ($change==='Code version') continue; |
|
| 208 | + foreach($changes as $change => $details) { |
|
| 209 | + if($change === 'Code version') continue; |
|
| 210 | 210 | |
| 211 | 211 | $messages[] = [ |
| 212 | 212 | 'Flag' => sprintf( |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | ]; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if (empty($messages)) { |
|
| 220 | + if(empty($messages)) { |
|
| 221 | 221 | $messages[] = [ |
| 222 | 222 | 'Flag' => '', |
| 223 | 223 | 'Text' => '<i>Environment changes have been made.</i>' |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | curl_setopt($ch, CURLOPT_URL, $test['URL']); |
| 128 | 128 | |
| 129 | 129 | // Allow individual tests to override number of attempts |
| 130 | - $attempts = (int) $this->getConfigSetting('Attempts'); |
|
| 130 | + $attempts = (int)$this->getConfigSetting('Attempts'); |
|
| 131 | 131 | if(!empty($test['Attempts'])) { |
| 132 | 132 | $attempts = $test['Attempts']; |
| 133 | 133 | } |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | Requirements::javascript('deploynaut/javascript/material.js'); |
| 187 | 187 | |
| 188 | 188 | // Load the buildable dependencies only if not loaded centrally. |
| 189 | - if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) { |
|
| 190 | - if (\Director::isDev()) { |
|
| 189 | + if(!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) { |
|
| 190 | + if(\Director::isDev()) { |
|
| 191 | 191 | \Requirements::javascript('deploynaut/static/bundle-debug.js'); |
| 192 | 192 | } else { |
| 193 | 193 | \Requirements::javascript('deploynaut/static/bundle.js'); |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | */ |
| 1047 | 1047 | public function getPlatformSpecificStrings() { |
| 1048 | 1048 | $strings = $this->config()->platform_specific_strings; |
| 1049 | - if ($strings) { |
|
| 1049 | + if($strings) { |
|
| 1050 | 1050 | return new ArrayList($strings); |
| 1051 | 1051 | } |
| 1052 | 1052 | } |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | |
| 1112 | 1112 | $isCurrentEnvironment = false; |
| 1113 | 1113 | if($project && $currentEnvironment) { |
| 1114 | - $isCurrentEnvironment = (bool) $project->DNEnvironmentList()->find('ID', $currentEnvironment->ID); |
|
| 1114 | + $isCurrentEnvironment = (bool)$project->DNEnvironmentList()->find('ID', $currentEnvironment->ID); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | $navigation->push(array( |
@@ -2345,7 +2345,7 @@ discard block |
||
| 2345 | 2345 | public function AmbientMenu() { |
| 2346 | 2346 | $list = new ArrayList(); |
| 2347 | 2347 | |
| 2348 | - if (Member::currentUserID()) { |
|
| 2348 | + if(Member::currentUserID()) { |
|
| 2349 | 2349 | $list->push(new ArrayData(array( |
| 2350 | 2350 | 'Classes' => 'logout', |
| 2351 | 2351 | 'FaIcon' => 'sign-out', |