-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigProvider.php
67 lines (56 loc) · 1.75 KB
/
ConfigProvider.php
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
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
declare(strict_types=1);
namespace AMC\ConsumerServices;
use AMC\ConsumerServices\BrokerClient\ClientFactory;
use AMC\ConsumerServices\Logger\StdOut;
use AMC\ConsumerServices\NameProvider\HumanNameProvider;
use AMC\ConsumerServices\NameProvider\HumanNameProviderFactory;
use Psr\Log\LoggerInterface;
use function DI\autowire;
use function DI\factory;
class ConfigProvider
{
public function __invoke(): array
{
return [
'container_definitions' => $this->getContainerDefinitions(),
self::class => [
BrokerClient\Client::class => $this->getBrokerClientConfig(),
NameProvider\HumanNameProvider::class => $this->getHumanNameProviderConfig(),
]
];
}
public function getContainerDefinitions(): array
{
return [
ServiceA::class => autowire(ServiceA::class),
ServiceB::class => autowire(ServiceB::class),
BrokerClient\ClientInterface::class => factory(ClientFactory::class),
NameProvider\NameProviderInterface::class => factory(HumanNameProviderFactory::class),
LoggerInterface::class => autowire(StdOut::class),
];
}
public function getHumanNameProviderConfig(): array
{
return [
HumanNameProvider::LIST_OF_NAMES => [
'Joao',
'Bram',
'Gabriel',
'Fehim',
'Eni',
'Patrick',
'Micha',
'Mirzet',
'Liliana',
'Sebastien',
],
];
}
public function getBrokerClientConfig(): array
{
return [
BrokerClient\Client::API_ADDRESS => 'http://amc.stavarengo.lc',
];
}
}