Пример #1
0
 public function __construct($input = null, $output = null, $name = null)
 {
     $this->input = $input ?: Console::input();
     $this->output = $output ?: Console::output();
     if (!isset($this->name)) {
         if (empty($name)) {
             $classPath = explode('\\', get_class($this));
             $name = preg_replace('/Command$/', '', end($classPath));
         }
         $this->name = $name;
     }
 }
Пример #2
0
 /**
  * 捕获错误
  */
 function onError()
 {
     $error = error_get_last();
     if (!isset($error['type'])) {
         return;
     }
     switch ($error['type']) {
         case E_ERROR:
         case E_PARSE:
         case E_DEPRECATED:
         case E_CORE_ERROR:
         case E_COMPILE_ERROR:
             break;
         default:
             return;
     }
     $errorMsg = "{$error['message']} ({$error['file']}:{$error['line']})";
     $message = Console::output("Application Error", $errorMsg);
 }