Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| GetFundDetailAction | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __invoke | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Action\Fund; |
| 6 | |
| 7 | use App\Domain\Funds\Service\InvestorFundsService; |
| 8 | use App\Renderer\JsonRenderer; |
| 9 | use Psr\Http\Message\ResponseInterface; |
| 10 | use Psr\Http\Message\ServerRequestInterface; |
| 11 | |
| 12 | final readonly class GetFundDetailAction |
| 13 | { |
| 14 | public function __construct( |
| 15 | private InvestorFundsService $service, |
| 16 | private JsonRenderer $renderer, |
| 17 | ) {} |
| 18 | |
| 19 | /** |
| 20 | * @param array<string, string> $args |
| 21 | */ |
| 22 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $args): ResponseInterface |
| 23 | { |
| 24 | $fundId = (string)($args['id'] ?? ''); |
| 25 | $result = $this->service->getPublishedFundDetail( |
| 26 | fundId: $fundId, |
| 27 | userId: (int)$request->getAttribute('userId'), |
| 28 | ); |
| 29 | |
| 30 | return $this->renderer->json($response, [ |
| 31 | 'success' => true, |
| 32 | 'data' => $result, |
| 33 | ]); |
| 34 | } |
| 35 | } |
| 36 |