Code Duplication    Length = 17-19 lines in 2 locations

code/control/DNDeploymentDispatcher.php 1 location

@@ 48-64 (lines=17) @@
45
		return $this->asJSON($model);
46
	}
47
48
	public function canApply(SS_HTTPRequest $request) {
49
		$this->checkSecurityToken();
50
51
		$project = $this->getCurrentProject();
52
		if(!$project) {
53
			return $this->project404Response();
54
		}
55
56
		$env = $this->getCurrentEnvironment($project);
57
		if(!$env) {
58
			return $this->environment404Response();
59
		}
60
61
		return $this->asJSON([
62
			'Can' => $this->getMachine()->can($request->param('State'))
63
		]);
64
	}
65
66
	private function getMachine() {
67
		$id = $this->request->param('Id');

code/control/DNRoot.php 1 location

@@ 722-740 (lines=19) @@
719
	 * @param SS_HTTPRequest $request
720
	 * @return \SS_HTTPResponse
721
	 */
722
	public function environment(SS_HTTPRequest $request) {
723
		// Performs canView permission check by limiting visible projects
724
		$project = $this->getCurrentProject();
725
		if(!$project) {
726
			return $this->project404Response();
727
		}
728
729
		// Performs canView permission check by limiting visible projects
730
		$env = $this->getCurrentEnvironment($project);
731
		if(!$env) {
732
			return $this->environment404Response();
733
		}
734
735
		return $this->render(array(
736
			'DNEnvironmentList' => $this->getCurrentProject()->DNEnvironmentList(),
737
			'FlagSnapshotsEnabled' => $this->FlagSnapshotsEnabled(),
738
			'Redeploy' => (bool)$request->getVar('redeploy')
739
		));
740
	}
741
742
	/**
743
	 * Shows the creation log.