‪TYPO3CMS  10.4
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;
30 
35 {
36  protected static function ‪getPackagePath(): string
37  {
38  return __DIR__ . '/../';
39  }
40 
41  public function ‪getFactories(): array
42  {
43  return [
44  Http\Application::class => [ static::class, 'getApplication' ],
45  Http\RequestHandler::class => [ static::class, 'getRequestHandler' ],
46  'frontend.middlewares' => [ static::class, 'getFrontendMiddlewares' ],
47  ];
48  }
49 
50  public static function ‪getApplication(ContainerInterface $container): Http\Application
51  {
52  $requestHandler = new ‪MiddlewareDispatcher(
53  $container->get(Http\RequestHandler::class),
54  $container->get('frontend.middlewares'),
55  $container
56  );
57  return new ‪Http\Application(
58  $requestHandler,
59  $container->get(ConfigurationManager::class),
60  $container->get(Context::class)
61  );
62  }
63 
64  public static function ‪getRequestHandler(ContainerInterface $container): Http\RequestHandler
65  {
66  return new ‪Http\RequestHandler($container->get(EventDispatcherInterface::class));
67  }
68 
75  public static function ‪getFrontendMiddlewares(ContainerInterface $container): ArrayObject
76  {
77  return new ArrayObject($container->get(MiddlewareStackResolver::class)->resolve('frontend'));
78  }
79 }
‪TYPO3\CMS\Core\Package\AbstractServiceProvider
Definition: AbstractServiceProvider.php:31
‪TYPO3\CMS\Frontend\ServiceProvider\getFactories
‪getFactories()
Definition: ServiceProvider.php:41
‪TYPO3\CMS\Core\Exception
‪TYPO3\CMS\Core\Http\MiddlewareStackResolver
Definition: MiddlewareStackResolver.php:33
‪TYPO3\CMS\Frontend\ServiceProvider\getPackagePath
‪static getPackagePath()
Definition: ServiceProvider.php:36
‪TYPO3\CMS\Frontend
Definition: LegacyClassesForIde.php:20
‪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:75
‪TYPO3\CMS\Core\Cache\Exception\InvalidDataException
Definition: InvalidDataException.php:24
‪TYPO3\CMS\Frontend\Http\RequestHandler
Definition: RequestHandler.php:66
‪TYPO3\CMS\Frontend\ServiceProvider\getApplication
‪static getApplication(ContainerInterface $container)
Definition: ServiceProvider.php:50
‪TYPO3\CMS\Frontend\Http\Application
Definition: Application.php:38
‪TYPO3\CMS\Frontend\ServiceProvider
Definition: ServiceProvider.php:35
‪TYPO3\CMS\Frontend\ServiceProvider\getRequestHandler
‪static getRequestHandler(ContainerInterface $container)
Definition: ServiceProvider.php:64