@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $this->project = $this->getCurrentProject(); |
| 43 | 43 | |
| 44 | - if (!$this->project) { |
|
| 44 | + if(!$this->project) { |
|
| 45 | 45 | return $this->project404Response(); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // Performs canView permission check by limiting visible projects |
| 49 | 49 | $this->environment = $this->getCurrentEnvironment($this->project); |
| 50 | - if (!$this->environment) { |
|
| 50 | + if(!$this->environment) { |
|
| 51 | 51 | return $this->environment404Response(); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -68,19 +68,19 @@ discard block |
||
| 68 | 68 | $data = []; |
| 69 | 69 | $list = $this->DeployHistory(); |
| 70 | 70 | $page = $request->getVar('page') ?: 1; |
| 71 | - if ($page > $list->TotalPages()) { |
|
| 71 | + if($page > $list->TotalPages()) { |
|
| 72 | 72 | $page = 1; |
| 73 | 73 | } |
| 74 | - if ($page < 1) { |
|
| 74 | + if($page < 1) { |
|
| 75 | 75 | $page = 1; |
| 76 | 76 | } |
| 77 | 77 | $start = ($page - 1) * $list->getPageLength(); |
| 78 | - $list->setPageStart((int) $start); |
|
| 79 | - if (empty($list)) { |
|
| 78 | + $list->setPageStart((int)$start); |
|
| 79 | + if(empty($list)) { |
|
| 80 | 80 | return $this->getAPIResponse(['list' => []], 200); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - foreach ($list as $deployment) { |
|
| 83 | + foreach($list as $deployment) { |
|
| 84 | 84 | $data[] = $this->getDeploymentData($deployment); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function currentbuild(SS_HTTPRequest $request) { |
| 100 | 100 | $currentBuild = $this->environment->CurrentBuild(); |
| 101 | - if (!$currentBuild) { |
|
| 101 | + if(!$currentBuild) { |
|
| 102 | 102 | return $this->getAPIResponse(['deployment' => []], 200); |
| 103 | 103 | } |
| 104 | 104 | return $this->getAPIResponse(['deployment' => $this->getDeploymentData($currentBuild)], 200); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | public function start(SS_HTTPRequest $request) { |
| 142 | 142 | $this->checkSecurityToken(); |
| 143 | 143 | |
| 144 | - if (!$this->environment->canDeploy(Member::currentUser())) { |
|
| 144 | + if(!$this->environment->canDeploy(Member::currentUser())) { |
|
| 145 | 145 | return $this->getAPIResponse(['message' => 'You are not authorised to deploy this environment'], 403); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -197,12 +197,12 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | $deployer = $deployment->Deployer(); |
| 199 | 199 | $deployerData = null; |
| 200 | - if ($deployer && $deployer->exists()) { |
|
| 200 | + if($deployer && $deployer->exists()) { |
|
| 201 | 201 | $deployerData = $this->getStackMemberData($deployer); |
| 202 | 202 | } |
| 203 | 203 | $approver = $deployment->Approver(); |
| 204 | 204 | $approverData = null; |
| 205 | - if ($approver && $approver->exists()) { |
|
| 205 | + if($approver && $approver->exists()) { |
|
| 206 | 206 | $approverData = $this->getStackMemberData($approver); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | $stackMembers = $this->project->listMembers(); |
| 237 | 237 | $role = null; |
| 238 | 238 | |
| 239 | - foreach ($stackMembers as $stackMember) { |
|
| 240 | - if ($stackMember['MemberID'] !== $member->ID) { |
|
| 239 | + foreach($stackMembers as $stackMember) { |
|
| 240 | + if($stackMember['MemberID'] !== $member->ID) { |
|
| 241 | 241 | continue; |
| 242 | 242 | } |
| 243 | 243 | |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | * @return null|SS_HTTPResponse |
| 262 | 262 | */ |
| 263 | 263 | protected function validateDeployement(\DNDeployment $deployment) { |
| 264 | - if (!$deployment || !$deployment->exists()) { |
|
| 264 | + if(!$deployment || !$deployment->exists()) { |
|
| 265 | 265 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
| 266 | 266 | } |
| 267 | - if (!$deployment->canView()) { |
|
| 267 | + if(!$deployment->canView()) { |
|
| 268 | 268 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
| 269 | 269 | } |
| 270 | 270 | return null; |