@@ -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); |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function show(SS_HTTPRequest $request) { |
| 112 | 112 | $deployment = DNDeployment::get()->byId($request->param('ID')); |
| 113 | - if (!$deployment || !$deployment->exists()) { |
|
| 113 | + if(!$deployment || !$deployment->exists()) { |
|
| 114 | 114 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
| 115 | 115 | } |
| 116 | - if (!$deployment->canView()) { |
|
| 116 | + if(!$deployment->canView()) { |
|
| 117 | 117 | return $this->getAPIResponse(['message' => 'You are not authorised to deploy this environment'], 403); |
| 118 | 118 | } |
| 119 | 119 | return $this->getAPIResponse(['deployment' => $this->getDeploymentData($deployment)], 200); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | public function log(SS_HTTPRequest $request) { |
| 127 | 127 | $deployID = $request->param('ID'); |
| 128 | 128 | $deployment = DNDeployment::get()->byId($deployID); |
| 129 | - if (!$deployment || !$deployment->exists()) { |
|
| 129 | + if(!$deployment || !$deployment->exists()) { |
|
| 130 | 130 | return $this->getAPIResponse( |
| 131 | 131 | [ |
| 132 | 132 | 'message' => sprintf('This deployment (%s) does not exist', $deployID) |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | 404 |
| 135 | 135 | ); |
| 136 | 136 | } |
| 137 | - if (!$deployment->canView()) { |
|
| 137 | + if(!$deployment->canView()) { |
|
| 138 | 138 | return $this->getAPIResponse(['message' => 'You are not authorised to view this environment'], 403); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | public function start(SS_HTTPRequest $request) { |
| 153 | 153 | $this->checkSecurityToken(); |
| 154 | 154 | |
| 155 | - if (!$this->environment->canDeploy(Member::currentUser())) { |
|
| 155 | + if(!$this->environment->canDeploy(Member::currentUser())) { |
|
| 156 | 156 | return $this->getAPIResponse(['message' => 'You are not authorised to deploy this environment'], 403); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -208,12 +208,12 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | $deployer = $deployment->Deployer(); |
| 210 | 210 | $deployerData = null; |
| 211 | - if ($deployer && $deployer->exists()) { |
|
| 211 | + if($deployer && $deployer->exists()) { |
|
| 212 | 212 | $deployerData = $this->getStackMemberData($deployer); |
| 213 | 213 | } |
| 214 | 214 | $approver = $deployment->Approver(); |
| 215 | 215 | $approverData = null; |
| 216 | - if ($approver && $approver->exists()) { |
|
| 216 | + if($approver && $approver->exists()) { |
|
| 217 | 217 | $approverData = $this->getStackMemberData($approver); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | $stackMembers = $this->project->listMembers(); |
| 248 | 248 | $role = null; |
| 249 | 249 | |
| 250 | - foreach ($stackMembers as $stackMember) { |
|
| 251 | - if ($stackMember['MemberID'] !== $member->ID) { |
|
| 250 | + foreach($stackMembers as $stackMember) { |
|
| 251 | + if($stackMember['MemberID'] !== $member->ID) { |
|
| 252 | 252 | continue; |
| 253 | 253 | } |
| 254 | 254 | |