Test Setup Failed
Push — master ( 8eb8d2...671183 )
by Churakov
04:26 queued 12s
created

PaginationHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
dl 0
loc 25
rs 10
c 1
b 0
f 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getNextUrl() 0 4 1
1
<?php
2
3
namespace ChurakovMike\EasyGrid\Helpers;
4
5
use Illuminate\Pagination\LengthAwarePaginator;
6
7
/**
8
 * Class PaginationHelper
9
 * @package ChurakovMike\EasyGrid\Helpers
10
 *
11
 * @property LengthAwarePaginator $paginator
12
 */
13
class PaginationHelper
14
{
15
    /**
16
     * @var LengthAwarePaginator $paginator
17
     */
18
    public $paginator;
19
20
    /**
21
     * PaginationHelper constructor.
22
     * @param LengthAwarePaginator $paginator
23
     */
24
    public function __construct(LengthAwarePaginator $paginator)
25
    {
26
        $this->paginator = $paginator;
27
    }
28
29
    /**
30
     * Build next page link with sort and filters.
31
     *
32
     * @return string
33
     */
34
    public function getNextUrl(): string
35
    {
36
        //TODO: доделать подстановку параметров
37
        return url()->current() . '/?page=' .  ($this->paginator->currentPage() - 1);
38
    }
39
}
40