From c2b83428f0d64cfeb7a807d99e16b9204eb25de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Tue, 10 Jan 2017 22:02:35 -0300 Subject: [PATCH] [Nostromo] Apply PHP Mess Detector recommendations --- src/Command/BuiltIn/DeployCommand.php | 15 ++++++++------- src/Runtime/Runtime.php | 3 +-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Command/BuiltIn/DeployCommand.php b/src/Command/BuiltIn/DeployCommand.php index 3091171..3205e9f 100644 --- a/src/Command/BuiltIn/DeployCommand.php +++ b/src/Command/BuiltIn/DeployCommand.php @@ -144,15 +144,16 @@ class DeployCommand extends AbstractCommand if (count($hosts) == 0) { $output->writeln(sprintf(' No hosts defined, skipping %s tasks', $this->getStageName())); $output->writeln(''); - } else { - foreach ($hosts as $host) { - $this->runtime->setWorkingHost($host); - if (!$this->runTasks($output, $tasks)) { - $this->runtime->setWorkingHost(null); - throw $this->getException(); - } + return true; + } + + foreach ($hosts as $host) { + $this->runtime->setWorkingHost($host); + if (!$this->runTasks($output, $tasks)) { $this->runtime->setWorkingHost(null); + throw $this->getException(); } + $this->runtime->setWorkingHost(null); } } diff --git a/src/Runtime/Runtime.php b/src/Runtime/Runtime.php index a3cdb61..6e1b773 100644 --- a/src/Runtime/Runtime.php +++ b/src/Runtime/Runtime.php @@ -414,10 +414,9 @@ class Runtime $host = $this->getWorkingHost(); $sshConfig = $this->getSSHConfig(); + $cmdDelegate = $cmd; if ($sudo === true) { $cmdDelegate = sprintf('sudo %s', $cmd); - } else { - $cmdDelegate = $cmd; } if ($jail) {