Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
97.22% |
35 / 36 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| AboutModuleServiceProvider | |
97.14% |
34 / 35 |
|
50.00% |
1 / 2 |
2 | |
0.00% |
0 / 1 |
| getDefinitions | |
97.06% |
33 / 34 |
|
0.00% |
0 / 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\About\Config; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Modules\About\Application\DataSource\AboutLicensesDataProvider; |
| 12 | use App\Modules\About\Application\DataSource\AboutRequirementsDataProvider; |
| 13 | use App\Modules\About\Application\Service\SystemDiagnosticsService; |
| 14 | use App\Modules\About\Application\Service\SystemDiagnosticsServiceInterface; |
| 15 | use App\Modules\About\Domain\Repository\SystemRequirementsRepositoryInterface; |
| 16 | use App\Modules\About\Infrastructure\Repository\SqlSystemRequirementsRepository; |
| 17 | use App\Modules\About\Presentation\Api\AboutLicensesApiController; |
| 18 | use App\Modules\About\Presentation\Api\AboutRequirementsApiController; |
| 19 | use Nyholm\Psr7\Factory\Psr17Factory; |
| 20 | use PDO; |
| 21 | use Twig\Environment as TwigEnvironment; |
| 22 | use Yiisoft\Di\ServiceProviderInterface; |
| 23 | |
| 24 | /** |
| 25 | * AboutModuleServiceProvider. |
| 26 | * |
| 27 | * Configures and registers system diagnostics, benchmarks, requirements, and licenses API services. |
| 28 | * |
| 29 | * @package App\Modules\About\Config |
| 30 | */ |
| 31 | final class AboutModuleServiceProvider implements ServiceProviderInterface |
| 32 | { |
| 33 | /** |
| 34 | * @return array<string, mixed> Definitions mapping for PSR-11 container. |
| 35 | */ |
| 36 | public function getDefinitions(): array |
| 37 | { |
| 38 | return [ |
| 39 | SqlSystemRequirementsRepository::class => static fn( |
| 40 | PDO $pdo |
| 41 | ): SqlSystemRequirementsRepository => new SqlSystemRequirementsRepository($pdo), |
| 42 | |
| 43 | SystemRequirementsRepositoryInterface::class => static fn( |
| 44 | SqlSystemRequirementsRepository $r |
| 45 | ): SystemRequirementsRepositoryInterface => $r, |
| 46 | |
| 47 | SystemDiagnosticsService::class => static fn( |
| 48 | SqlSystemRequirementsRepository $repo, |
| 49 | PDO $pdo |
| 50 | ): SystemDiagnosticsService => new SystemDiagnosticsService( |
| 51 | $repo, |
| 52 | $pdo, |
| 53 | dirname(__DIR__, 4) |
| 54 | ), |
| 55 | |
| 56 | SystemDiagnosticsServiceInterface::class => static fn( |
| 57 | SystemDiagnosticsService $s |
| 58 | ): SystemDiagnosticsServiceInterface => $s, |
| 59 | |
| 60 | AboutRequirementsApiController::class => static fn( |
| 61 | Psr17Factory $psr17, |
| 62 | SystemDiagnosticsService $diagnostics |
| 63 | ): AboutRequirementsApiController => new AboutRequirementsApiController($psr17, $diagnostics), |
| 64 | |
| 65 | AboutLicensesApiController::class => static fn( |
| 66 | Psr17Factory $psr17, |
| 67 | PDO $pdo, |
| 68 | TwigEnvironment $twig |
| 69 | ): AboutLicensesApiController => new AboutLicensesApiController($psr17, $pdo, $twig), |
| 70 | |
| 71 | AboutLicensesDataProvider::class => static fn(): AboutLicensesDataProvider => ( |
| 72 | new AboutLicensesDataProvider() |
| 73 | ), |
| 74 | |
| 75 | AboutRequirementsDataProvider::class => static fn( |
| 76 | SystemDiagnosticsService $d |
| 77 | ): AboutRequirementsDataProvider => new AboutRequirementsDataProvider($d), |
| 78 | ]; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * @return array<string, mixed> Service extensions mapping. |
| 83 | */ |
| 84 | public function getExtensions(): array |
| 85 | { |
| 86 | return []; |
| 87 | } |
| 88 | } |