Reformat ReleasesStrategy and RsyncStrategy for handle AbstractStrategy as parent

This commit is contained in:
Yamilov Stepan 2017-03-23 12:53:31 +05:00
parent 8c602fca99
commit dd6490e95f
2 changed files with 2 additions and 50 deletions

View file

@ -10,7 +10,6 @@
namespace Mage\Deploy\Strategy;
use Mage\Runtime\Exception\RuntimeException;
use Mage\Runtime\Runtime;
/**
@ -18,23 +17,13 @@ use Mage\Runtime\Runtime;
*
* @author Andrés Montañez <andresmontanez@gmail.com>
*/
class ReleasesStrategy implements StrategyInterface
class ReleasesStrategy extends AbstractStrategy
{
/**
* @var Runtime
*/
protected $runtime;
public function getName()
{
return 'Releases';
}
public function setRuntime(Runtime $runtime)
{
$this->runtime = $runtime;
}
public function getPreDeployTasks()
{
$this->checkStage(Runtime::PRE_DEPLOY);
@ -106,17 +95,4 @@ class ReleasesStrategy implements StrategyInterface
return $tasks;
}
/**
* Check the runtime stage is correct
*
* @param $stage
* @throws RuntimeException
*/
private function checkStage($stage)
{
if ($this->runtime->getStage() !== $stage) {
throw new RuntimeException(sprintf('Invalid stage, got "%s" but expected "%"', $this->runtime->getStage(), $stage));
}
}
}

View file

@ -10,7 +10,6 @@
namespace Mage\Deploy\Strategy;
use Mage\Runtime\Exception\RuntimeException;
use Mage\Runtime\Runtime;
/**
@ -18,23 +17,13 @@ use Mage\Runtime\Runtime;
*
* @author Andrés Montañez <andresmontanez@gmail.com>
*/
class RsyncStrategy implements StrategyInterface
class RsyncStrategy extends AbstractStrategy
{
/**
* @var Runtime
*/
protected $runtime;
public function getName()
{
return 'Rsync';
}
public function setRuntime(Runtime $runtime)
{
$this->runtime = $runtime;
}
public function getPreDeployTasks()
{
$this->checkStage(Runtime::PRE_DEPLOY);
@ -80,17 +69,4 @@ class RsyncStrategy implements StrategyInterface
return $tasks;
}
/**
* Check the runtime stage is correct
*
* @param $stage
* @throws RuntimeException
*/
private function checkStage($stage)
{
if ($this->runtime->getStage() !== $stage) {
throw new RuntimeException(sprintf('Invalid stage, got "%s" but expected "%"', $this->runtime->getStage(), $stage));
}
}
}