/**
  * {@inheritdoc}
  */
 public function bootstrap(Application $app)
 {
     StaticalProxy::clearResolvedInstances();
     StaticalProxy::setContainer($app);
     (new AliasLoader($app->get(ConfigManager::class)->get('app.aliases', [])))->register();
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function handle(ServerRequestInterface $request, ResponseInterface $response = null) : ResponseInterface
 {
     // Passes the request to the container
     $this->app->instance(ServerRequestInterface::class, $request);
     StaticalProxy::clearResolvedInstance('request');
     $this->events->trigger(self::REQUEST, [$request]);
     if ($response === null) {
         $response = (new ResponseFactory())->createResponse();
     }
     $this->app->instance(ResponseInterface::class, $response);
     StaticalProxy::clearResolvedInstance('response');
     $response = $this->handleRequest($request, $response);
     // stop PHP sending a Content-Type automatically
     ini_set('default_mimetype', '');
     return $response;
 }
 public static function createStaticalProxy(ContainerInterface $container) : StaticalProxy
 {
     StaticalProxy::setContainer($container);
     return new StaticalProxy();
 }