Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function loadmore($initial = 4, $loadMore = 16) |
||
18 | { |
||
19 | $page = (int) Paginator::resolveCurrentPage(); |
||
20 | $perPage = ($page == 1) ? $initial : $loadMore; |
||
21 | $skip = ($page == 1) ? 0 : ($initial + ($loadMore * ($page - 2))); |
||
22 | $items = $this->skip($skip)->take($perPage)->get(); |
||
|
|||
23 | $total = $this->count() + $loadMore - $initial; |
||
24 | |||
25 | return new LengthAwarePaginator( |
||
26 | $items, |
||
27 | $total, |
||
28 | $loadMore, |
||
29 | Paginator::resolveCurrentPage(), |
||
30 | ['path' => Paginator::resolveCurrentPath()] |
||
31 | ); |
||
32 | } |
||
33 | |||
47 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.