Code Duplication    Length = 12-12 lines in 2 locations

code/control/DeployDispatcher.php 1 location

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

code/control/ApprovalsDispatcher.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
	 * @param string $name