Code Duplication    Length = 17-17 lines in 2 locations

code/backends/DeploymentStrategy.php 2 locations

@@ 320-336 (lines=17) @@
317
	/**
318
	 * @return DNDeployment
319
	 */
320
	public function createDeployment() {
321
		$deployment = \DNDeployment::create();
322
		$deployment->EnvironmentID = $this->environment->ID;
323
		// Pull out the SHA from the options so we can make it queryable.
324
		$deployment->SHA = $this->getOption('sha');
325
		$deployment->Branch = $this->getOption('branch');
326
		// is a branch, tag, uat->prod, prev deploy or sha
327
		$deployment->RefType = $this->getOption('ref_type');
328
		$deployment->Summary = $this->getOption('summary');
329
		$deployment->Title = $this->getOption('title');
330
		$deployment->Strategy = $this->toJSON();
331
		$deployment->DeployerID = \Member::currentUserID();
332
		$deployment->write();
333
334
		// re-get and return the deployment so we have the correct state
335
		return \DNDeployment::get()->byId($deployment->ID);
336
	}
337
338
	/**
339
	 * @param int $deploymentID
@@ 342-358 (lines=17) @@
339
	 * @param int $deploymentID
340
	 * @return \DNDeployment
341
	 */
342
	public function updateDeployment($deploymentID) {
343
		$deployment = \DNDeployment::get()->byId($deploymentID);
344
		$deployment->EnvironmentID = $this->environment->ID;
345
		// Pull out the SHA from the options so we can make it queryable.
346
		$deployment->SHA = $this->getOption('sha');
347
		$deployment->Branch = $this->getOption('branch');
348
		// is a branch, tag, uat->prod, prev deploy or sha
349
		$deployment->RefType = $this->getOption('ref_type');
350
		$deployment->Summary = $this->getOption('summary');
351
		$deployment->Title = $this->getOption('title');
352
		$deployment->Strategy = $this->toJSON();
353
		$deployment->DeployerID = \Member::currentUserID();
354
		$deployment->write();
355
356
		// re-get and return the deployment so we have the correct state
357
		return \DNDeployment::get()->byId($deployment->ID);
358
	}
359
360
}
361