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
Push — master ( 701ee8...c3fca5 )
by Tharindu
15:31 queued 11:57
created

UserController::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 11
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 19
ccs 0
cts 12
cp 0
crap 2
rs 9.9
1
<?php
2
3
namespace App\Api\V1\Controllers;
4
5
use App\Models\User;
6
use League\Fractal\Manager;
7
use League\Fractal\Resource\Item;
8
use App\Http\Controllers\Controller;
9
use Illuminate\Support\Facades\Input;
10
use League\Fractal\Resource\Collection;
11
use App\Api\V1\Transformers\UserTransformer;
12
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
13
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
14
15
class UserController extends Controller
16
{
17
    public function index()
18
    {
19
        $fractal = new Manager();
20
21
        $fractal->parseIncludes(Input::get('include', ''));
22
23
        $limit = Input::get('limit', 10);
24
25
        $queryParams = array_diff_key($_GET, array_flip(['page']));
26
        $usersPaginator = User::paginate($limit)
27
            ->appends($queryParams)
28
            ->appends([
29
                'limit' => $limit,
30
            ]);
31
32
        $users = new Collection($usersPaginator->items(), new UserTransformer());
33
        $users->setPaginator(new IlluminatePaginatorAdapter($usersPaginator));
34
35
        return $fractal->createData($users)->toArray();
36
    }
37
38
    public function show($id)
39
    {
40
        $fractal = new Manager();
41
42
        $fractal->parseIncludes(Input::get('include', ''));
43
44
        if (! $user = User::find($id)) {
45
            throw new NotFoundHttpException();
46
        }
47
48
        $user = new Item($user, new UserTransformer());
49
50
        return $fractal->createData($user)->toArray();
51
    }
52
}
53