EventsController::lastAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Skobkin\Bundle\PointToolsBundle\Controller;
4
5
use Knp\Component\Pager\PaginatorInterface;
6
use Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionEventRepository;
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\HttpFoundation\{Request, Response};
9
10
class EventsController extends AbstractController
11
{
12 2
    public function lastAction(Request $request, SubscriptionEventRepository $eventRepository, PaginatorInterface $paginator): Response
13
    {
14
        $eventsPagination = $paginator->paginate(
15 2
            $eventRepository->createLastSubscriptionEventsQuery(),
16
            $request->query->getInt('page', 1),
17 2
            20
18
        );
19 2
20 2
        return $this->render('SkobkinPointToolsBundle:Events:last.html.twig', [
21 2
            'last_events' => $eventsPagination,
22 2
        ]);
23
    }
24
}
25