Browse Source

Modife CliController.

namespace
Alexander Demidov 12 years ago
committed by Alexander Demidov
parent
commit
ef99a26635
  1. 14
      app/CliController.php

14
app/CliController.php

@ -55,13 +55,19 @@ class CliController
* @param iCli $cli_class * @param iCli $cli_class
* @throws ErrorException * @throws ErrorException
*/ */
public function execute($cli_class)
public function execute($cli)
{ {
try { 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')) { if (Config::get('PROFILER')) {
$profile = Profiler::getInstance()->getCli(); $profile = Profiler::getInstance()->getCli();
if (Config::get('LOGGING')) { if (Config::get('LOGGING')) {

Loading…
Cancel
Save