-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigProvider.php
47 lines (41 loc) · 1.62 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
<?php
namespace TravelSorter\App;
/**
* The configuration provider for the App module
*/
class ConfigProvider
{
public function __invoke()
{
return [
'container_definitions' => $this->getContainerDefinitions(),
self::class => [
BasePathDetector\BasePathDetectorInterface::class => $this->getBasePathDetectorConfig(),
Dispatcher\DispatcherInterface::class => $this->getDispatcherConfig(),
]
];
}
public function getContainerDefinitions(): array
{
return [
BasePathDetector\BasePathDetectorInterface::class => \DI\factory(BasePathDetector\BasePathDetectorFactory::class),
Dispatcher\DispatcherInterface::class => \DI\factory(Dispatcher\DispatcherFactory::class),
TicketsSorter\TicketsSorterInterface::class => \DI\autowire(TicketsSorter\SortByConnectionsBetweenTickets::class),
TicketsSorter\TicketValidatorInterface::class => \DI\autowire(TicketsSorter\TicketValidator::class),
RouteDetector\RouteDetectorInterface::class => \DI\autowire(RouteDetector\RouteDetector::class),
];
}
public function getBasePathDetectorConfig(): array
{
return [
BasePathDetector\BasePathDetectorInterface::CONFIG_PUBLIC_DIRECTORY => realpath(__DIR__ . '/../../public'),
BasePathDetector\BasePathDetectorInterface::CONFIG_DOCUMENT_ROOT => $_SERVER['DOCUMENT_ROOT'],
];
}
public function getDispatcherConfig(): array
{
return [
Dispatcher\DispatcherInterface::REQUEST_HANDLER_MAP => []
];
}
}