mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-05 00:48:57 +02:00
@@ -10,6 +10,7 @@
|
||||
|
||||
namespace Mage\Command;
|
||||
|
||||
use Mage\Command\AbstractCommand;
|
||||
use Mage\Config;
|
||||
use Mage\Autoload;
|
||||
|
||||
@@ -40,12 +41,17 @@ class Factory
|
||||
$className = 'Mage\\Command\\BuiltIn\\' . $commandName . 'Command';
|
||||
|
||||
if (!class_exists($className)) {
|
||||
throw new Exception('Command "' . $commandName . '" not found.');
|
||||
// try a custom command
|
||||
$className = 'Command\\' . $commandName;
|
||||
|
||||
if (!class_exists($className)) {
|
||||
throw new Exception('Command "' . $commandName . '" not found.');
|
||||
}
|
||||
}
|
||||
|
||||
/** @var AbstractCommand $instance */
|
||||
$instance = new $className;
|
||||
if (!is_a($instance, "Mage\Command\AbstractCommand")) {
|
||||
if (! $instance instanceOf AbstractCommand) {
|
||||
throw new Exception('The command ' . $commandName . ' must be an instance of Mage\Command\AbstractCommand.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user