‪TYPO3CMS  ‪main
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\Extbase;
19 
20 use Psr\Container\ContainerInterface;
25 
30 {
31  protected static function ‪getPackagePath(): string
32  {
33  return __DIR__ . '/../';
34  }
35 
36  protected static function ‪getPackageName(): string
37  {
38  return 'typo3/cms-extbase';
39  }
40 
41  public function ‪getFactories(): array
42  {
43  return [
44  Configuration\ConfigurationManager::class => ‪self::getConfigurationManager(...),
45  Reflection\ReflectionService::class => ‪self::getReflectionService(...),
46  Service\ExtensionService::class => ‪self::getExtensionService(...),
47  Service\ImageService::class => ‪self::getImageService(...),
48  Security\Cryptography\HashService::class => ‪self::getHashService(...),
49  ];
50  }
51 
52  public static function ‪getConfigurationManager(ContainerInterface $container): Configuration\ConfigurationManager
53  {
54  return ‪self::new($container, Configuration\ConfigurationManager::class, [$container]);
55  }
56 
57  public static function ‪getReflectionService(ContainerInterface $container): Reflection\ReflectionService
58  {
59  return ‪self::new(
60  $container,
61  Reflection\ReflectionService::class,
62  [
63  $container->get(CacheManager::class)->getCache('extbase'),
64  $container->get(PackageDependentCacheIdentifier::class)->withPrefix('ClassSchemata')->toString(),
65  ]
66  );
67  }
68 
69  public static function ‪getExtensionService(ContainerInterface $container): Service\ExtensionService
70  {
71  $extensionService = ‪self::new($container, Service\ExtensionService::class);
72  // This ensures ExtensionService always gets the current (!) ConfigurationManager
73  // injected a-new, each time it is injected itself.
74  $extensionService->injectConfigurationManager($container->get(Configuration\ConfigurationManager::class));
75  return $extensionService;
76  }
77 
78  public static function ‪getImageService(ContainerInterface $container): Service\ImageService
79  {
80  return ‪self::new($container, Service\ImageService::class, [
81  $container->get(ResourceFactory::class),
82  ]);
83  }
84 
85  public static function ‪getHashService(ContainerInterface $container): Security\Cryptography\HashService
86  {
87  return ‪self::new($container, Security\Cryptography\HashService::class);
88  }
89 }
‪TYPO3\CMS\Extbase\ServiceProvider\getImageService
‪static getImageService(ContainerInterface $container)
Definition: ServiceProvider.php:78
‪TYPO3\CMS\Core\Package\AbstractServiceProvider
Definition: AbstractServiceProvider.php:38
‪TYPO3\CMS\Core\Package\Cache\PackageDependentCacheIdentifier
Definition: PackageDependentCacheIdentifier.php:30
‪TYPO3\CMS\Core\Package\AbstractServiceProvider\new
‪static mixed new(ContainerInterface $container, string $className, array $constructorArguments=[])
Definition: AbstractServiceProvider.php:220
‪TYPO3\CMS\Extbase\ServiceProvider\getPackagePath
‪static getPackagePath()
Definition: ServiceProvider.php:31
‪TYPO3\CMS\Extbase\ServiceProvider\getPackageName
‪static getPackageName()
Definition: ServiceProvider.php:36
‪TYPO3\CMS\Extbase
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:42
‪TYPO3\CMS\Core\Cache\CacheManager
Definition: CacheManager.php:36
‪TYPO3\CMS\Extbase\ServiceProvider\getExtensionService
‪static getExtensionService(ContainerInterface $container)
Definition: ServiceProvider.php:69
‪TYPO3\CMS\Extbase\ServiceProvider\getFactories
‪getFactories()
Definition: ServiceProvider.php:41
‪TYPO3\CMS\Extbase\ServiceProvider\getConfigurationManager
‪static getConfigurationManager(ContainerInterface $container)
Definition: ServiceProvider.php:52
‪TYPO3\CMS\Extbase\ServiceProvider
Definition: ServiceProvider.php:30
‪TYPO3\CMS\Extbase\ServiceProvider\getReflectionService
‪static getReflectionService(ContainerInterface $container)
Definition: ServiceProvider.php:57
‪TYPO3\CMS\Extbase\ServiceProvider\getHashService
‪static getHashService(ContainerInterface $container)
Definition: ServiceProvider.php:85