Code Duplication    Length = 12-12 lines in 2 locations

code/control/DeployDispatcher.php 1 location

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

code/control/ApprovalsDispatcher.php 1 location

@@ 238-249 (lines=12) @@
235
	 *
236
	 * @return null|SS_HTTPResponse
237
	 */
238
	protected function validateDeployment(\DNDeployment $deployment) {
239
		if (!$deployment || !$deployment->exists()) {
240
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
241
		}
242
		if ($deployment->EnvironmentID != $this->environment->ID) {
243
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
244
		}
245
		if (!$deployment->canView()) {
246
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
247
		}
248
		return null;
249
	}
250
251
	/**
252
	 * @return ArrayList