Code Duplication    Length = 15-15 lines in 2 locations

code/backends/DeploymentStrategy.php 2 locations

@@ 320-334 (lines=15) @@
317
	/**
318
	 * @return DNDeployment
319
	 */
320
	public function createDeployment() {
321
		$deployment = \DNDeployment::create();
322
		$deployment->EnvironmentID = $this->environment->ID;
323
		$deployment->SHA = $this->getOption('sha');
324
		$deployment->RefType = $this->getOption('ref_type');
325
		$deployment->RefName = $this->getOption('ref_name');
326
		$deployment->Summary = $this->getOption('summary');
327
		$deployment->Title = $this->getOption('title');
328
		$deployment->Strategy = $this->toJSON();
329
		$deployment->DeployerID = \Member::currentUserID();
330
		$deployment->write();
331
332
		// re-get and return the deployment so we have the correct state
333
		return \DNDeployment::get()->byId($deployment->ID);
334
	}
335
336
	/**
337
	 * @param int $deploymentID
@@ 340-354 (lines=15) @@
337
	 * @param int $deploymentID
338
	 * @return \DNDeployment
339
	 */
340
	public function updateDeployment($deploymentID) {
341
		$deployment = \DNDeployment::get()->byId($deploymentID);
342
		$deployment->EnvironmentID = $this->environment->ID;
343
		$deployment->SHA = $this->getOption('sha');
344
		$deployment->RefType = $this->getOption('ref_type');
345
		$deployment->RefName = $this->getOption('ref_name');
346
		$deployment->Summary = $this->getOption('summary');
347
		$deployment->Title = $this->getOption('title');
348
		$deployment->Strategy = $this->toJSON();
349
		$deployment->DeployerID = \Member::currentUserID();
350
		$deployment->write();
351
352
		// re-get and return the deployment so we have the correct state
353
		return \DNDeployment::get()->byId($deployment->ID);
354
	}
355
356
}
357