maurobonfietti/api-rest-slimphp

View on GitHub
src/App/Repositories.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

declare(strict_types=1);

use App\Repository\NoteRepository;
use App\Repository\TaskRepository;
use App\Repository\UserRepository;
use Psr\Container\ContainerInterface;

$container['user_repository'] = static fn (
    ContainerInterface $container
): UserRepository => new UserRepository($container->get('db'));

$container['task_repository'] = static fn (
    ContainerInterface $container
): TaskRepository => new TaskRepository($container->get('db'));

$container['note_repository'] = static fn (
    ContainerInterface $container
): NoteRepository => new NoteRepository($container->get('db'));