DefaultPaginatorResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getResult() 0 11 1
1
<?php
2
3
namespace Bugloos\ResponderBundle\Service;
4
5
use Bugloos\ResponderBundle\PaginatorHandler\Contract\PaginatorHandlerInterface;
6
class DefaultPaginatorResponse implements PaginatorResponseInterface
7
{
8
    public function getResult(PaginatorHandlerInterface $paginatorHandler, Paginator $paginator): array
9
    {
10
        return [
11
            'pagination' => [
12
                'totalPages' => $paginatorHandler->totalPages(),
13
                'totalItems' => $paginatorHandler->totalItems(),
14
                'count' => $paginator->count(),
15
                'itemsPerPage' => $paginatorHandler->numberOfItemsPerPage(),
16
                'page' => $paginator->getRequestedPageNumber(),
17
            ],
18
            'data' => $paginator->collection(),
19
        ];
20
    }
21
}
22