本文整理汇总了PHP中Executor::callClosure方法的典型用法代码示例。如果您正苦于以下问题:PHP Executor::callClosure方法的具体用法?PHP Executor::callClosure怎么用?PHP Executor::callClosure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Executor
的用法示例。
在下文中一共展示了Executor::callClosure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
/**
* Catch all calls, fire events and remap to real instance
*
* @access public
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, array $args = array())
{
$event = $this->observer->createEvent()->setMethod($method)->setParams($args)->setInstance($this)->setType('before');
$before = $this->observer->trigger()->getResult();
if ($event->isPropagationStopped()) {
return $before;
}
/** @var \Closure $closure */
if ($closure = $this->observer->bound($method)) {
$callback = $closure->bindTo($this, $this);
$result = Executor::callClosure($callback, $event->getParams());
} else {
$result = Executor::call($this(true), $method, $event->getParams());
}
$event->setType('after')->setResult($result);
return $this->observer->trigger()->getResult();
}