| @@ -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; | 
| @@ -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, | 
| @@ -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) | 
| @@ -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; | 
| @@ -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); | 
| @@ -934,7 +934,9 @@ discard block | ||
| 934 | 934 | } | 
| 935 | 935 | |
| 936 | 936 | $fields = $backend->getCreateEnvironmentFields($project); | 
| 937 | - if(!$fields) return null; | |
| 937 | +		if(!$fields) { | |
| 938 | + return null; | |
| 939 | + } | |
| 938 | 940 | |
| 939 | 941 |  		if(!$project->canCreateEnvironments()) { | 
| 940 | 942 |  			return new SS_HTTPResponse('Not allowed to create environments for this project', 401); | 
| @@ -1337,7 +1339,9 @@ discard block | ||
| 1337 | 1339 | } | 
| 1338 | 1340 | |
| 1339 | 1341 |  	protected function applyRedeploy(SS_HTTPRequest $request, &$data) { | 
| 1340 | -		if (!$request->getVar('redeploy')) return; | |
| 1342 | +		if (!$request->getVar('redeploy')) { | |
| 1343 | + return; | |
| 1344 | + } | |
| 1341 | 1345 | |
| 1342 | 1346 | $project = $this->getCurrentProject(); | 
| 1343 | 1347 |  		if(!$project) { | 
| @@ -2397,8 +2401,12 @@ discard block | ||
| 2397 | 2401 | * @return bool | 
| 2398 | 2402 | */ | 
| 2399 | 2403 |  	public function canCreateProjects($member = null) { | 
| 2400 | - if(!$member) $member = Member::currentUser(); | |
| 2401 | - if(!$member) return false; | |
| 2404 | +		if(!$member) { | |
| 2405 | + $member = Member::currentUser(); | |
| 2406 | + } | |
| 2407 | +		if(!$member) { | |
| 2408 | + return false; | |
| 2409 | + } | |
| 2402 | 2410 | |
| 2403 | 2411 |  		return singleton('DNProject')->canCreate($member); | 
| 2404 | 2412 | } | 
| @@ -205,12 +205,16 @@ | ||
| 205 | 205 | */ | 
| 206 | 206 |  	public function getFullDeployMessages() { | 
| 207 | 207 | $strategy = $this->getDeploymentStrategy(); | 
| 208 | - if ($strategy->getActionCode()!=='full') return null; | |
| 208 | +		if ($strategy->getActionCode()!=='full') { | |
| 209 | + return null; | |
| 210 | + } | |
| 209 | 211 | |
| 210 | 212 | $changes = $strategy->getChangesModificationNeeded(); | 
| 211 | 213 | $messages = []; | 
| 212 | 214 |  		foreach ($changes as $change => $details) { | 
| 213 | - if ($change==='Code version') continue; | |
| 215 | +			if ($change==='Code version') { | |
| 216 | + continue; | |
| 217 | + } | |
| 214 | 218 | |
| 215 | 219 | $messages[] = [ | 
| 216 | 220 | 'Flag' => sprintf( | 
| @@ -58,7 +58,9 @@ | ||
| 58 | 58 | |
| 59 | 59 |  	protected function addHandlers($machine) { | 
| 60 | 60 | $class = get_class($machine->getObject()); | 
| 61 | - if (empty($this->config()->handlers[$class])) return; | |
| 61 | +		if (empty($this->config()->handlers[$class])) { | |
| 62 | + return; | |
| 63 | + } | |
| 62 | 64 | |
| 63 | 65 | $transitions = $this->config()->handlers[$class]; | 
| 64 | 66 |  		foreach ($transitions as $transName => $handlers) { | 
| @@ -145,7 +145,9 @@ discard block | ||
| 145 | 145 | */ | 
| 146 | 146 |  	protected function trimWhitespace($val) { | 
| 147 | 147 |  		if(is_array($val)) { | 
| 148 | - foreach($val as $k => $v) $val[$k] = $this->trimWhitespace($v); | |
| 148 | +			foreach($val as $k => $v) { | |
| 149 | + $val[$k] = $this->trimWhitespace($v); | |
| 150 | + } | |
| 149 | 151 | return $val; | 
| 150 | 152 |  		} else { | 
| 151 | 153 | return trim($val); | 
| @@ -160,7 +162,9 @@ discard block | ||
| 160 | 162 | */ | 
| 161 | 163 |  	protected function stripNonPrintables($val) { | 
| 162 | 164 |  		if(is_array($val)) { | 
| 163 | - foreach($val as $k => $v) $val[$k] = $this->stripNonPrintables($v); | |
| 165 | +			foreach($val as $k => $v) { | |
| 166 | + $val[$k] = $this->stripNonPrintables($v); | |
| 167 | + } | |
| 164 | 168 | return $val; | 
| 165 | 169 |  		} else { | 
| 166 | 170 |  			return preg_replace('/[[:cntrl:]]/', '', $val); | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | * | 
| 48 | 48 | * @param \SS_HTTPRequest $request | 
| 49 | 49 | * | 
| 50 | - * @return \HTMLText|\SS_HTTPResponse | |
| 50 | + * @return SS_HTTPResponse|null | |
| 51 | 51 | */ | 
| 52 | 52 |  	public function index(\SS_HTTPRequest $request) { | 
| 53 | 53 | return $this->redirect(\Controller::join_links($this->Link(), 'show'), 302); | 
| @@ -72,7 +72,7 @@ discard block | ||
| 72 | 72 | /** | 
| 73 | 73 | * @param SS_HTTPRequest $request | 
| 74 | 74 | * | 
| 75 | - * @return string | |
| 75 | + * @return SS_HTTPResponse | |
| 76 | 76 | */ | 
| 77 | 77 |  	public function show(\SS_HTTPRequest $request) { | 
| 78 | 78 | |
| @@ -166,7 +166,7 @@ discard block | ||
| 166 | 166 | } | 
| 167 | 167 | |
| 168 | 168 | /** | 
| 169 | - * @param $project | |
| 169 | + * @param DNProject $project | |
| 170 | 170 | * | 
| 171 | 171 | * @return array | 
| 172 | 172 | */ | 
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | } | 
| 183 | 183 | |
| 184 | 184 | /** | 
| 185 | - * @param $project | |
| 185 | + * @param DNProject $project | |
| 186 | 186 | * | 
| 187 | 187 | * @return array | 
| 188 | 188 | */ | 
| @@ -198,7 +198,7 @@ discard block | ||
| 198 | 198 | } | 
| 199 | 199 | |
| 200 | 200 | /** | 
| 201 | - * @param $project | |
| 201 | + * @param DNProject $project | |
| 202 | 202 | * | 
| 203 | 203 | * @return array | 
| 204 | 204 | */ |