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.

RoleTagController   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
eloc 18
c 1
b 0
f 0
dl 0
loc 76
ccs 22
cts 22
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A update() 0 16 5
A index() 0 3 1
A destroy() 0 3 1
A store() 0 7 1
A show() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Http\Controllers\RoleTag;
4
5
use BristolSU\ControlDB\Http\Controllers\Controller;
6
use BristolSU\ControlDB\Contracts\Models\Tags\RoleTag;
7
use BristolSU\ControlDB\Contracts\Repositories\Tags\RoleTag as RoleTagRepository;
8
use BristolSU\ControlDB\Http\Requests\Api\RoleTag\RoleTagStoreRequest;
9
use BristolSU\ControlDB\Http\Requests\Api\RoleTag\RoleTagUpdateRequest;
10
11
/**
12
 * Handle role tags
13
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
14
class RoleTagController extends Controller
15
{
16
17
    /**
18
     * Get all role tags
19
     * 
20
     * @param RoleTagRepository $roleTagRepository
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
21
     * @return \Illuminate\Pagination\LengthAwarePaginator
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
22
     */
23 1
    public function index(RoleTagRepository $roleTagRepository)
24
    {
25 1
        return $this->paginate($roleTagRepository->all());
26
    }
27
28
    /**
29
     * Show information about a single role tag
30
     * 
31
     * @param RoleTag $roleTag
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
32
     * @return RoleTag
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
33
     */
34 1
    public function show(RoleTag $roleTag)
35
    {
36 1
        return $roleTag;
37
    }
38
39
    /**
40
     * Create a new role tag
41
     * 
42
     * @param RoleTagStoreRequest $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
43
     * @param RoleTagRepository $roleTagRepository
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
44
     * @return RoleTag
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
45
     */
46 1
    public function store(RoleTagStoreRequest $request, RoleTagRepository $roleTagRepository)
47
    {
48 1
        return $roleTagRepository->create(
49 1
            $request->input('name'),
50 1
            $request->input('description'),
51 1
            $request->input('reference'),
52 1
            $request->input('tag_category_id')
53
        );
54
    }
55
56
    /**
57
     * Update a role tag
58
     * 
59
     * @param RoleTag $roleTag
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 14 spaces after parameter type; 1 found
Loading history...
60
     * @param RoleTagUpdateRequest $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
61
     * @return RoleTag
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
62
     */
63 1
    public function update(RoleTag $roleTag, RoleTagUpdateRequest $request)
64
    {
65 1
        if($request->input('name') !== null) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
66 1
            $roleTag->setName($request->input('name'));
67
        }
68 1
        if($request->input('description') !== null) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
69 1
            $roleTag->setDescription($request->input('description'));
70
        }
71 1
        if($request->input('reference') !== null) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
72 1
            $roleTag->setReference($request->input('reference'));
73
        }
74 1
        if($request->input('tag_category_id') !== null) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
75 1
            $roleTag->setTagCategoryId($request->input('tag_category_id'));
76
        }
77
78 1
        return $roleTag;
79
    }
80
81
    /**
82
     * Delete a role tag
83
     * 
84
     * @param RoleTag $roleTag
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 11 spaces after parameter type; 1 found
Loading history...
85
     * @param RoleTagRepository $roleTagRepository
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
86
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
87 1
    public function destroy(RoleTag $roleTag, RoleTagRepository $roleTagRepository)
88
    {
89 1
        $roleTagRepository->delete((int) $roleTag->id());
90 1
    }
91
92
}
93