Total Complexity | 5 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | final class CommentController extends Controller |
||
13 | { |
||
14 | protected function getId(): string |
||
15 | { |
||
16 | return 'blog/comments'; |
||
17 | } |
||
18 | |||
19 | public function index(Request $request, CommentService $service): Response |
||
20 | { |
||
21 | $paginator = $service->getFeedPaginator(); |
||
22 | if ($request->getAttribute('next') !== null) { |
||
23 | $paginator = $paginator->withNextPageToken((string)$request->getAttribute('next')); |
||
24 | } |
||
25 | |||
26 | if ($this->isAjaxRequest($request)) { |
||
27 | return $this->renderPartial('_comments', ['data' => $paginator]); |
||
28 | } |
||
29 | |||
30 | return $this->render('index', ['data' => $paginator]); |
||
31 | } |
||
32 | |||
33 | private function isAjaxRequest(Request $request): bool |
||
36 | } |
||
37 | } |
||
38 |