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