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

@@ 227-238 (lines=12) @@
224
	 *
225
	 * @return null|SS_HTTPResponse
226
	 */
227
	protected function validateDeployment(\DNDeployment $deployment) {
228
		if (!$deployment || !$deployment->exists()) {
229
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
230
		}
231
		if ($deployment->EnvironmentID != $this->environment->ID) {
232
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
233
		}
234
		if (!$deployment->canView()) {
235
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
236
		}
237
		return null;
238
	}
239
240
	/**
241
	 * @return ArrayList