PaginationServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 2 1
A boot() 0 16 1
1
<?php
2
3
namespace Signifly\Pagination;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Support\ServiceProvider;
7
8
class PaginationServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application events.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->publishes([
18
            __DIR__.'/../config/pagination.php' => config_path('pagination.php'),
19
        ], 'pagination');
20
21
        $this->mergeConfigFrom(__DIR__.'/../config/pagination.php', 'pagination');
22
23
        Request::macro('paginationCount', function ($key = null) {
24
            $defaultCount = config('pagination.defaultCount');
25
            $maximumCount = config('pagination.maximumCount');
26
            $paginationKey = $key ?? config('pagination.key');
27
28
            return min(
29
                intval($this->query($paginationKey, $defaultCount)),
0 ignored issues
show
Bug introduced by
The method query() does not exist on Signifly\Pagination\PaginationServiceProvider. ( Ignorable by Annotation )

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

29
                intval($this->/** @scrutinizer ignore-call */ query($paginationKey, $defaultCount)),

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
                $maximumCount
31
            );
32
        });
33
    }
34
35
    /**
36
     * Register the service provider.
37
     *
38
     * @return void
39
     */
40
    public function register()
41
    {
42
    }
43
}
44