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::paginationResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 12
ccs 10
cts 10
cp 1
rs 9.9666
cc 1
nc 1
nop 2
crap 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