‪TYPO3CMS  11.5
ServiceProvider.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 namespace ‪TYPO3\CMS\Frontend;
19 
20 use ArrayObject;
21 use Psr\Container\ContainerInterface;
22 use Psr\EventDispatcher\EventDispatcherInterface;
24 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
31 
36 {
37  protected static function ‪getPackagePath(): string
38  {
39  return __DIR__ . '/../';
40  }
41 
42  public function ‪getFactories(): array
43  {
44  return [
45  Http\Application::class => [ static::class, 'getApplication' ],
46  Http\RequestHandler::class => [ static::class, 'getRequestHandler' ],
47  'frontend.middlewares' => [ static::class, 'getFrontendMiddlewares' ],
48  ];
49  }
50 
51  public static function ‪getApplication(ContainerInterface $container): Http\Application
52  {
53  $requestHandler = new ‪MiddlewareDispatcher(
54  $container->get(Http\RequestHandler::class),
55  $container->get('frontend.middlewares'),
56  $container
57  );
58  return new ‪Http\Application(
59  $requestHandler,
60  $container->get(ConfigurationManager::class),
61  $container->get(Context::class)
62  );
63  }
64 
65  public static function ‪getRequestHandler(ContainerInterface $container): Http\RequestHandler
66  {
67  return new ‪Http\RequestHandler(
68  $container->get(EventDispatcherInterface::class),
69  $container->get(ListenerProvider::class)
70  );
71  }
72 
79  public static function ‪getFrontendMiddlewares(ContainerInterface $container): ArrayObject
80  {
81  return new ArrayObject($container->get(MiddlewareStackResolver::class)->resolve('frontend'));
82  }
83 }
‪TYPO3\CMS\Core\Package\AbstractServiceProvider
Definition: AbstractServiceProvider.php:31
‪TYPO3\CMS\Frontend\ServiceProvider\getFactories
‪getFactories()
Definition: ServiceProvider.php:42
‪TYPO3\CMS\Core\Exception
‪TYPO3\CMS\Core\Http\MiddlewareStackResolver
Definition: MiddlewareStackResolver.php:32
‪TYPO3\CMS\Frontend\ServiceProvider\getPackagePath
‪static getPackagePath()
Definition: ServiceProvider.php:37
‪TYPO3\CMS\Frontend
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:53
‪TYPO3\CMS\Core\Http\MiddlewareDispatcher
Definition: MiddlewareDispatcher.php:35
‪TYPO3\CMS\Frontend\ServiceProvider\getFrontendMiddlewares
‪static ArrayObject getFrontendMiddlewares(ContainerInterface $container)
Definition: ServiceProvider.php:79
‪TYPO3\CMS\Core\Cache\Exception\InvalidDataException
Definition: InvalidDataException.php:23
‪TYPO3\CMS\Frontend\Http\RequestHandler
Definition: RequestHandler.php:68
‪TYPO3\CMS\Frontend\ServiceProvider\getApplication
‪static getApplication(ContainerInterface $container)
Definition: ServiceProvider.php:51
‪TYPO3\CMS\Frontend\Http\Application
Definition: Application.php:38
‪TYPO3\CMS\Core\EventDispatcher\ListenerProvider
Definition: ListenerProvider.php:30
‪TYPO3\CMS\Frontend\ServiceProvider
Definition: ServiceProvider.php:36
‪TYPO3\CMS\Frontend\ServiceProvider\getRequestHandler
‪static getRequestHandler(ContainerInterface $container)
Definition: ServiceProvider.php:65