/**
  * Register exception
  * @param mixed $a_arg0
  * @param mixed $a_arg1
  * @param mixed $a_arg2
  * @return ZModule
  */
 public function &triggerError($a_arg0, $a_arg1 = null, $a_arg2 = null)
 {
     switch (func_num_args()) {
         case 1:
             switch (gettype($a_arg0)) {
                 case 'object':
                     if ($a_arg0 instanceof Exception) {
                         Zoombi::getApplication()->emit(new ZEvent($this, '_triggerError', $a_arg0));
                     }
                     break;
                 case 'string':
                     $tr = debug_backtrace();
                     $e = new ZException($a_arg0, E_USER_ERROR);
                     $e->setLine($tr[0]['line']);
                     $e->setFile($tr[0]['file']);
                     Zoombi::getApplication()->emit(new ZEvent($this, '_triggerError', $e));
                     break;
             }
             break;
         case 2:
             $tr = debug_backtrace();
             $e = new ZException($a_arg0, $a_arg1);
             $e->setLine($tr[0]['line']);
             $e->setFile($tr[0]['file']);
             Zoombi::getApplication()->emit(new ZEvent($this, '_triggerError', $e));
             break;
     }
     return $this;
 }
 /**
  * Register exception
  * @param mixed $a_arg0
  * @param mixed $a_arg1
  * @param mixed $a_arg2
  * @return ZModule
  */
 public function &triggerError($a_arg0, $a_arg1 = null, $a_arg2 = null)
 {
     switch (func_num_args()) {
         case 1:
             switch (gettype($a_arg0)) {
                 case 'object':
                     if ($a_arg0 instanceof Exception) {
                         Zoombi::getApplication()->emit(new ZEvent($this, '_triggerError', $a_arg0));
                     }
                     break;
                 case 'string':
                     $tr = debug_backtrace();
                     $e = new ZException($a_arg0, E_USER_ERROR);
                     $e->setLine($tr[0]['line']);
                     $e->setFile($tr[0]['file']);
                     Zoombi::getApplication()->emit(new ZEvent($this, '_triggerError', $e));
                     break;
             }
             break;
         case 2:
             $tr = debug_backtrace();
             $e = new ZException($a_arg0, $a_arg1);
             $e->setLine($tr[0]['line']);
             $e->setFile($tr[0]['file']);
             Zoombi::getApplication()->emit(new ZEvent($this, '_triggerError', $e));
             break;
         case 3:
             $e = new ZException($a_arg0, $a_arg1);
             if ($a_arg2 and is_array($a_arg2) and count($a_arg2) > 0) {
                 $a =& $a_arg2[0];
                 if (is_array($a)) {
                     if (array_key_exists('line', $a)) {
                         $e->setLine($a['line']);
                     }
                     if (array_key_exists('file', $a)) {
                         $e->setFile($a['file']);
                     }
                     $e->setTrace($a_arg2);
                 }
             }
             Zoombi::getApplication()->emit(new ZEvent($this, '_triggerError', $e));
     }
     return $this;
 }
Example #3
0
 /**
  * Call unknown method
  * @param string $a_name
  * @param mixed $a_params
  * @return mixed
  */
 public function __call($a_name, $a_params)
 {
     foreach ($this->getPlugins() as $plugin) {
         if (method_exists($plugin, $a_name)) {
             return call_user_func_array(array(&$plugin, $a_name), $a_params);
         }
     }
     $t = debug_backtrace();
     $c =& $t[1];
     $e = new ZException();
     if ($c['file']) {
         $e->setFile($c['file']);
     }
     if ($c['line']) {
         $e->setLine($c['line']);
     }
     $e->setCode(ZException::EXC_NO_METHOD);
     $e->setMessage('Method not found' . ($c['class'] ? ' ' . $c['class'] . '::' : null) . $a_name);
     throw $e;
 }