Ejemplo n.º 1
0
 /**
  * Invokes the application.
  *
  * @param TaskInterface $task
  *
  * @return string
  */
 private function dispatch(TaskInterface $task) : string
 {
     $handler = $task->handler();
     $args = $task->args();
     $instance = $this->container->create($handler);
     $payload = $this->container->call([$instance, 'execute'], $args);
     return $payload;
 }
Ejemplo n.º 2
0
 /**
  * Builds the view and executes the methods.
  *
  * @param string $class
  * @param array  $args
  *
  * @return mixed
  */
 private function build(string $class, array $args)
 {
     $instance = $this->container->create($class, $args);
     $payload = $this->container->call([$instance, 'execute'], $args);
     return $payload;
 }
Ejemplo n.º 3
0
 /**
  * Handles the given exception.
  *
  * @param \Exception        $exception
  * @param ResponseInterface $response
  * @param array             $args
  *
  * @return ResponseInterface
  */
 public function handle(\Exception $exception, ResponseInterface $response, array $args = []) : ResponseInterface
 {
     $type = get_class($exception);
     $args = array_merge(['exception' => $exception, 'response' => $response], $args);
     return $this->container->call($this->callbacks[$type], $args);
 }