Code Duplication    Length = 12-12 lines in 3 locations

code/backends/CapistranoDeploymentBackend.php 3 locations

@@ 138-149 (lines=12) @@
135
	/**
136
	 * Enable a maintenance page for the given environment using the maintenance:enable Capistrano task.
137
	 */
138
	public function enableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) {
139
		$name = $environment->getFullName();
140
		$command = $this->getCommand('maintenance:enable', 'web', $environment, null, $log);
141
		$command->run(function($type, $buffer) use($log) {
142
			$log->write($buffer);
143
		});
144
		if(!$command->isSuccessful()) {
145
			$this->extend('maintenanceEnableFailure', $environment, $log);
146
			throw new RuntimeException($command->getErrorOutput());
147
		}
148
		$log->write(sprintf('Maintenance page enabled on "%s"', $name));
149
	}
150
151
	/**
152
	 * Disable the maintenance page for the given environment using the maintenance:disable Capistrano task.
@@ 154-165 (lines=12) @@
151
	/**
152
	 * Disable the maintenance page for the given environment using the maintenance:disable Capistrano task.
153
	 */
154
	public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) {
155
		$name = $environment->getFullName();
156
		$command = $this->getCommand('maintenance:disable', 'web', $environment, null, $log);
157
		$command->run(function($type, $buffer) use($log) {
158
			$log->write($buffer);
159
		});
160
		if(!$command->isSuccessful()) {
161
			$this->extend('maintenanceDisableFailure', $environment, $log);
162
			throw new RuntimeException($command->getErrorOutput());
163
		}
164
		$log->write(sprintf('Maintenance page disabled on "%s"', $name));
165
	}
166
167
	/**
168
	 * Check the status using the deploy:check capistrano method
@@ 365-376 (lines=12) @@
362
	 * Also cleans up and generates new error pages.
363
	 * @param DeploynautLogFile $log
364
	 */
365
	public function rebuild(DNEnvironment $environment, $log) {
366
		$name = $environment->getFullName();
367
		$command = $this->getCommand('deploy:migrate', 'web', $environment, null, $log);
368
		$command->run(function($type, $buffer) use($log) {
369
			$log->write($buffer);
370
		});
371
		if(!$command->isSuccessful()) {
372
			$log->write(sprintf('Rebuild of "%s" failed: %s', $name, $command->getErrorOutput()));
373
			throw new RuntimeException($command->getErrorOutput());
374
		}
375
		$log->write(sprintf('Rebuild of "%s" done', $name));
376
	}
377
378
	/**
379
	 * Extracts a *.sspak file referenced through the passed in $dataTransfer