Code Duplication    Length = 12-12 lines in 2 locations

code/control/ApprovalsDispatcher.php 1 location

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

code/control/DeployDispatcher.php 1 location

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