Code Duplication    Length = 12-12 lines in 2 locations

code/control/DeployDispatcher.php 1 location

@@ 317-328 (lines=12) @@
314
	 *
315
	 * @return null|SS_HTTPResponse
316
	 */
317
	protected function validateDeployment($deployment) {
318
		if (!$deployment || !$deployment->exists()) {
319
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
320
		}
321
		if ($deployment->EnvironmentID != $this->environment->ID) {
322
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
323
		}
324
		if (!$deployment->canView()) {
325
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
326
		}
327
		return null;
328
	}
329
330
}
331

code/control/ApprovalsDispatcher.php 1 location

@@ 308-319 (lines=12) @@
305
	 *
306
	 * @return null|SS_HTTPResponse
307
	 */
308
	protected function validateDeployment($deployment) {
309
		if (!$deployment || !$deployment->exists()) {
310
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
311
		}
312
		if ($deployment->EnvironmentID != $this->environment->ID) {
313
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
314
		}
315
		if (!$deployment->canView()) {
316
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
317
		}
318
		return null;
319
	}
320
321
	/**
322
	 * @param string $name