Paginator::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 4
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Sulao\LRTS\Pagination;
4
5
use Sulao\LRTS\Helper;
6
7
class Paginator extends \Illuminate\Pagination\Paginator
8
{
9
    /**
10
     * Create a new paginator instance.
11
     *
12
     * @param mixed    $items
13
     * @param int      $perPage
14
     * @param int|null $currentPage
15
     * @param array    $options     (path, query, fragment, pageName)
16
     *
17
     * @return void
18
     */
19
    public function __construct(
20
        $items,
21
        $perPage,
22
        $currentPage = null,
23
        array $options = []
24
    ) {
25
        parent::__construct($items, $perPage, $currentPage, $options);
26
27
        if (isset($options['path'])) {
28
            $this->path = Helper::appendSlashes(
29
                $this->path,
30
                $options['path']
31
            );
32
        }
33
    }
34
}
35