| @@ -75,6 +75,7 @@ discard block | ||
| 75 | 75 | } | 
| 76 | 76 | |
| 77 | 77 | /** | 
| 78 | + * @param string $code | |
| 78 | 79 | */ | 
| 79 | 80 |  	public function setActionCode($code) { | 
| 80 | 81 | $this->actionCode = $code; | 
| @@ -89,6 +90,7 @@ discard block | ||
| 89 | 90 | |
| 90 | 91 | /** | 
| 91 | 92 | * @param int | 
| 93 | + * @param string $seconds | |
| 92 | 94 | */ | 
| 93 | 95 |  	public function setEstimatedTime($seconds) { | 
| 94 | 96 | $this->estimatedTime = $seconds; | 
| @@ -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 |  			) { | 
| @@ -110,8 +110,12 @@ | ||
| 110 | 110 | // Normalise "empty" values into dashes so comparisons are done properly. | 
| 111 | 111 | // This means there is no diference between an empty string and a null | 
| 112 | 112 | // but "0" is considered to be non-empty. | 
| 113 | - if(empty($from) && !strlen($from)) $from = '-'; | |
| 114 | - if(empty($to) && !strlen($to)) $to = '-'; | |
| 113 | +		if(empty($from) && !strlen($from)) { | |
| 114 | + $from = '-'; | |
| 115 | + } | |
| 116 | +		if(empty($to) && !strlen($to)) { | |
| 117 | + $to = '-'; | |
| 118 | + } | |
| 115 | 119 | |
| 116 | 120 | return $this->changes[$title] = array( | 
| 117 | 121 | 'from' => $from, | 
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * Base class for the APINouns | |
| 4 | - */ | |
| 3 | + * Base class for the APINouns | |
| 4 | + */ | |
| 5 | 5 |  class APINoun extends Controller { | 
| 6 | 6 | |
| 7 | 7 | /** | 
| @@ -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 | } | 
| @@ -936,7 +936,9 @@ discard block | ||
| 936 | 936 | } | 
| 937 | 937 | |
| 938 | 938 | $fields = $backend->getCreateEnvironmentFields($project); | 
| 939 | - if(!$fields) return null; | |
| 939 | +		if(!$fields) { | |
| 940 | + return null; | |
| 941 | + } | |
| 940 | 942 | |
| 941 | 943 |  		if(!$project->canCreateEnvironments()) { | 
| 942 | 944 |  			return new SS_HTTPResponse('Not allowed to create environments for this project', 401); | 
| @@ -2366,8 +2368,12 @@ discard block | ||
| 2366 | 2368 | * @return bool | 
| 2367 | 2369 | */ | 
| 2368 | 2370 |  	public function canCreateProjects($member = null) { | 
| 2369 | - if(!$member) $member = Member::currentUser(); | |
| 2370 | - if(!$member) return false; | |
| 2371 | +		if(!$member) { | |
| 2372 | + $member = Member::currentUser(); | |
| 2373 | + } | |
| 2374 | +		if(!$member) { | |
| 2375 | + return false; | |
| 2376 | + } | |
| 2371 | 2377 | |
| 2372 | 2378 |  		return singleton('DNProject')->canCreate($member); | 
| 2373 | 2379 | } | 
| @@ -961,7 +961,7 @@ | ||
| 961 | 961 | * @param array $data | 
| 962 | 962 | * @param Form $form | 
| 963 | 963 | * | 
| 964 | - * @return bool|HTMLText|SS_HTTPResponse | |
| 964 | + * @return SS_HTTPResponse|null | |
| 965 | 965 | */ | 
| 966 | 966 |  	public function doCreateEnvironment($data, Form $form) { | 
| 967 | 967 | $this->setCurrentActionType(self::ACTION_ENVIRONMENTS); | 
| @@ -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', | 
| @@ -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'); | 
| @@ -36,13 +36,17 @@ discard block | ||
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 |  	protected function getSecurityToken($name = null) { | 
| 39 | -		if(is_null($name)) $name = sprintf('%sSecurityID', get_class($this)); | |
| 39 | +		if(is_null($name)) { | |
| 40 | +			$name = sprintf('%sSecurityID', get_class($this)); | |
| 41 | + } | |
| 40 | 42 | return new \SecurityToken($name); | 
| 41 | 43 | } | 
| 42 | 44 | |
| 43 | 45 |  	protected function checkSecurityToken($name = null) { | 
| 44 | 46 | $postVar = is_null($name) ? 'SecurityID' : $name; | 
| 45 | -		if(is_null($name)) $name = sprintf('%sSecurityID', get_class($this)); | |
| 47 | +		if(is_null($name)) { | |
| 48 | +			$name = sprintf('%sSecurityID', get_class($this)); | |
| 49 | + } | |
| 46 | 50 | $securityToken = $this->getSecurityToken($name); | 
| 47 | 51 | |
| 48 | 52 | // By default the security token is always represented by a "SecurityID" post var, | 
| @@ -132,7 +136,9 @@ discard block | ||
| 132 | 136 | */ | 
| 133 | 137 |  	protected function trimWhitespace($val) { | 
| 134 | 138 |  		if(is_array($val)) { | 
| 135 | - foreach($val as $k => $v) $val[$k] = $this->trimWhitespace($v); | |
| 139 | +			foreach($val as $k => $v) { | |
| 140 | + $val[$k] = $this->trimWhitespace($v); | |
| 141 | + } | |
| 136 | 142 | return $val; | 
| 137 | 143 |  		} else { | 
| 138 | 144 | return trim($val); | 
| @@ -147,7 +153,9 @@ discard block | ||
| 147 | 153 | */ | 
| 148 | 154 |  	protected function stripNonPrintables($val) { | 
| 149 | 155 |  		if(is_array($val)) { | 
| 150 | - foreach($val as $k => $v) $val[$k] = $this->stripNonPrintables($v); | |
| 156 | +			foreach($val as $k => $v) { | |
| 157 | + $val[$k] = $this->stripNonPrintables($v); | |
| 158 | + } | |
| 151 | 159 | return $val; | 
| 152 | 160 |  		} else { | 
| 153 | 161 |  			return preg_replace('/[[:cntrl:]]/', '', $val); | 
| @@ -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() | 
| @@ -385,10 +385,10 @@ discard block | ||
| 385 | 385 | } | 
| 386 | 386 | // Must be logged in to check permissions | 
| 387 | 387 | |
| 388 | -		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | |
| 389 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true; | |
| 388 | +		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { | |
| 389 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true; | |
| 390 | 390 |  		} else { | 
| 391 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true; | |
| 391 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true; | |
| 392 | 392 | } | 
| 393 | 393 | |
| 394 | 394 | return $this->Deployers()->byID($member->ID) | 
| @@ -411,10 +411,10 @@ discard block | ||
| 411 | 411 | } | 
| 412 | 412 | // Must be logged in to check permissions | 
| 413 | 413 | |
| 414 | -		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | |
| 415 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 414 | +		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { | |
| 415 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 416 | 416 |  		} else { | 
| 417 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 417 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 418 | 418 | } | 
| 419 | 419 | |
| 420 | 420 | return $this->CanRestoreMembers()->byID($member->ID) | 
| @@ -442,10 +442,10 @@ discard block | ||
| 442 | 442 | return false; | 
| 443 | 443 | } | 
| 444 | 444 | |
| 445 | -		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | |
| 446 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 445 | +		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { | |
| 446 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 447 | 447 |  		} else { | 
| 448 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 448 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 449 | 449 | } | 
| 450 | 450 | |
| 451 | 451 | return $this->CanBackupMembers()->byID($member->ID) | 
| @@ -477,10 +477,10 @@ discard block | ||
| 477 | 477 | } | 
| 478 | 478 | // Must be logged in to check permissions | 
| 479 | 479 | |
| 480 | -		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | |
| 481 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 480 | +		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { | |
| 481 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 482 | 482 |  		} else { | 
| 483 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 483 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 484 | 484 | } | 
| 485 | 485 | |
| 486 | 486 | return $this->ArchiveUploaders()->byID($member->ID) | 
| @@ -503,10 +503,10 @@ discard block | ||
| 503 | 503 | } | 
| 504 | 504 | // Must be logged in to check permissions | 
| 505 | 505 | |
| 506 | -		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | |
| 507 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 506 | +		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { | |
| 507 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 508 | 508 |  		} else { | 
| 509 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 509 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 510 | 510 | } | 
| 511 | 511 | |
| 512 | 512 | return $this->ArchiveDownloaders()->byID($member->ID) | 
| @@ -572,10 +572,10 @@ discard block | ||
| 572 | 572 | } | 
| 573 | 573 | // Must be logged in to check permissions | 
| 574 | 574 | |
| 575 | -		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | |
| 576 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 575 | +		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { | |
| 576 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 577 | 577 |  		} else { | 
| 578 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 578 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 579 | 579 | } | 
| 580 | 580 | |
| 581 | 581 | return $this->ArchiveDeleters()->byID($member->ID) | 
| @@ -386,9 +386,13 @@ discard block | ||
| 386 | 386 | // Must be logged in to check permissions | 
| 387 | 387 | |
| 388 | 388 |  		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | 
| 389 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true; | |
| 389 | +			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) { | |
| 390 | + return true; | |
| 391 | + } | |
| 390 | 392 |  		} else { | 
| 391 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true; | |
| 393 | +			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) { | |
| 394 | + return true; | |
| 395 | + } | |
| 392 | 396 | } | 
| 393 | 397 | |
| 394 | 398 | return $this->Deployers()->byID($member->ID) | 
| @@ -412,9 +416,13 @@ discard block | ||
| 412 | 416 | // Must be logged in to check permissions | 
| 413 | 417 | |
| 414 | 418 |  		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | 
| 415 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 419 | +			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) { | |
| 420 | + return true; | |
| 421 | + } | |
| 416 | 422 |  		} else { | 
| 417 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 423 | +			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) { | |
| 424 | + return true; | |
| 425 | + } | |
| 418 | 426 | } | 
| 419 | 427 | |
| 420 | 428 | return $this->CanRestoreMembers()->byID($member->ID) | 
| @@ -443,9 +451,13 @@ discard block | ||
| 443 | 451 | } | 
| 444 | 452 | |
| 445 | 453 |  		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | 
| 446 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 454 | +			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) { | |
| 455 | + return true; | |
| 456 | + } | |
| 447 | 457 |  		} else { | 
| 448 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 458 | +			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) { | |
| 459 | + return true; | |
| 460 | + } | |
| 449 | 461 | } | 
| 450 | 462 | |
| 451 | 463 | return $this->CanBackupMembers()->byID($member->ID) | 
| @@ -478,9 +490,13 @@ discard block | ||
| 478 | 490 | // Must be logged in to check permissions | 
| 479 | 491 | |
| 480 | 492 |  		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | 
| 481 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 493 | +			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) { | |
| 494 | + return true; | |
| 495 | + } | |
| 482 | 496 |  		} else { | 
| 483 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 497 | +			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) { | |
| 498 | + return true; | |
| 499 | + } | |
| 484 | 500 | } | 
| 485 | 501 | |
| 486 | 502 | return $this->ArchiveUploaders()->byID($member->ID) | 
| @@ -504,9 +520,13 @@ discard block | ||
| 504 | 520 | // Must be logged in to check permissions | 
| 505 | 521 | |
| 506 | 522 |  		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | 
| 507 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 523 | +			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) { | |
| 524 | + return true; | |
| 525 | + } | |
| 508 | 526 |  		} else { | 
| 509 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 527 | +			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) { | |
| 528 | + return true; | |
| 529 | + } | |
| 510 | 530 | } | 
| 511 | 531 | |
| 512 | 532 | return $this->ArchiveDownloaders()->byID($member->ID) | 
| @@ -573,9 +593,13 @@ discard block | ||
| 573 | 593 | // Must be logged in to check permissions | 
| 574 | 594 | |
| 575 | 595 |  		if ($this->Usage==='Production' || $this->Usage==='Unspecified') { | 
| 576 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; | |
| 596 | +			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) { | |
| 597 | + return true; | |
| 598 | + } | |
| 577 | 599 |  		} else { | 
| 578 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; | |
| 600 | +			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) { | |
| 601 | + return true; | |
| 602 | + } | |
| 579 | 603 | } | 
| 580 | 604 | |
| 581 | 605 | return $this->ArchiveDeleters()->byID($member->ID) | 
| @@ -954,7 +954,7 @@ | ||
| 954 | 954 | to other environments, alongside the "Who can restore" permission.<br> | 
| 955 | 955 | Should include all users with upload permissions, otherwise they can't download | 
| 956 | 956 | their own uploads. | 
| 957 | -PHP | |
| 957 | +php | |
| 958 | 958 | ), | 
| 959 | 959 | |
| 960 | 960 | // The Main.PipelineApprovers | 
| @@ -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 | /** | 
| @@ -929,7 +929,9 @@ discard block | ||
| 929 | 929 | * @return SS_List | 
| 930 | 930 | */ | 
| 931 | 931 |  	public function whoIsAllowedAny($codes) { | 
| 932 | - if(!is_array($codes)) $codes = array($codes); | |
| 932 | +		if(!is_array($codes)) { | |
| 933 | + $codes = array($codes); | |
| 934 | + } | |
| 933 | 935 | |
| 934 | 936 | $SQLa_codes = Convert::raw2sql($codes); | 
| 935 | 937 |  		$SQL_codes = join("','", $SQLa_codes); | 
| @@ -991,7 +993,9 @@ discard block | ||
| 991 | 993 | $member = Member::currentUser(); | 
| 992 | 994 | } | 
| 993 | 995 | |
| 994 | - if(Permission::checkMember($member, 'ADMIN')) return true; | |
| 996 | +		if(Permission::checkMember($member, 'ADMIN')) { | |
| 997 | + return true; | |
| 998 | + } | |
| 995 | 999 | |
| 996 | 1000 |  		$hits = $this->whoIsAllowedAny($codes)->filter('Member.ID', $member->ID)->count(); | 
| 997 | 1001 | return ($hits>0 ? true : false); | 
| @@ -1018,7 +1022,9 @@ discard block | ||
| 1018 | 1022 | }); | 
| 1019 | 1023 | |
| 1020 | 1024 | // If anything returns false then we're not ready. | 
| 1021 | - if($isDone) return min($isDone); | |
| 1025 | +			if($isDone) { | |
| 1026 | + return min($isDone); | |
| 1027 | + } | |
| 1022 | 1028 | } | 
| 1023 | 1029 | |
| 1024 | 1030 | return true; | 
| @@ -1099,8 +1105,12 @@ discard block | ||
| 1099 | 1105 | * @return bool | 
| 1100 | 1106 | */ | 
| 1101 | 1107 |  	public function canCreate($member = null) { | 
| 1102 | - if(!$member) $member = Member::currentUser(); | |
| 1103 | - if(!$member) return false; | |
| 1108 | +		if(!$member) { | |
| 1109 | + $member = Member::currentUser(); | |
| 1110 | + } | |
| 1111 | +		if(!$member) { | |
| 1112 | + return false; | |
| 1113 | + } | |
| 1104 | 1114 | |
| 1105 | 1115 |  		if(Permission::checkMember($member, 'ADMIN')) { | 
| 1106 | 1116 | return true; |