示例#1
0
 /**
  * {@inheritdoc}
  */
 public function run(ServerRequestInterface $request) : ResponseInterface
 {
     if ($this->isControllerAction()) {
         return $this->getController()->{$this->getControllerMethod()}();
     }
     return $this->invoker->call($this->action['uses'], [$request, $this->parameters]);
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function dispatch($command, Closure $afterResolving = null)
 {
     return $this->pipeline->send($command)->through($this->pipes)->then(function ($command) use($afterResolving) {
         if (method_exists($command, $this->method)) {
             return $this->invoker->call([$command, $this->method]);
         }
         $handler = $this->resolveHandler($command);
         if ($afterResolving) {
             call_user_func($afterResolving, $handler);
         }
         return call_user_func([$handler, $this->getHandlerMethod($command)], $command);
     });
 }
示例#3
0
 /**
  * {@inhertidoc}
  */
 public function trigger(string $eventName, array $arguments = []) : bool
 {
     $listeners = $this->getListeners($eventName);
     foreach ($listeners as $listener) {
         $result = false;
         if ($listener !== null) {
             $result = $this->invoker->call($listener, $arguments);
         }
         if ($result === false) {
             return false;
         }
     }
     return true;
 }