diff --git a/Mage/Autoload.php b/Mage/Autoload.php
index 474aa0c..c8a6fe0 100644
--- a/Mage/Autoload.php
+++ b/Mage/Autoload.php
@@ -31,11 +31,9 @@ class Autoload
if (strpos($className, 'Task\\') === 0) {
$baseDir = getcwd() . '/.mage/tasks';
$postfix = substr($postfix, 5);
-
- } else if (strpos($className, 'Command\\') === 0) {
+ } elseif (strpos($className, 'Command\\') === 0) {
$baseDir = getcwd() . '/.mage/commands';
$postfix = substr($postfix, 8);
-
} else {
$baseDir = dirname(dirname(__FILE__));
}
@@ -68,5 +66,4 @@ class Autoload
{
return is_readable($filePath);
}
-
}
diff --git a/Mage/Command/BuiltIn/AddCommand.php b/Mage/Command/BuiltIn/AddCommand.php
index d7b1d12..26d9a37 100644
--- a/Mage/Command/BuiltIn/AddCommand.php
+++ b/Mage/Command/BuiltIn/AddCommand.php
@@ -12,7 +12,6 @@ namespace Mage\Command\BuiltIn;
use Mage\Command\AbstractCommand;
use Mage\Console;
-
use Exception;
/**
diff --git a/Mage/Command/BuiltIn/DeployCommand.php b/Mage/Command/BuiltIn/DeployCommand.php
index 8649ef8..9105792 100644
--- a/Mage/Command/BuiltIn/DeployCommand.php
+++ b/Mage/Command/BuiltIn/DeployCommand.php
@@ -22,7 +22,6 @@ use Mage\Task\SkipException;
use Mage\Console;
use Mage\Config;
use Mage\Mailer;
-
use Exception;
/**
@@ -172,7 +171,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
if (self::$failedTasks > 0) {
self::$deployStatus = self::FAILED;
Console::output('A total of ' . self::$failedTasks . ' deployment tasks failed: ABORTING', 1, 2);
-
} else {
// Run Deployment Tasks
$this->runDeploymentTasks();
@@ -265,7 +263,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
if (count($tasksToRun) == 0) {
Console::output('No ' . $title . ' tasks defined.', 1, 3);
-
} else {
Console::output('Starting ' . $title . ' tasks:');
@@ -306,7 +303,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
if ($this->hostsCount == 0) {
Console::output('Warning! No hosts defined, skipping deployment tasks.', 1, 3);
-
} else {
$this->startTimeHosts = time();
foreach ($hosts as $hostKey => $host) {
@@ -337,7 +333,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
if (count($tasksToRun) == 0) {
Console::output('Warning! No Deployment tasks defined.', 2);
Console::output('Deployment to ' . $host . ' skipped!', 1, 3);
-
} else {
foreach ($tasksToRun as $taskData) {
$tasks++;
@@ -443,21 +438,20 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
}
}
- protected function runRollbackTask(AbstractTask $task){
+ protected function runRollbackTask(AbstractTask $task)
+ {
$this->getConfig()->reload();
$hosts = $this->getConfig()->getHosts();
- Console::output("",1,2);
- Console::output("Starting the rollback",1,1);
-
- if(!in_array($task->getStage(), $this->acceptedStagesToRollback ) ) {
- $stagesString = implode(', ',$this->acceptedStagesToRollback);
- Console::output("Warning! Rollback during deployment can be called only at the stages: $stagesString ",1);
- Console::output("Rollback: ABORTING",1,3);
+ Console::output("", 1, 2);
+ Console::output("Starting the rollback", 1, 1);
+ if (!in_array($task->getStage(), $this->acceptedStagesToRollback)) {
+ $stagesString = implode(', ', $this->acceptedStagesToRollback);
+ Console::output("Warning! Rollback during deployment can be called only at the stages: $stagesString ", 1);
+ Console::output("Rollback: ABORTING", 1, 3);
} elseif (count($hosts) == 0) {
Console::output('Warning! No hosts defined, unable to get releases.', 1, 3);
-
} else {
$result = true;
foreach ($hosts as $hostKey => $host) {
@@ -482,7 +476,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
);
$task->init();
$result = $task->run() && $result;
-
}
return $result;
}
@@ -506,7 +499,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
Console::output($title, 2, 0);
$runTask = true;
- if (($task instanceOf SkipOnOverride) && $this->getConfig()->getParameter('overrideRelease', false)) {
+ if (($task instanceof SkipOnOverride) && $this->getConfig()->getParameter('overrideRelease', false)) {
$runTask = false;
}
@@ -517,7 +510,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
if ($result === true) {
Console::output('OK', 0);
$result = true;
-
} else {
Console::output('FAIL', 0);
$result = false;
@@ -526,15 +518,12 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
Console::output('FAIL, Rollback catched [Message: ' . $e->getMessage() . ']', 0);
$this->runRollbackTask($task);
$result = false;
-
} catch (ErrorWithMessageException $e) {
Console::output('FAIL [Message: ' . $e->getMessage() . ']', 0);
$result = false;
-
} catch (SkipException $e) {
Console::output('SKIPPED', 0);
$result = true;
-
} catch (Exception $e) {
Console::output('FAIL', 0);
$result = false;
@@ -645,7 +634,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
*/
protected function chooseReleaseStrategy()
{
-
if ($this->getConfig()->release('enabled', self::DEFAULT_RELEASE_IS_ENABLED)
&& $this->getConfig()->deployment('strategy', self::DEFAULT_DEPLOY_STRATEGY) !== self::DEPLOY_STRATEGY_DISABLED
) {
@@ -656,5 +644,4 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
return $strategy;
}
-
}
diff --git a/Mage/Command/BuiltIn/InitCommand.php b/Mage/Command/BuiltIn/InitCommand.php
index 90d665f..326f0e9 100644
--- a/Mage/Command/BuiltIn/InitCommand.php
+++ b/Mage/Command/BuiltIn/InitCommand.php
@@ -51,7 +51,6 @@ class InitCommand extends AbstractCommand
Console::output('Success!! The configuration for Magallanes has been generated at .mage directory.');
Console::output('Please!! Review and adjust the configuration.', 2, 2);
$exitCode = 0;
-
} else {
Console::output('Error!! Unable to generate the configuration.', 1, 2);
}
diff --git a/Mage/Command/BuiltIn/InstallCommand.php b/Mage/Command/BuiltIn/InstallCommand.php
index 4271d43..530e1d7 100644
--- a/Mage/Command/BuiltIn/InstallCommand.php
+++ b/Mage/Command/BuiltIn/InstallCommand.php
@@ -42,9 +42,8 @@ class InstallCommand extends AbstractCommand
Console::output('Failure: install directory is invalid.', 0, 2);
// Chck if it is a system wide install the user is root
- } else if ($systemWide && (getenv('LOGNAME') != 'root')) {
+ } elseif ($systemWide && (getenv('LOGNAME') != 'root')) {
Console::output('Failure: you have to be root to perform a system wide install.', 0, 2);
-
} else {
$destinationDir = $baseDir . '/' . $installDir;
if (!is_dir($destinationDir)) {
@@ -104,7 +103,6 @@ class InstallCommand extends AbstractCommand
$from . DIRECTORY_SEPARATOR . $file,
$to . DIRECTORY_SEPARATOR . $file
);
-
} else {
copy(
$from . DIRECTORY_SEPARATOR . $file,
@@ -114,10 +112,8 @@ class InstallCommand extends AbstractCommand
}
}
return true;
-
} elseif (is_file($from)) {
return copy($from, $to);
-
} else {
return false;
}
diff --git a/Mage/Command/BuiltIn/ListCommand.php b/Mage/Command/BuiltIn/ListCommand.php
index 30714b2..d7dd082 100644
--- a/Mage/Command/BuiltIn/ListCommand.php
+++ b/Mage/Command/BuiltIn/ListCommand.php
@@ -12,7 +12,6 @@ namespace Mage\Command\BuiltIn;
use Mage\Command\AbstractCommand;
use Mage\Console;
-
use Exception;
/**
@@ -73,7 +72,6 @@ class ListCommand extends AbstractCommand
}
Console::output('', 1, 1);
$exitCode = 0;
-
} else {
Console::output('You don\'t have any environment configured.', 1, 2);
}
diff --git a/Mage/Command/BuiltIn/LockCommand.php b/Mage/Command/BuiltIn/LockCommand.php
index e39001d..09df123 100644
--- a/Mage/Command/BuiltIn/LockCommand.php
+++ b/Mage/Command/BuiltIn/LockCommand.php
@@ -58,5 +58,4 @@ class LockCommand extends AbstractCommand implements RequiresEnvironment
return 0;
}
-
}
diff --git a/Mage/Command/BuiltIn/RollbackCommand.php b/Mage/Command/BuiltIn/RollbackCommand.php
index 8d85ac8..dea92b0 100644
--- a/Mage/Command/BuiltIn/RollbackCommand.php
+++ b/Mage/Command/BuiltIn/RollbackCommand.php
@@ -48,7 +48,6 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
if (count($hosts) == 0) {
Console::output('Warning! No hosts defined, unable to get releases.', 1, 3);
-
} else {
$result = true;
foreach ($hosts as $hostKey => $host) {
diff --git a/Mage/Command/BuiltIn/UnlockCommand.php b/Mage/Command/BuiltIn/UnlockCommand.php
index 1666e67..2c7d324 100644
--- a/Mage/Command/BuiltIn/UnlockCommand.php
+++ b/Mage/Command/BuiltIn/UnlockCommand.php
@@ -41,5 +41,4 @@ class UnlockCommand extends AbstractCommand implements RequiresEnvironment
return 0;
}
-
}
diff --git a/Mage/Command/BuiltIn/UpdateCommand.php b/Mage/Command/BuiltIn/UpdateCommand.php
index 14dc75a..30cff52 100644
--- a/Mage/Command/BuiltIn/UpdateCommand.php
+++ b/Mage/Command/BuiltIn/UpdateCommand.php
@@ -38,7 +38,6 @@ class UpdateCommand extends AbstractCommand
if ($result === true) {
Console::output('OK' . PHP_EOL, 0);
$exitCode = 0;
-
} else {
Console::output('FAIL' . PHP_EOL, 0);
}
diff --git a/Mage/Command/BuiltIn/UpgradeCommand.php b/Mage/Command/BuiltIn/UpgradeCommand.php
index 94fe6e0..a9861ac 100644
--- a/Mage/Command/BuiltIn/UpgradeCommand.php
+++ b/Mage/Command/BuiltIn/UpgradeCommand.php
@@ -50,7 +50,6 @@ class UpgradeCommand extends AbstractCommand
if ($user != 'root' && $user != $owner) {
Console::output('FAIL', 0, 1);
Console::output('You need to be the ' . $owner . ' user to perform the upgrade, or root.', 2);
-
} else {
// Check version
$version = json_decode(file_get_contents(self::UPGRADE));
@@ -61,19 +60,16 @@ class UpgradeCommand extends AbstractCommand
Console::output('SKIP', 0, 1);
Console::output('Your current version is up to date.', 2);
$exitCode = 0;
-
- } else if ($versionCompare == 1) {
+ } elseif ($versionCompare == 1) {
Console::output('SKIP', 0, 1);
Console::output('Your current version is newer.', 2);
$exitCode = 0;
-
- } else if ($versionCompare == -1) {
+ } elseif ($versionCompare == -1) {
// Download Package
$tarball = file_get_contents(str_replace('{version}', $version->latest, self::DOWNLOAD));
if ($tarball === false) {
Console::output('FAIL', 0, 1);
Console::output('Corrupted download.', 2);
-
} else {
$tarballFile = tempnam('/tmp', 'magallanes_download');
rename($tarballFile, $tarballFile . '.tar.gz');
@@ -87,7 +83,6 @@ class UpgradeCommand extends AbstractCommand
Console::output('OK', 0, 1);
$exitCode = 0;
}
-
} else {
Console::output('FAIL', 0, 1);
Console::output('Invalid version.', 2);
diff --git a/Mage/Command/Factory.php b/Mage/Command/Factory.php
index d5668ee..cc3f7f3 100644
--- a/Mage/Command/Factory.php
+++ b/Mage/Command/Factory.php
@@ -12,7 +12,6 @@ namespace Mage\Command;
use Mage\Command\AbstractCommand;
use Mage\Config;
-
use Exception;
/**
@@ -52,7 +51,7 @@ class Factory
/** @var AbstractCommand $instance */
// TODO dependencies like $config should be injected into constructor
$instance = new $className;
- if (! $instance instanceOf AbstractCommand) {
+ if (! $instance instanceof AbstractCommand) {
// TODO use a custom exception
throw new Exception('The command ' . $commandName . ' must be an instance of Mage\Command\AbstractCommand.');
}
diff --git a/Mage/Config.php b/Mage/Config.php
index dd78593..3f70f6c 100644
--- a/Mage/Config.php
+++ b/Mage/Config.php
@@ -75,15 +75,14 @@ class Config
foreach ($arguments as $argument) {
if (preg_match('/to:[\w]+/i', $argument)) {
$this->environment = str_replace('to:', '', $argument);
-
- } else if (preg_match('/--[\w]+/i', $argument)) {
+ } elseif (preg_match('/--[\w]+/i', $argument)) {
$optionValue = explode('=', substr($argument, 2));
if (count($optionValue) == 1) {
$this->parameters[$optionValue[0]] = true;
- } else if (count($optionValue) == 2) {
+ } elseif (count($optionValue) == 2) {
if (strtolower($optionValue[1]) == 'true') {
$this->parameters[$optionValue[0]] = true;
- } else if (strtolower($optionValue[1]) == 'false') {
+ } elseif (strtolower($optionValue[1]) == 'false') {
$this->parameters[$optionValue[0]] = false;
} else {
$this->parameters[$optionValue[0]] = $optionValue[1];
@@ -129,11 +128,9 @@ class Config
*/
protected function loadEnvironment($filePath)
{
-
$settings = $this->parseConfigFile($filePath);
return $settings;
-
}
/**
@@ -154,7 +151,6 @@ class Config
} catch (ConfigNotFoundException $e) {
throw new RequiredConfigNotFoundException("Not found required config $configFilePath for environment $environment", 0, $e);
}
-
}
}
@@ -165,8 +161,9 @@ class Config
*/
protected function isRunInSpecialMode(array $parameters)
{
- if (empty($parameters))
+ if (empty($parameters)) {
return true;
+ }
foreach ($parameters as $parameter) {
if (isset(Console::$paramsNotRequiringEnvironment[$parameter])) {
return true;
@@ -235,7 +232,7 @@ class Config
{
if (isset($this->parameters[$name])) {
return $this->parameters[$name];
- } else if (isset($extraParameters[$name])) {
+ } elseif (isset($extraParameters[$name])) {
return $extraParameters[$name];
} else {
return $default;
@@ -326,7 +323,7 @@ class Config
if (isset($envConfig['hosts'])) {
if (is_array($envConfig['hosts'])) {
$hosts = (array)$envConfig['hosts'];
- } else if (is_string($envConfig['hosts']) && file_exists($envConfig['hosts']) && is_readable($envConfig['hosts'])) {
+ } elseif (is_string($envConfig['hosts']) && file_exists($envConfig['hosts']) && is_readable($envConfig['hosts'])) {
$hosts = $this->getHostsFromFile($envConfig['hosts']);
}
}
@@ -605,7 +602,6 @@ class Config
$fileContent = stream_get_contents($handle);
$hosts = json_decode($fileContent);
} catch (Exception $e) {
-
rewind($handle);
//do it old-style: one host per line
while (($host = stream_get_line($handle, self::HOST_NAME_LENGTH)) !== false) {
@@ -618,5 +614,4 @@ class Config
return $hosts;
}
-
}
diff --git a/Mage/Console.php b/Mage/Console.php
index 8dd7940..d9fcbb2 100644
--- a/Mage/Console.php
+++ b/Mage/Console.php
@@ -13,7 +13,6 @@ namespace Mage;
use Mage\Command\Factory;
use Mage\Command\RequiresEnvironment;
use Mage\Console\Colors;
-
use Exception;
use RecursiveDirectoryIterator;
use SplFileInfo;
@@ -95,7 +94,6 @@ class Console
try {
// Load configuration
$config->load($arguments);
-
} catch (Exception $exception) {
$configError = $exception->getMessage();
}
@@ -119,7 +117,6 @@ class Console
if ($showGreetings) {
if (!self::$logEnabled) {
self::output('Starting Magallanes', 0, 2);
-
} else {
self::output('Starting Magallanes', 0, 1);
self::log("Logging enabled");
@@ -130,13 +127,12 @@ class Console
// Run Command - Check if there is a Configuration Error
if ($configError !== false) {
self::output('' . $configError . '', 1, 2);
-
} else {
// Run Command and check for Command Requirements
try {
$command = Factory::get($commandName, $config);
- if ($command instanceOf RequiresEnvironment) {
+ if ($command instanceof RequiresEnvironment) {
if ($config->getEnvironment() === false) {
throw new Exception('You must specify an environment for this command.');
}
@@ -310,5 +306,4 @@ class Console
|| self::$config->general('verbose_logging')
|| self::$config->environmentConfig('verbose_logging', false);
}
-
}
diff --git a/Mage/Mailer.php b/Mage/Mailer.php
index f2fb33d..1751c85 100644
--- a/Mage/Mailer.php
+++ b/Mage/Mailer.php
@@ -10,7 +10,6 @@
namespace Mage;
-
/**
* Mailer Helper.
*
diff --git a/Mage/Task/AbstractTask.php b/Mage/Task/AbstractTask.php
index 5c4e36b..5edd4fa 100644
--- a/Mage/Task/AbstractTask.php
+++ b/Mage/Task/AbstractTask.php
@@ -13,7 +13,6 @@ namespace Mage\Task;
use Mage\Console;
use Mage\Config;
use Mage\Task\Releases\IsReleaseAware;
-
use Exception;
/**
@@ -75,7 +74,7 @@ abstract class AbstractTask
* Returns the Title of the Task
* @return string
*/
- public abstract function getName();
+ abstract public function getName();
/**
* Runs the task
@@ -85,7 +84,7 @@ abstract class AbstractTask
* @throws ErrorWithMessageException
* @throws SkipException
*/
- public abstract function run();
+ abstract public function run();
/**
* Task Constructor
@@ -95,7 +94,7 @@ abstract class AbstractTask
* @param string $stage
* @param array $parameters
*/
- public final function __construct(Config $config, $inRollback = false, $stage = null, $parameters = array())
+ final public function __construct(Config $config, $inRollback = false, $stage = null, $parameters = array())
{
$this->config = $config;
$this->inRollback = $inRollback;
@@ -167,7 +166,7 @@ abstract class AbstractTask
* @param string $output
* @return boolean
*/
- protected final function runCommandLocal($command, &$output = null)
+ final protected function runCommandLocal($command, &$output = null)
{
return Console::executeCommand($command, $output);
}
@@ -179,19 +178,17 @@ abstract class AbstractTask
* @param boolean $cdToDirectoryFirst
* @return boolean
*/
- protected final function runCommandRemote($command, &$output = null, $cdToDirectoryFirst = true)
+ final protected function runCommandRemote($command, &$output = null, $cdToDirectoryFirst = true)
{
if ($this->getConfig()->release('enabled', false) === true) {
- if ($this instanceOf IsReleaseAware) {
+ if ($this instanceof IsReleaseAware) {
$releasesDirectory = '';
-
} else {
$releasesDirectory = '/'
. $this->getConfig()->release('directory', 'releases')
. '/'
. $this->getConfig()->getReleaseId();
}
-
} else {
$releasesDirectory = '';
}
@@ -202,7 +199,7 @@ abstract class AbstractTask
$localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
. '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
. $this->getConfig()->getConnectTimeoutOption()
- . ( $this->getConfig()->deployment('user') != '' ? $this->getConfig()->deployment('user') . '@' : '' )
+ . ($this->getConfig()->deployment('user') != '' ? $this->getConfig()->deployment('user') . '@' : '')
. $this->getConfig()->getHostName();
$remoteCommand = str_replace('"', '\"', $command);
@@ -223,7 +220,7 @@ abstract class AbstractTask
* @param string $output
* @return boolean
*/
- protected final function runCommand($command, &$output = null)
+ final protected function runCommand($command, &$output = null)
{
if ($this->getStage() == self::STAGE_DEPLOY || $this->getStage() == self::STAGE_POST_RELEASE) {
return $this->runCommandRemote($command, $output);
diff --git a/Mage/Task/BuiltIn/Deployment/ReleaseTask.php b/Mage/Task/BuiltIn/Deployment/ReleaseTask.php
index ce1d838..93df8cf 100644
--- a/Mage/Task/BuiltIn/Deployment/ReleaseTask.php
+++ b/Mage/Task/BuiltIn/Deployment/ReleaseTask.php
@@ -98,7 +98,6 @@ class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride
}
return $result;
-
} else {
return false;
}
diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php b/Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php
index c5a37b9..a3ed861 100644
--- a/Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php
+++ b/Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php
@@ -100,7 +100,7 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
. $this->excludes($excludes) . ' '
. $this->excludesListFile($excludesListFilePath) . ' '
. $this->getConfig()->deployment('from') . ' '
- . ( $this->getConfig()->deployment('user') ? $this->getConfig()->deployment('user') . '@' : '' )
+ . ($this->getConfig()->deployment('user') ? $this->getConfig()->deployment('user') . '@' : '')
. $this->getConfig()->getHostName() . ':' . $deployToDirectory;
$result = $this->runCommandLocal($command);
@@ -132,7 +132,7 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
protected function excludesListFile($excludesFile)
{
$excludesListFileRsync = '';
- if(!empty($excludesFile) && file_exists($excludesFile) && is_file($excludesFile) && is_readable($excludesFile)) {
+ if (!empty($excludesFile) && file_exists($excludesFile) && is_file($excludesFile) && is_readable($excludesFile)) {
$excludesListFileRsync = ' --exclude-from=' . $excludesFile;
}
return $excludesListFileRsync;
diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php b/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php
index 6e9f3bb..1f741a2 100644
--- a/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php
+++ b/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php
@@ -46,7 +46,8 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$this->checkOverrideRelease();
$excludes = $this->getExcludes();
- $excludesListFilePath = $this->getConfig()->deployment('excludes_file', '');;
+ $excludesListFilePath = $this->getConfig()->deployment('excludes_file', '');
+ ;
// If we are working with releases
$deployToDirectory = $this->getConfig()->deployment('to');
@@ -131,7 +132,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
protected function excludesListFile($excludesFile)
{
$excludesListFileRsync = '';
- if(!empty($excludesFile) && file_exists($excludesFile) && is_file($excludesFile) && is_readable($excludesFile)) {
+ if (!empty($excludesFile) && file_exists($excludesFile) && is_file($excludesFile) && is_readable($excludesFile)) {
$excludesListFileRsync = ' --exclude-from=' . $excludesFile;
}
return $excludesListFileRsync;
diff --git a/Mage/Task/BuiltIn/Filesystem/PermissionsTask.php b/Mage/Task/BuiltIn/Filesystem/PermissionsTask.php
index f5f9505..06ec8e9 100644
--- a/Mage/Task/BuiltIn/Filesystem/PermissionsTask.php
+++ b/Mage/Task/BuiltIn/Filesystem/PermissionsTask.php
@@ -158,7 +158,7 @@ class PermissionsTask extends AbstractTask
'R' => $this->recursive
);
- foreach($options as $option => $apply) {
+ foreach ($options as $option => $apply) {
if ($apply === true) {
$optionsForCmd .= $option;
}
diff --git a/Mage/Task/BuiltIn/General/ManuallyTask.php b/Mage/Task/BuiltIn/General/ManuallyTask.php
index aec0279..64870d3 100644
--- a/Mage/Task/BuiltIn/General/ManuallyTask.php
+++ b/Mage/Task/BuiltIn/General/ManuallyTask.php
@@ -15,9 +15,9 @@ use Mage\Task\AbstractTask;
/**
* Task for running multiple custom commands setting them manually
- *
+ *
* Example of usage:
- *
+ *
* tasks:
* on-deploy:
* - scm/force-update
@@ -30,7 +30,8 @@ use Mage\Task\AbstractTask;
*
* @author Samuel Chiriluta
*/
-class ManuallyTask extends AbstractTask {
+class ManuallyTask extends AbstractTask
+{
/**
* (non-PHPdoc)
@@ -50,12 +51,10 @@ class ManuallyTask extends AbstractTask {
$commands = $this->getParameters();
- foreach ($commands as $command)
- {
+ foreach ($commands as $command) {
$result = $result && $this->runCommand($command);
}
return $result;
}
-
}
diff --git a/Mage/Task/BuiltIn/Ioncube/EncryptTask.php b/Mage/Task/BuiltIn/Ioncube/EncryptTask.php
index 8565036..c51032d 100644
--- a/Mage/Task/BuiltIn/Ioncube/EncryptTask.php
+++ b/Mage/Task/BuiltIn/Ioncube/EncryptTask.php
@@ -225,7 +225,7 @@ class EncryptTask extends AbstractTask
* Check if we have been given an encoder script
* If not then we will just use the default
*/
- if (isset ($this->mageConfig ['encoder'])) {
+ if (isset($this->mageConfig ['encoder'])) {
$this->encoder = $this->mageConfig ['encoder'];
}
/*
@@ -233,14 +233,14 @@ class EncryptTask extends AbstractTask
* supplied, this defines how the 3 differant
* config files will be merged together.
*/
- if (isset ($this->mageConfig ['override'])) {
+ if (isset($this->mageConfig ['override'])) {
$this->ionOverRide = $this->mageConfig ['override'];
}
/*
* Check if we have been asked to
* confirm all encodings
*/
- if (isset ($this->mageConfig ['checkencoding'])) {
+ if (isset($this->mageConfig ['checkencoding'])) {
$this->checkEncoding = true;
}
/*
@@ -249,7 +249,7 @@ class EncryptTask extends AbstractTask
* encrypt/encode file check
*
*/
- if (isset ($this->mageConfig ['checkignoreextens'])) {
+ if (isset($this->mageConfig ['checkignoreextens'])) {
$this->checkIgnoreExtens = array_merge($this->ignoreExtens, $this->mageConfig['ignoreextens']);
}
@@ -259,7 +259,7 @@ class EncryptTask extends AbstractTask
* encrypt/encode file check
*
*/
- if (isset ($this->mageConfig ['checkignorepaths'])) {
+ if (isset($this->mageConfig ['checkignorepaths'])) {
$this->checkIgnorePaths = array_merge($this->checkIgnorePaths, $this->mageConfig['checkignorepaths']);
}
@@ -289,7 +289,7 @@ class EncryptTask extends AbstractTask
* Check if there is a 'project' section,
* if so then get the options from there
*/
- if (isset ($this->mageConfig ['project'])) {
+ if (isset($this->mageConfig ['project'])) {
$this->yaml = $this->getOptionsFromYaml($this->mageConfig ['project']);
} else {
$this->yaml = array(
@@ -301,7 +301,7 @@ class EncryptTask extends AbstractTask
* Check if a seperate projectfile has been specified, and if so
* then read the options from there.
*/
- if (isset ($this->mageConfig ['projectfile'])) {
+ if (isset($this->mageConfig ['projectfile'])) {
$this->file = $this->getOptionsFromFile($this->mageConfig ['projectfile']);
} else {
$this->file = array(
@@ -359,8 +359,8 @@ class EncryptTask extends AbstractTask
// $ask holds flag to indicate we need to prompt the end user
$ask = false;
// scan through the directory
- $rit = new \RecursiveDirectoryIterator ($src);
- foreach (new \RecursiveIteratorIterator ($rit) as $filename => $cur) {
+ $rit = new \RecursiveDirectoryIterator($src);
+ foreach (new \RecursiveIteratorIterator($rit) as $filename => $cur) {
// get the 'base dir' for the project, eg. relative to the temp folder
$srcFileName = (str_replace($this->source, '', $filename));
/*
@@ -468,7 +468,7 @@ class EncryptTask extends AbstractTask
*/
private function deleteTmpFiles()
{
- if (isset ($this->mageConfig ['keeptemp'])) {
+ if (isset($this->mageConfig ['keeptemp'])) {
return;
}
Console::log('Deleting tempory files :', 1);
@@ -477,7 +477,7 @@ class EncryptTask extends AbstractTask
if ($ret1 && $ret2) {
return;
}
- throw new ErrorWithMessageException ('Error deleting temp files :' . $out1 . ' : ' . $out2, 40);
+ throw new ErrorWithMessageException('Error deleting temp files :' . $out1 . ' : ' . $out2, 40);
}
/**
@@ -533,7 +533,7 @@ class EncryptTask extends AbstractTask
if (!$ret) {
// something went wrong
$this->deleteTmpFiles();
- throw new ErrorWithMessageException ('Unable to create project file.', 20);
+ throw new ErrorWithMessageException('Unable to create project file.', 20);
}
}
@@ -603,11 +603,11 @@ class EncryptTask extends AbstractTask
{
$ret = Console::executeCommand('mv ' . $this->source . ' ' . $this->ionSource, $out);
if (!$ret) {
- throw new ErrorWithMessageException ('Cant create tmp dir :' . $out, $ret);
+ throw new ErrorWithMessageException('Cant create tmp dir :' . $out, $ret);
}
$ret = Console::executeCommand('mkdir -p ' . $this->source, $out);
if (!$ret) {
- throw new ErrorWithMessageException ('Cant re-create dir :' . $out, $ret);
+ throw new ErrorWithMessageException('Cant re-create dir :' . $out, $ret);
}
return true;
}
diff --git a/Mage/Task/BuiltIn/Releases/ListTask.php b/Mage/Task/BuiltIn/Releases/ListTask.php
index ffbd2c4..9b86852 100644
--- a/Mage/Task/BuiltIn/Releases/ListTask.php
+++ b/Mage/Task/BuiltIn/Releases/ListTask.php
@@ -13,7 +13,6 @@ namespace Mage\Task\BuiltIn\Releases;
use Mage\Console;
use Mage\Task\AbstractTask;
use Mage\Task\Releases\IsReleaseAware;
-
use DateTime;
/**
@@ -87,7 +86,6 @@ class ListTask extends AbstractTask implements IsReleaseAware
Console::output('');
return $result;
-
} else {
Console::output('');
return false;
@@ -109,32 +107,28 @@ class ListTask extends AbstractTask implements IsReleaseAware
if ($diff->format('%a') <= 7) {
if ($diff->format('%d') == 7) {
$textDiff = ' [a week ago] ';
-
- } else if ($diff->format('%d') > 0 && $diff->format('%d') < 7) {
+ } elseif ($diff->format('%d') > 0 && $diff->format('%d') < 7) {
$days = $diff->format('%d');
if ($days <= 1) {
$textDiff = ' [one day ago] ';
} else {
$textDiff = ' [' . $days . ' days ago] ';
}
-
- } else if ($diff->format('%d') == 0 && $diff->format('%h') > 0) {
+ } elseif ($diff->format('%d') == 0 && $diff->format('%h') > 0) {
$hours = $diff->format('%h');
if ($hours <= 1) {
$textDiff = ' [one hour ago] ';
} else {
$textDiff = ' [' . $hours . ' hours ago] ';
}
-
- } else if ($diff->format('%d') == 0 && $diff->format('%h') == 0) {
+ } elseif ($diff->format('%d') == 0 && $diff->format('%h') == 0) {
$minutes = $diff->format('%i');
if ($minutes <= 1) {
$textDiff = ' [one minute ago] ';
} else {
$textDiff = ' [' . $minutes . ' minutes ago] ';
}
-
- } else if ($diff->format('%d') == 0 && $diff->format('%h') == 0 && $diff->format('%i') == 0) {
+ } elseif ($diff->format('%d') == 0 && $diff->format('%h') == 0 && $diff->format('%i') == 0) {
$seconds = $diff->format('%s');
if ($seconds < 10) {
$textDiff = ' [just now!] ';
diff --git a/Mage/Task/BuiltIn/Releases/RollbackTask.php b/Mage/Task/BuiltIn/Releases/RollbackTask.php
index 2a0038f..9d9fb4b 100644
--- a/Mage/Task/BuiltIn/Releases/RollbackTask.php
+++ b/Mage/Task/BuiltIn/Releases/RollbackTask.php
@@ -61,12 +61,11 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
if (count($releases) == 0) {
Console::output('Release are not available for ' . $this->getConfig()->getHost() . ' ... FAIL');
-
} else {
rsort($releases);
$deleteCurrent = $this->getConfig()->getParameter('deleteCurrent',
$this->getConfig()->deployment('delete-on-rollback',
- $this->getConfig()->general('delete-on-rollback',false)
+ $this->getConfig()->general('delete-on-rollback', false)
)
);
@@ -74,8 +73,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
if ($this->getReleaseId() == '') {
$releaseId = $releases[0];
$releaseIsAvailable = true;
-
- } else if ($this->getReleaseId() <= 0) {
+ } elseif ($this->getReleaseId() <= 0) {
$index = $this->getReleaseId() * -1;
if (isset($releases[$index])) {
$releaseId = $releases[$index];
@@ -92,7 +90,6 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
if (!$releaseIsAvailable) {
Console::output('Release ' . $this->getReleaseId() . ' is invalid or unavailable for ' . $this->getConfig()->getHost() . ' ... FAIL');
-
} else {
Console::output('Rollback release on ' . $this->getConfig()->getHost() . '');
$rollbackTo = $releasesDirectory . '/' . $releaseId;
@@ -116,7 +113,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
$task->init();
Console::output('Running ' . $task->getName() . ' ... ', 2, false);
- if ($task instanceOf RollbackAware) {
+ if ($task instanceof RollbackAware) {
/* @var $task AbstractTask */
$tasks++;
$result = $task->run();
@@ -166,7 +163,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
$task->init();
Console::output('Running ' . $task->getName() . ' ... ', 2, false);
- if ($task instanceOf RollbackAware) {
+ if ($task instanceof RollbackAware) {
/* @var $task AbstractTask */
$tasks++;
$result = $task->run();
@@ -193,7 +190,6 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
}
return $result;
-
} else {
return false;
}
diff --git a/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php b/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php
index 20859c5..36c27ea 100644
--- a/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php
+++ b/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php
@@ -69,7 +69,6 @@ class ChangeBranchTask extends AbstractTask
if ($this->getParameter('_changeBranchRevert', false)) {
$command = $preCommand . 'git checkout ' . self::$startingBranch;
$result = $this->runCommandLocal($command);
-
} else {
$command = $preCommand . 'git branch | grep \'*\' | cut -d\' \' -f 2';
$currentBranch = 'master';
diff --git a/Mage/Task/BuiltIn/Scm/ForceUpdateTask.php b/Mage/Task/BuiltIn/Scm/ForceUpdateTask.php
index 2b1bfe8..45727a6 100644
--- a/Mage/Task/BuiltIn/Scm/ForceUpdateTask.php
+++ b/Mage/Task/BuiltIn/Scm/ForceUpdateTask.php
@@ -15,9 +15,9 @@ use Mage\Task\SkipException;
/**
* Task for Force Updating a Working Copy
- *
+ *
* 'git fetch' downloads the latest from remote without trying to merge or rebase anything.
- * 'git reset' resets the master branch to what you just fetched.
+ * 'git reset' resets the master branch to what you just fetched.
* The '--hard' option changes all the files in your working tree to match the files in origin/master,
* so if you have any local changes, they will be lost.
*
diff --git a/Mage/Task/BuiltIn/Scm/UpdateTask.php b/Mage/Task/BuiltIn/Scm/UpdateTask.php
index 3347a97..db9a775 100644
--- a/Mage/Task/BuiltIn/Scm/UpdateTask.php
+++ b/Mage/Task/BuiltIn/Scm/UpdateTask.php
@@ -54,7 +54,7 @@ class UpdateTask extends AbstractTask
*/
public function run()
{
- $command = 'cd ' . $this->getConfig()->deployment('from', './') . '; ';
+ $command = 'cd ' . $this->getConfig()->deployment('from', './') . '; ';
switch ($this->getConfig()->general('scm')) {
case 'git':
$command .= 'git pull';
diff --git a/Mage/Task/BuiltIn/Symfony2/CacheClearTask.php b/Mage/Task/BuiltIn/Symfony2/CacheClearTask.php
index d347138..7fca635 100644
--- a/Mage/Task/BuiltIn/Symfony2/CacheClearTask.php
+++ b/Mage/Task/BuiltIn/Symfony2/CacheClearTask.php
@@ -14,7 +14,7 @@ use Mage\Task\BuiltIn\Symfony2\SymfonyAbstractTask;
/**
* Task for Clearing the Cache
- *
+ *
* Example of usage:
* symfony2/cache-clear: { env: dev }
* symfony2/cache-clear: { env: dev, optional: --no-warmup }
diff --git a/Mage/Task/Factory.php b/Mage/Task/Factory.php
index db53818..9384d4c 100644
--- a/Mage/Task/Factory.php
+++ b/Mage/Task/Factory.php
@@ -12,7 +12,6 @@ namespace Mage\Task;
use Mage\Config;
use Mage\Task\AbstractTask;
-
use Exception;
/**
@@ -48,7 +47,6 @@ class Factory
if (strpos($taskName, '/') === false) {
$className = 'Task\\' . $taskName;
-
} else {
$className = 'Mage\\Task\\BuiltIn\\' . str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskName))) . 'Task';
}
diff --git a/Mage/Task/RollbackException.php b/Mage/Task/RollbackException.php
index d2e56df..b7361d1 100644
--- a/Mage/Task/RollbackException.php
+++ b/Mage/Task/RollbackException.php
@@ -19,5 +19,4 @@ use Exception;
*/
class RollbackException extends Exception
{
-
-}
\ No newline at end of file
+}