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

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