__call() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown method is being invoked.
public __call ( string $name, array $params ) : mixed
$name string the method name
$params array method parameters
return mixed the method return value
示例#1
0
 /**
  * Calls the named method which is not a class method.
  *
  * Do not call this method directly as it is a PHP magic method that
  * will be implicitly called when an unknown method is being invoked.
  * @param string $method the method name
  * @param array $params method parameters
  * @throws UnknownMethodException when calling unknown method
  * @return mixed the method return value
  */
 public function __call($method, $params)
 {
     // TODO: Change the autogenerated stub
     if (method_exists($this->instance, $method)) {
         return call_user_func_array([$this->instance, $method], $params);
     }
     parent::__call($method, $params);
 }
示例#2
0
 public function __call($name, $parameters)
 {
     // check methods of xs
     if ($this->xs !== null && method_exists($this->xs, $name)) {
         return call_user_func_array(array($this->xs, $name), $parameters);
     }
     // check methods of index object
     if ($this->xs !== null && method_exists(__NAMESPACE__ . '\\XSIndex', $name)) {
         $ret = call_user_func_array(array($this->xs->index, $name), $parameters);
         if ($ret === $this->xs->index) {
             return $this;
         }
         return $ret;
     }
     // check methods of search object
     if ($this->xs !== null && method_exists(__NAMESPACE__ . '\\XSSearch', $name)) {
         $ret = call_user_func_array(array($this->xs->search, $name), $parameters);
         if ($ret === $this->xs->search) {
             return $this;
         }
         return $ret;
     }
     return parent::__call($name, $parameters);
 }
 /**
  * Calls the named method which is not a class method.
  *
  * Do not call this method directly as it is a PHP magic method that
  * will be implicitly called when an unknown method is being invoked.
  *
  * @param string $name the method name
  * @param array $arguments method parameters
  *
  * @return mixed the method return value
  */
 public function __call($name, $arguments)
 {
     if ($name === 'default') {
         return call_user_func_array([$this, '_default'], $arguments);
     }
     return parent::__call($name, $arguments);
 }
示例#4
0
 /**
  * @param string $name
  * @param array $params
  * @return mixed
  */
 public function __call($name, $params)
 {
     $property = lcfirst(substr($name, 3));
     if (substr($name, 0, 3) === 'get') {
         if (isset($this->params[$property])) {
             return $this->params[$property];
         } elseif (isset($params[0])) {
             return $params[0];
         }
     } elseif (substr($name, 0, 3) === 'has') {
         return isset($this->params[$property]);
     }
     return parent::__call($name, $params);
 }