|
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; |
|
21
|
|
|
use TYPO3\CMS\Core\Cache\CacheManager; |
|
22
|
|
|
use TYPO3\CMS\Core\Log\LogManager; |
|
23
|
|
|
use TYPO3\CMS\Core\Package\AbstractServiceProvider; |
|
24
|
|
|
use TYPO3\CMS\Core\Resource\ResourceFactory; |
|
25
|
|
|
use TYPO3\CMS\Core\TypoScript\TypoScriptService; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @internal |
|
29
|
|
|
*/ |
|
30
|
|
|
class ServiceProvider extends AbstractServiceProvider |
|
31
|
|
|
{ |
|
32
|
|
|
protected static function getPackagePath(): string |
|
33
|
|
|
{ |
|
34
|
|
|
return __DIR__ . '/../'; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function getFactories(): array |
|
38
|
|
|
{ |
|
39
|
|
|
return [ |
|
40
|
|
|
Object\Container\Container::class => [ static::class, 'getObjectContainer' ], |
|
41
|
|
|
Object\ObjectManager::class => [ static::class, 'getObjectManager' ], |
|
42
|
|
|
// @deprecated since v11, will be removed in v12 |
|
43
|
|
|
SignalSlot\Dispatcher::class => [ static::class, 'getSignalSlotDispatcher' ], |
|
44
|
|
|
Configuration\BackendConfigurationManager::class => [ static::class, 'getBackendConfigurationManager' ], |
|
45
|
|
|
Configuration\ConfigurationManager::class => [ static::class, 'getConfigurationManager' ], |
|
46
|
|
|
Reflection\ReflectionService::class => [ static::class, 'getReflectionService' ], |
|
47
|
|
|
// @deprecated since v11, will be removed in v12 |
|
48
|
|
|
Service\EnvironmentService::class => [ static::class, 'getEnvironmentService' ], |
|
49
|
|
|
Service\ExtensionService::class => [ static::class, 'getExtensionService' ], |
|
50
|
|
|
Service\ImageService::class => [ static::class, 'getImageService' ], |
|
51
|
|
|
Security\Cryptography\HashService::class => [ static::class, 'getHashService' ], |
|
52
|
|
|
]; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public static function getObjectContainer(ContainerInterface $container): Object\Container\Container |
|
56
|
|
|
{ |
|
57
|
|
|
return self::new($container, Object\Container\Container::class, [$container]); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public static function getObjectManager(ContainerInterface $container): Object\ObjectManager |
|
61
|
|
|
{ |
|
62
|
|
|
return self::new($container, Object\ObjectManager::class, [$container, $container->get(Object\Container\Container::class)]); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public static function getSignalSlotDispatcher(ContainerInterface $container): SignalSlot\Dispatcher |
|
66
|
|
|
{ |
|
67
|
|
|
$logger = $container->get(LogManager::class)->getLogger(SignalSlot\Dispatcher::class); |
|
68
|
|
|
return self::new($container, SignalSlot\Dispatcher::class, [$container->get(Object\ObjectManager::class), $logger]); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public static function getBackendConfigurationManager(ContainerInterface $container): Configuration\BackendConfigurationManager |
|
72
|
|
|
{ |
|
73
|
|
|
return self::new($container, Configuration\BackendConfigurationManager::class, [ |
|
74
|
|
|
$container->get(TypoScriptService::class), |
|
75
|
|
|
]); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public static function getConfigurationManager(ContainerInterface $container): Configuration\ConfigurationManager |
|
79
|
|
|
{ |
|
80
|
|
|
return self::new($container, Configuration\ConfigurationManager::class, [$container]); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public static function getReflectionService(ContainerInterface $container): Reflection\ReflectionService |
|
84
|
|
|
{ |
|
85
|
|
|
return self::new($container, Reflection\ReflectionService::class, [$container->get(CacheManager::class)]); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @deprecated since v11, will be removed in v12 |
|
90
|
|
|
*/ |
|
91
|
|
|
public static function getEnvironmentService(ContainerInterface $container): Service\EnvironmentService |
|
92
|
|
|
{ |
|
93
|
|
|
return self::new($container, Service\EnvironmentService::class); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public static function getExtensionService(ContainerInterface $container): Service\ExtensionService |
|
97
|
|
|
{ |
|
98
|
|
|
$extensionService = self::new($container, Service\ExtensionService::class); |
|
99
|
|
|
$extensionService->injectConfigurationManager($container->get(Configuration\ConfigurationManager::class)); |
|
100
|
|
|
return $extensionService; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public static function getImageService(ContainerInterface $container): Service\ImageService |
|
104
|
|
|
{ |
|
105
|
|
|
return self::new($container, Service\ImageService::class, [ |
|
106
|
|
|
$container->get(ResourceFactory::class) |
|
107
|
|
|
]); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public static function getHashService(ContainerInterface $container): Security\Cryptography\HashService |
|
111
|
|
|
{ |
|
112
|
|
|
return self::new($container, Security\Cryptography\HashService::class); |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|