@@ -46,7 +46,7 @@ |
||
| 46 | 46 | * |
| 47 | 47 | * @param \SS_HTTPRequest $request |
| 48 | 48 | * |
| 49 | - * @return \HTMLText|\SS_HTTPResponse |
|
| 49 | + * @return SS_HTTPResponse|null |
|
| 50 | 50 | */ |
| 51 | 51 | public function index(\SS_HTTPRequest $request) { |
| 52 | 52 | return $this->redirect(\Controller::join_links($this->Link(), 'history'), 302); |
@@ -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 deployment(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 authorized to deploy this environment'], 403); |
| 118 | 118 | } |
| 119 | 119 | return $this->getAPIResponse(['deployment' => $this->getDeploymentData($deployment)], 200); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function log(SS_HTTPRequest $request) { |
| 127 | 127 | $deployment = DNDeployment::get()->byId($request->params('ID')); |
| 128 | - if (!$deployment || !$deployment->exists) { |
|
| 128 | + if(!$deployment || !$deployment->exists) { |
|
| 129 | 129 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
| 130 | 130 | } |
| 131 | 131 | if(!$deployment->canView()) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function start(SS_HTTPRequest $request) { |
| 147 | 147 | $this->checkSecurityToken(); |
| 148 | 148 | |
| 149 | - if (!$this->environment->canDeploy(Member::currentUser())) { |
|
| 149 | + if(!$this->environment->canDeploy(Member::currentUser())) { |
|
| 150 | 150 | return $this->getAPIResponse(['message' => 'You are not authorized to deploy this environment'], 403); |
| 151 | 151 | } |
| 152 | 152 | |