Lines
0.00%
0 / 29
Functions and Methods
n/a
0 / 0
Classes and Traits
n/a
0 / 0
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | use Districts\Editor\Domain\DistrictRepository as DistrictRepositoryInterface; | |
| 6 | use Districts\Editor\Infrastructure\Doctrine\DistrictRepository; | |
| 7 | use Nyholm\Psr7\Factory\Psr17Factory; | |
| 8 | use Psr\Http\Message\ResponseFactoryInterface; | |
| 9 | use Psr\Http\Message\UriFactoryInterface; | |
| 10 | use Slim\App; | |
| 11 | use Slim\CallableResolver; | |
| 12 | use Slim\Interfaces\CallableResolverInterface; | |
| 13 | use Slim\Interfaces\RouteCollectorInterface; | |
| 14 | use Slim\Interfaces\RouteParserInterface; | |
| 15 | use Slim\Routing\RouteCollector; | |
| 16 | use Slim\Views\Twig; | |
| 17 | ||
| 18 | use function DI\get; | |
| 19 | ||
| 20 | return [ | |
| 21 | DistrictRepositoryInterface::class => get(DistrictRepository::class), | |
| 22 | ResponseFactoryInterface::class => get(Psr17Factory::class), | |
| 23 | UriFactoryInterface::class => get(Psr17Factory::class), | |
| 24 | CallableResolverInterface::class => static fn ($container) => new CallableResolver($container), | |
| 25 | RouteCollectorInterface::class => static fn ($container) => new RouteCollector( | |
| 26 | $container->get(ResponseFactoryInterface::class), | |
| 27 | $container->get(CallableResolverInterface::class), | |
| 28 | $container, | |
| 29 | ), | |
| 30 | RouteParserInterface::class => static fn ($cont) => $cont->get(RouteCollectorInterface::class)->getRouteParser(), | |
| 31 | // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter | |
| 32 | Twig::class => static function ($container) { | |
| 33 | $twig = Twig::create( | |
| 34 | __DIR__ . "/templates", | |
| 35 | [ | |
| 36 | "cache" => "/tmp/twig_cache", | |
| 37 | "auto_reload" => true, | |
| 38 | ] | |
| 39 | ); | |
| 40 | $twig["ASSETS_URL"] = (string) getenv("ASSETS_URL"); | |
| 41 | return $twig; | |
| 42 | }, | |
| 43 | App::class => static fn ($container) => new App( | |
| 44 | $container->get(ResponseFactoryInterface::class), | |
| 45 | null, | |
| 46 | $container->get(CallableResolverInterface::class), | |
| 47 | $container->get(RouteCollectorInterface::class), | |
| 48 | ), | |
| 49 | ]; |