Пример #1
0
 public function __call($name, $parameters)
 {
     if (method_exists($this, 'format' . $name)) {
         return call_user_func_array(array($this, 'format' . $name), $parameters);
     } else {
         if (function_exists($name)) {
             return call_user_func_array($name, $parameters);
         }
     }
     return parent::__call($name, $parameters);
 }
Пример #2
0
 /**
  * Calls the run formatter method when its shortcut is invoked.
  * @param string $name the method name.
  * @param array $parameters method parameters.
  * @return mixed the method return value.
  */
 public function __call($name, $parameters)
 {
     $args = $parameters;
     array_unshift($args, $name);
     if ($this->isFormatter($name)) {
         return call_user_func_array(array($this, 'runFormatter'), $args);
     } else {
         if (is_callable($name)) {
             return call_user_func_array(array($this, 'formatInline'), $args);
         } else {
             return parent::__call($name, $parameters);
         }
     }
 }