Code Duplication    Length = 12-12 lines in 2 locations

code/control/DeployDispatcher.php 1 location

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

code/control/ApprovalsDispatcher.php 1 location

@@ 274-285 (lines=12) @@
271
	 *
272
	 * @return null|SS_HTTPResponse
273
	 */
274
	protected function validateDeployment($deployment) {
275
		if (!$deployment || !$deployment->exists()) {
276
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
277
		}
278
		if ($deployment->EnvironmentID != $this->environment->ID) {
279
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
280
		}
281
		if (!$deployment->canView()) {
282
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
283
		}
284
		return null;
285
	}
286
287
	/**
288
	 * @param string $name