Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function bootstrap(ContainerInterface $container, ErrorHandlerInterface $errors, EventEmitterInterface $events)
 {
     $this->handler->register();
     $this->handler->start();
     $this->accessor = new SessionAccessor(new \ArrayObject($_SESSION));
     $this->control = new SessionControl($this->accessor);
     /*
      * Bind the accessor and control instance to the request
      * application wide.
      */
     $container->bind($this->accessor, SessionAccessorInterface::class);
     $container->bind($this->control, SessionControlInterface::class);
 }
Пример #2
0
 /**
  * Checks the return type of the controller payload
  * to determine how the response should be
  * interpreted.
  *
  * @param ResponseInterface $response
  * @param string            $class
  * @param array             $bindings
  *
  * @return ResponseInterface
  */
 private function invokeView(ResponseInterface $response, string $class, array $bindings) : ResponseInterface
 {
     /**
      * @var ActionView $payload
      */
     $instance = $this->container->create($class, $bindings);
     $payload = $this->container->call([$instance, 'execute'], [$response]);
     if (!$payload instanceof ResponseInterface) {
         return $this->transform($response, $payload);
     }
     return $payload;
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function expand(ContainerInterface $container)
 {
     return $container->create($this->class, $this->args);
 }
Пример #4
0
 /**
  * Bootstraps the application by running configurations specific for
  * the module.
  *
  * @param ContainerInterface    $container
  * @param ErrorHandlerInterface $errors
  * @param EventEmitterInterface $events
  *
  * @return void
  */
 public function bootstrap(ContainerInterface $container, ErrorHandlerInterface $errors, EventEmitterInterface $events)
 {
     $container->bind(new CookieAccessor($_COOKIE), CookieAccessorInterface::class);
 }