Code Duplication    Length = 24-25 lines in 2 locations

code/model/steps/DeploymentPipelineStep.php 1 location

@@ 35-58 (lines=24) @@
32
		return parent::getTitle() . ":{$this->Doing}";
33
	}
34
35
	public function start() {
36
		parent::start();
37
38
		switch($this->Status) {
39
			case 'Started':
40
				// If we are doing a subtask, check which one to continue
41
				switch($this->Doing) {
42
					case 'Deployment':
43
						return $this->continueDeploy();
44
					case 'Snapshot':
45
						return $this->continueSnapshot();
46
					default:
47
						$this->log("Unable to process {$this->Title} with subtask of {$this->Doing}");
48
						$this->markFailed();
49
						return false;
50
				}
51
			case 'Queued':
52
				return $this->createSnapshot();
53
			default:
54
				$this->log("Unable to process {$this->Title} with status of {$this->Status}");
55
				$this->markFailed();
56
				return false;
57
		}
58
	}
59
60
	/**
61
	 * Begin a new deployment

code/model/steps/RollbackStep.php 1 location

@@ 53-77 (lines=25) @@
50
	/**
51
	 * @return bool|null
52
	 */
53
	public function start() {
54
		parent::start();
55
56
		switch($this->Status) {
57
			case 'Started':
58
				// If we are doing a subtask, check which one to continue
59
				switch($this->Doing) {
60
					case 'Deployment':
61
						return $this->continueRevertDeploy();
62
					case 'Snapshot':
63
						return $this->continueRevertDatabase();
64
					default:
65
						$this->log("Unable to process {$this->Title} with subtask of {$this->Doing}");
66
						$this->markFailed();
67
						return false;
68
				}
69
			case 'Queued':
70
				// Begin rollback by initiating deployment
71
				return $this->startRevertDeploy();
72
			default:
73
				$this->log("Unable to process {$this->Title} with status of {$this->Status}");
74
				$this->markFailed();
75
				return false;
76
		}
77
	}
78
79
	/**
80
	 * Begin a new deployment