本文整理汇总了PHP中yii\base\Object::__call方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::__call方法的具体用法?PHP Object::__call怎么用?PHP Object::__call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Object
的用法示例。
在下文中一共展示了Object::__call方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
/**
* 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: __call
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);
}
示例3: __call
/**
* 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: __call
/**
* @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);
}