GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#13)
by Toby
16:48 queued 03:24
created

Controller   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 15
c 0
b 0
f 0
dl 0
loc 26
ccs 15
cts 15
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A paginationResponse() 0 12 1
A paginate() 0 8 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Http\Controllers;
4
5
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
6
use Illuminate\Foundation\Bus\DispatchesJobs;
7
use Illuminate\Foundation\Validation\ValidatesRequests;
8
use Illuminate\Pagination\LengthAwarePaginator;
9
use Illuminate\Routing\Controller as BaseController;
10
11
class Controller extends BaseController
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Controller
Loading history...
12
{
13
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
14
15 28
    public function paginate($items)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function paginate()
Loading history...
16
    {
17 28
        $perPage = request()->input('per_page', 10);
18 28
        $page = request()->input('page', 1);
19
        
20 28
        $slicedItems = collect($items)->forPage($page, $perPage)->values();
21
        
22 28
        return $this->paginationResponse($slicedItems, count($items));
23
    }
24
25 36
    public function paginationResponse($items, $count)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function paginationResponse()
Loading history...
26
    {
27 36
        $perPage = request()->input('per_page', 10);
28 36
        $page = request()->input('page', 1);
29
30 36
        return (new LengthAwarePaginator(
31 36
            $items,
32 36
            $count,
33 36
            $perPage,
34 36
            $page,
35 36
            ['path' => url(request()->path())]
36 36
        ))->appends('per_page', $perPage);
37
    }
38
}
39