| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2.0625 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public function index(Request $request, CommentService $commentService, CurrentRoute $currentRoute): Response |
||
| 24 | 1 | { |
|
| 25 | 1 | $body = $request->getParsedBody(); |
|
| 26 | $paginator = $commentService->getFeedPaginator(); |
||
| 27 | |||
| 28 | $pageSize = (int) $currentRoute->getArgument( |
||
| 29 | 1 | 'pagesize', |
|
| 30 | $body['pageSize'] ?? (string) PaginatorInterface::DEFAULT_PAGE_SIZE, |
||
| 31 | ); |
||
| 32 | |||
| 33 | 1 | $paginator = $paginator->withPageSize($pageSize); |
|
| 34 | |||
| 35 | if ($currentRoute->getArgument('page') !== null) { |
||
| 36 | 1 | $paginator = $paginator |
|
| 37 | ->withNextPageToken((string) $currentRoute->getArgument('page')) |
||
| 38 | 1 | ->withPageSize($pageSize); |
|
| 39 | } |
||
| 40 | |||
| 41 | return $this->viewRenderer->render('index', ['paginator' => $paginator]); |
||
| 42 | } |
||
| 44 |