Code Duplication    Length = 19-20 lines in 2 locations

code/control/DNDeploymentDispatcher.php 2 locations

@@ 27-45 (lines=19) @@
24
		];
25
	}
26
27
	public function apply(SS_HTTPRequest $request) {
28
		$this->checkSecurityToken();
29
30
		$project = $this->getCurrentProject();
31
		if(!$project) {
32
			return $this->project404Response();
33
		}
34
35
		$env = $this->getCurrentEnvironment($project);
36
		if(!$env) {
37
			return $this->environment404Response();
38
		}
39
40
		$machine = $this->getMachine();
41
		$machine->apply($request->param('State'));
42
43
		$model = $this->getModel('DNDeployment');
44
		return $this->asJSON($model);
45
	}
46
47
	public function can(SS_HTTPRequest $request) {
48
		$this->checkSecurityToken();
@@ 47-66 (lines=20) @@
44
		return $this->asJSON($model);
45
	}
46
47
	public function can(SS_HTTPRequest $request) {
48
		$this->checkSecurityToken();
49
50
		$project = $this->getCurrentProject();
51
		if(!$project) {
52
			return $this->project404Response();
53
		}
54
55
		$env = $this->getCurrentEnvironment($project);
56
		if(!$env) {
57
			return $this->environment404Response();
58
		}
59
60
		$machine = $this->getMachine();
61
		$machine->can($request->param('State'));
62
63
		$this->asJSON([
64
			'Can' => $machine->can($request->param('State'))
65
		]);
66
	}
67
68
	private function getMachine() {
69
		$params = $this->request->param('Id');