1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
namespace Laminas\Hydrator;
use Laminas\ServiceManager\ServiceManager;
use function class_exists;
class ConfigProvider
{
/**
* Return configuration for this component.
*
* @return mixed[]
*/
public function __invoke(): array
{
return [
'dependencies' => $this->getDependencyConfig(),
];
}
/**
* Return dependency mappings for this component.
*
* If laminas-servicemanager is installed, this will alias the HydratorPluginManager
* to the `HydratorManager` service; otherwise, it aliases the
* StandaloneHydratorPluginManager.
*
* @return string[][]
*/
public function getDependencyConfig(): array
{
$hydratorManagerTarget = class_exists(ServiceManager::class)
? HydratorPluginManager::class
: StandaloneHydratorPluginManager::class;
return [
'aliases' => [
'HydratorManager' => $hydratorManagerTarget,
// Legacy Zend Framework aliases
\Zend\Hydrator\HydratorPluginManager::class => HydratorPluginManager::class,
\Zend\Hydrator\StandaloneHydratorPluginManager::class => StandaloneHydratorPluginManager::class,
],
'factories' => [
HydratorPluginManager::class => HydratorPluginManagerFactory::class,
StandaloneHydratorPluginManager::class => StandaloneHydratorPluginManagerFactory::class,
],
];
}
}