PaginationServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 17
rs 9.9332
1
<?php
2
3
namespace Sulao\LRTS\Pagination;
4
5
use Illuminate\Pagination\LengthAwarePaginator as LaravelLengthAwarePaginator;
6
use Illuminate\Pagination\Paginator as LaravelPaginator;
7
use Sulao\LRTS\Helper;
8
9
class PaginationServiceProvider extends \Illuminate\Support\ServiceProvider
10
{
11
    /**
12
     * Register the application services.
13
     *
14
     * @return void
15
     */
16
    public function register()
17
    {
18
        LaravelPaginator::currentPathResolver(function () {
19
            return Helper::appendSlashes(
20
                $this->app['request']->url(),
21
                $this->app['request']->getPathInfo()
22
            );
23
        });
24
25
        $this->app->alias(
26
            LengthAwarePaginator::class,
27
            LaravelLengthAwarePaginator::class
28
        );
29
30
        $this->app->alias(
31
            Paginator::class,
32
            LaravelPaginator::class
33
        );
34
    }
35
}
36