Code Duplication    Length = 12-12 lines in 2 locations

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

code/control/ApprovalsDispatcher.php 1 location

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