Code Duplication    Length = 12-12 lines in 2 locations

code/control/ApprovalsDispatcher.php 1 location

@@ 204-215 (lines=12) @@
201
	 *
202
	 * @return null|SS_HTTPResponse
203
	 */
204
	protected function validateDeployment(\DNDeployment $deployment) {
205
		if (!$deployment || !$deployment->exists()) {
206
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
207
		}
208
		if (!$deployment->canView()) {
209
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
210
		}
211
		if ($deployment->EnvironmentID != $this->environment->ID) {
212
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
213
		}
214
		return null;
215
	}
216
217
	protected function canApprove(Member $member = null) {
218
		if (!$member) {

code/control/DeployDispatcher.php 1 location

@@ 355-366 (lines=12) @@
352
	 *
353
	 * @return null|SS_HTTPResponse
354
	 */
355
	protected function validateDeployment(\DNDeployment $deployment) {
356
		if (!$deployment || !$deployment->exists()) {
357
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
358
		}
359
		if (!$deployment->canView()) {
360
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
361
		}
362
		if ($deployment->EnvironmentID != $this->environment->ID) {
363
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
364
		}
365
		return null;
366
	}
367
368
}
369