Nette\DI\Container::callMethod PHP Метод

callMethod() публичный Метод

Calls method using autowiring.
public callMethod ( callable $function, array $args = [] ) : mixed
$function callable
$args array
Результат mixed
    public function callMethod(callable $function, array $args = [])
    {
        return $function(...Helpers::autowireArguments(Nette\Utils\Callback::toReflection($function), $args, $this));
    }

Usage Example

Пример #1
0
 /**
  * Create new presenter instance.
  * @param  string  presenter name
  * @return IPresenter
  */
 public function createPresenter($name)
 {
     $presenter = $this->container->createInstance($this->getPresenterClass($name));
     foreach (array_reverse(get_class_methods($presenter)) as $method) {
         if (substr($method, 0, 6) === 'inject') {
             $this->container->callMethod(array($presenter, $method));
         }
     }
     if ($presenter instanceof UI\Presenter && $presenter->invalidLinkMode === NULL) {
         $presenter->invalidLinkMode = $this->container->parameters['debugMode'] ? UI\Presenter::INVALID_LINK_WARNING : UI\Presenter::INVALID_LINK_SILENT;
     }
     return $presenter;
 }
All Usage Examples Of Nette\DI\Container::callMethod