Passed
Push — feature/job-builder/step-03 ( c9515d...117b8c )
by Yonathan
12:37
created

ManagerApiController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 6
eloc 7
dl 0
loc 66
ccs 10
cts 15
cp 0.6667
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 3 1
A destroy() 0 2 1
A index() 0 2 1
A __construct() 0 4 1
A update() 0 6 1
A store() 0 2 1
1
<?php
2
3
namespace App\Http\Controllers\Api;
4
5
use App\Models\Manager;
6
use Illuminate\Http\Request;
7
use App\Http\Controllers\Controller;
8
use App\Http\Requests\UpdateManager;
9
10
class ManagerApiController extends Controller
11
{
12
    /**
13
     * Class constructor.
14
     */
15 5
    public function __construct()
16
    {
17
        // This applies the appropriate policy to each resource route.
18 5
        $this->authorizeResource(Manager::class, 'manager');
19 5
    }
20
21
    /**
22
     * Display a listing of the resource.
23
     *
24
     * @return \Illuminate\Http\Response
1 ignored issue
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
25
     */
26
    public function index()
27
    {
28
        // TODO: complete.
29
    }
30
31
    /**
32
     * Store a newly created resource in storage.
33
     *
34
     * @param  \Illuminate\Http\Request $request Incoming Request.
35
     * @return \Illuminate\Http\Response
1 ignored issue
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
36
     */
37
    public function store(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

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

37
    public function store(/** @scrutinizer ignore-unused */ Request $request)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        // TODO: complete.
40
    }
41
42
    /**
43
     * Display the specified resource.
44
     *
45
     * @param  \App\Models\Manager $manager Incoming Manager.
46
     * @return \Illuminate\Http\Response
47
     */
48 1
    public function show(Manager $manager)
49
    {
50 1
        return $manager->toApiArray();
51
    }
52
53
    /**
54
     * Update the specified resource in storage.
55
     *
56
     * @param  \App\Http\Requests\UpdateManager $request Incoming Form Request.
57
     * @param  \App\Models\Manager              $manager Incoming Manager.
58
     * @return \Illuminate\Http\Response
59
     */
60 1
    public function update(UpdateManager $request, Manager $manager)
61
    {
62 1
        $request->validated();
63 1
        $manager->fill($request->input());
64 1
        $manager->save();
65 1
        return $manager->toApiArray();
66
    }
67
68
    /**
69
     * Remove the specified resource from storage.
70
     *
71
     * @param  \App\Models\Manager $manager Incoming Manager.
72
     * @return \Illuminate\Http\Response
1 ignored issue
show
Coding Style introduced by
Function return type is not void, but function has no return statement
Loading history...
73
     */
74
    public function destroy(Manager $manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed. ( Ignorable by Annotation )

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

74
    public function destroy(/** @scrutinizer ignore-unused */ Manager $manager)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
75
    {
76
        // TODO: complete.
77
    }
78
}
79