Code Duplication    Length = 12-12 lines in 2 locations

code/control/ApprovalsDispatcher.php 1 location

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

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