Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Drupal\Core\DependencyInjection;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\Routing\RequestContext;
- use Drupal\Core\DrupalKernel;
- use Drupal\Core\Response\DrupalResponse;
- use Drupal\Core\Routes\DrupalRoutes;
- class DrupalPimpleContainer extends \Pimple {
- public function __construct() {
- $container = $this;
- $this['request'] = $this->share(
- function () {
- return Request::createFromGlobals();
- }
- );
- $this['context'] = $this->share(
- function ($container) {
- return new RequestContext($container['request']);
- }
- );
- $this['router'] = $this->share(
- function () {
- $router = new DrupalRoutes();
- return $router->getRoutes();
- }
- );
- $this['response'] = $this->share(
- function ($container) {
- return new DrupalResponse($container['context'], $container['router']);
- }
- );
- $this['kernel'] = $this->share(
- function ($container) {
- $kernel = new DrupalKernel($container['response']);
- return $kernel->handle($container['request']);
- }
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment