callable = $callable; } /** * * Invokes the closure (which may return a value). * * @return mixed The value returned by the invoked callable (if any). * */ public function __invoke() { if ($this->callableChecked === false) { // convert Lazy objects in the callable if (is_array($this->callable)) { foreach ($this->callable as $key => $val) { if ($val instanceof LazyInterface) { $this->callable[$key] = $val(); } } } elseif ($this->callable instanceof LazyInterface) { $this->callable = $this->callable->__invoke(); } $this->callableChecked = true; } // make the call return call_user_func_array($this->callable, func_get_args()); } }