Pageable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A enablePaginator() 0 9 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zing\QueryBuilder\Concerns;
6
7
use Zing\QueryBuilder\Paginator;
8
9
trait Pageable
10
{
11
    /**
12
     * @param string|\Zing\QueryBuilder\Paginator $paginator
13
     *
14
     * @return $this
15
     */
16 7
    public function enablePaginator($paginator = null)
17
    {
18 7
        $paginator = $paginator instanceof Paginator ? $paginator : Paginator::name($paginator);
19 7
        $perPage = $this->request->input($paginator->getName()) ?: $paginator->getDefault();
20 7
        $this->getBuilder()
0 ignored issues
show
Bug introduced by
It seems like getBuilder() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $this->/** @scrutinizer ignore-call */ 
21
               getBuilder()
Loading history...
21 7
            ->getModel()
22 7
            ->setPerPage($perPage);
23
24 7
        return $this;
25
    }
26
}
27