Modife CliController.

This commit is contained in:
Alexander Demidov
2013-06-26 13:32:17 +04:00
committed by Alexander Demidov
parent 8133695eae
commit ef99a26635

View File

@ -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;
}
$cli_class->run();
if (!in_array('iCli', class_implements($cli))) {
throw new ErrorException('Runner "' . get_class($cli) . '" need implement of "iCli" interface.');
}
$cli->run();
if (Config::get('PROFILER')) {
$profile = Profiler::getInstance()->getCli();
if (Config::get('LOGGING')) {