HasQueryPagination   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A paginate() 0 8 2
1
<?php
2
3
namespace Reviewsio\Endpoints;
4
5
use Illuminate\Pagination\Paginator;
6
7
trait HasQueryPagination
8
{
9
    use HasGetQuery;
10
11 2
    public function paginate(int $perPage = 15, ?int $page = null, string $pageName = 'page'): static
12
    {
13 2
        $page = $page ?: Paginator::resolveCurrentPage($pageName);
14
15 2
        $this->addParameterToQuery('per_page', $perPage)
16 2
             ->addParameterToQuery('page', $page);
17
18 2
        return $this;
19
    }
20
}
21