Completed
Pull Request — master (#634)
by Sean
11:03 queued 07:07
created
code/control/DeployDispatcher.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
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
-		if (!$deployment->canView()) {
131
+		if(!$deployment->canView()) {
132 132
 			return $this->getAPIResponse(['message' => 'You are not authorised to view this environment'], 403);
133 133
 		}
134 134
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
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 authorised to deploy this environment'], 403);
151 151
 		}
152 152
 
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 
203 203
 		$deployer = $deployment->Deployer();
204 204
 		$deployerData = null;
205
-		if ($deployer && $deployer->exists()) {
205
+		if($deployer && $deployer->exists()) {
206 206
 			$deployerData = $this->getStackMemberData($deployer);
207 207
 		}
208 208
 		$approver = $deployment->Approver();
209 209
 		$approverData = null;
210
-		if ($approver && $approver->exists()) {
210
+		if($approver && $approver->exists()) {
211 211
 			$approverData = $this->getStackMemberData($approver);
212 212
 		}
213 213
 
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 		$stackMembers = $this->project->listMembers();
242 242
 		$role = null;
243 243
 
244
-		foreach ($stackMembers as $stackMember) {
245
-			if ($stackMember['MemberID'] !== $member->ID) {
244
+		foreach($stackMembers as $stackMember) {
245
+			if($stackMember['MemberID'] !== $member->ID) {
246 246
 				continue;
247 247
 			}
248 248
 
Please login to merge, or discard this patch.