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.
コード例 #1
0
 /**
  * @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] : []);
 }
コード例 #2
0
ファイル: App.php プロジェクト: sheerockoff/marabu
 /**
  * Внедрить зависимости (DI) в обработчик,
  * выполнить его и вернуть результат.
  *
  * @param callable|\Closure $handler
  * @param array $dependencies
  * @return mixed
  */
 protected function handle($handler, array $dependencies = [])
 {
     if ($handler !== null) {
         if ($handler instanceof \Closure) {
             $handler = $handler->bindTo($this->container);
         }
         return $this->container->call($handler, $dependencies);
     }
     return null;
 }
コード例 #3
0
ファイル: Container.php プロジェクト: pmill/doctrine-rest-api
 /**
  * @param $class
  * @param $method
  * @param array $params
  * @return mixed
  */
 public function call($class, $method, $params = [])
 {
     return $this->phpDiContainer->call([$class, $method], $params);
 }