mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-05 17:08:56 +02:00
refactored Autoloader; added support for json encoded format for environment "hosts" option
This commit is contained in:
@@ -38,18 +38,14 @@ class Factory
|
||||
|
||||
$commandName = str_replace(' ', '_', ucwords(str_replace('/', ' ', $commandName)));
|
||||
$className = 'Mage\\Command\\BuiltIn\\' . $commandName . 'Command';
|
||||
if (Autoload::isLoadable($className)) {
|
||||
$instance = new $className;
|
||||
assert($instance instanceOf AbstractCommand);
|
||||
$instance->setConfig($config);
|
||||
} else {
|
||||
throw new Exception('Command not found.');
|
||||
}
|
||||
|
||||
if(!($instance instanceOf AbstractCommand)) {
|
||||
/** @var AbstractCommand $instance */
|
||||
$instance = new $className;
|
||||
if(!is_a($instance, "Mage\Command\AbstractCommand")) {
|
||||
throw new Exception('The command ' . $commandName . ' must be an instance of Mage\Command\AbstractCommand.');
|
||||
}
|
||||
|
||||
$instance->setConfig($config);
|
||||
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user