| Total Complexity | 3 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class SiteFactory |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Return the current site, dilps or tiresias, from the request host name. |
||
| 15 | */ |
||
| 16 | 1 | public function __invoke(ContainerInterface $container): Site |
|
| 17 | { |
||
| 18 | /** @var callable $requestFactory */ |
||
| 19 | 1 | $requestFactory = $container->get(ServerRequestInterface::class); |
|
| 20 | /** @var ServerRequestInterface $request */ |
||
| 21 | 1 | $request = $requestFactory(); |
|
| 22 | |||
| 23 | 1 | return self::getSite($request->getServerParams()['SERVER_NAME'] ?? ''); |
|
| 24 | } |
||
| 25 | |||
| 26 | 8 | public static function getSite(string $serverName): Site |
|
| 33 | } |
||
| 34 | } |
||
| 35 |