Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| MenuModuleServiceProvider | |
100.00% |
10 / 10 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getDefinitions | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| getExtensions | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Modules\Menu\Config; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Modules\Menu\Infrastructure\Repository\SqlMenuRepository; |
| 12 | use App\Modules\Menu\Presentation\Api\MenuApiController; |
| 13 | use Nyholm\Psr7\Factory\Psr17Factory; |
| 14 | use PDO; |
| 15 | use Twig\Environment as TwigEnvironment; |
| 16 | use Yiisoft\Di\ServiceProviderInterface; |
| 17 | |
| 18 | /** |
| 19 | * MenuModuleServiceProvider. |
| 20 | * |
| 21 | * Configures and registers menu navigation repository and REST API controller. |
| 22 | * |
| 23 | * @package App\Modules\Menu\Config |
| 24 | */ |
| 25 | final class MenuModuleServiceProvider implements ServiceProviderInterface |
| 26 | { |
| 27 | /** |
| 28 | * @return array<string, mixed> Definitions mapping for PSR-11 container. |
| 29 | */ |
| 30 | public function getDefinitions(): array |
| 31 | { |
| 32 | return [ |
| 33 | SqlMenuRepository::class => static fn(PDO $pdo): SqlMenuRepository => new SqlMenuRepository($pdo), |
| 34 | |
| 35 | MenuApiController::class => static fn( |
| 36 | Psr17Factory $psr17, |
| 37 | SqlMenuRepository $menuRepo, |
| 38 | PDO $pdo, |
| 39 | TwigEnvironment $twig |
| 40 | ): MenuApiController => new MenuApiController($psr17, $menuRepo, $pdo, $twig), |
| 41 | ]; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * @return array<string, mixed> Service extensions mapping. |
| 46 | */ |
| 47 | public function getExtensions(): array |
| 48 | { |
| 49 | return []; |
| 50 | } |
| 51 | } |