Code Duplication    Length = 12-12 lines in 2 locations

code/control/ApprovalsDispatcher.php 1 location

@@ 291-302 (lines=12) @@
288
	 *
289
	 * @return null|SS_HTTPResponse
290
	 */
291
	protected function validateDeployment($deployment) {
292
		if (!$deployment || !$deployment->exists()) {
293
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
294
		}
295
		if ($deployment->EnvironmentID != $this->environment->ID) {
296
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
297
		}
298
		if (!$deployment->canView()) {
299
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
300
		}
301
		return null;
302
	}
303
304
	/**
305
	 * @param string $name

code/control/DeployDispatcher.php 1 location

@@ 484-495 (lines=12) @@
481
	 *
482
	 * @return null|SS_HTTPResponse
483
	 */
484
	protected function validateDeployment($deployment) {
485
		if (!$deployment || !$deployment->exists()) {
486
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
487
		}
488
		if ($deployment->EnvironmentID != $this->environment->ID) {
489
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
490
		}
491
		if (!$deployment->canView()) {
492
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
493
		}
494
		return null;
495
	}
496
497
}
498