Code Duplication    Length = 12-12 lines in 2 locations

code/control/ApprovalsDispatcher.php 1 location

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

code/control/DeployDispatcher.php 1 location

@@ 268-279 (lines=12) @@
265
	 *
266
	 * @return null|SS_HTTPResponse
267
	 */
268
	protected function validateDeployment(\DNDeployment $deployment) {
269
		if (!$deployment || !$deployment->exists()) {
270
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
271
		}
272
		if ($deployment->EnvironmentID != $this->environment->ID) {
273
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
274
		}
275
		if (!$deployment->canView()) {
276
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
277
		}
278
		return null;
279
	}
280
281
}
282