DI\Container::call PHP Method

call() public method

Missing parameters will be resolved from the container.
public call ( callable $callable, array $parameters = [] ) : mixed
$callable callable Function to call.
$parameters array Parameters to use. Can be indexed by the parameter names or not indexed (same order as the parameters). The array can also contain DI definitions, e.g. DI\get().
return mixed Result of the function.
    public function call($callable, array $parameters = [])
    {
        return $this->getInvoker()->call($callable, $parameters);
    }

Usage Example

 /**
  * @param InvokeAction $message
  * @param mixed        $actionResult
  *
  * @return void
  */
 private function respond(InvokeAction $message, $actionResult)
 {
     if ($message->action->getResponder() === null) {
         return;
     }
     $this->container->call($message->action->getResponder(), $actionResult ? ['data' => $actionResult] : []);
 }
All Usage Examples Of DI\Container::call