Code Duplication    Length = 12-12 lines in 2 locations

code/control/DeployDispatcher.php 1 location

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

code/control/ApprovalsDispatcher.php 1 location

@@ 256-267 (lines=12) @@
253
	 *
254
	 * @return null|SS_HTTPResponse
255
	 */
256
	protected function validateDeployment(\DNDeployment $deployment) {
257
		if (!$deployment || !$deployment->exists()) {
258
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
259
		}
260
		if ($deployment->EnvironmentID != $this->environment->ID) {
261
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
262
		}
263
		if (!$deployment->canView()) {
264
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
265
		}
266
		return null;
267
	}
268
269
	/**
270
	 * @param string $name