| Total Complexity | 5 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class CommentController |
||
| 14 | { |
||
| 15 | private ViewRenderer $viewRenderer; |
||
| 16 | |||
| 17 | public function __construct(ViewRenderer $viewRenderer) |
||
| 20 | } |
||
| 21 | |||
| 22 | public function index(Request $request, CommentService $service, CurrentRoute $currentRoute): Response |
||
| 23 | { |
||
| 24 | $paginator = $service->getFeedPaginator(); |
||
| 25 | if ($currentRoute->getArgument('next') !== null) { |
||
| 26 | $paginator = $paginator->withNextPageToken((string)$currentRoute->getArgument('next')); |
||
| 27 | } |
||
| 28 | |||
| 29 | if ($this->isAjaxRequest($request)) { |
||
| 30 | return $this->viewRenderer->renderPartial('_comments', ['data' => $paginator]); |
||
| 31 | } |
||
| 32 | |||
| 33 | return $this->viewRenderer->render('index', ['data' => $paginator]); |
||
| 34 | } |
||
| 35 | |||
| 36 | private function isAjaxRequest(Request $request): bool |
||
| 39 | } |
||
| 40 | } |
||
| 41 |