Code Duplication    Length = 12-12 lines in 2 locations

code/control/ApprovalsDispatcher.php 1 location

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

code/control/DeployDispatcher.php 1 location

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