diff --git a/app/CliController.php b/app/CliController.php index 33bd2ce..30e046c 100644 --- a/app/CliController.php +++ b/app/CliController.php @@ -55,13 +55,19 @@ class CliController * @param iCli $cli_class * @throws ErrorException */ - public function execute($cli_class) + public function execute($cli) { try { - if (!in_array('iCli', class_implements($cli_class))) { - throw new ErrorException('Runner "' . get_class($cli_class) . '" need implement of "iCli" interface.'); + if (is_string($cli)) { + if (!class_exists($cli)) { + throw new GeneralException('Action class "' . $cli . '" not found.'); + } + $cli = new $cli; + } + if (!in_array('iCli', class_implements($cli))) { + throw new ErrorException('Runner "' . get_class($cli) . '" need implement of "iCli" interface.'); } - $cli_class->run(); + $cli->run(); if (Config::get('PROFILER')) { $profile = Profiler::getInstance()->getCli(); if (Config::get('LOGGING')) {