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

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