Passed
Push — feature/manager_api_routes ( 47ca0c )
by Tristan
10:22
created

ManagerApiController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
eloc 7
dl 0
loc 64
ccs 0
cts 15
cp 0
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
    public function __construct()
1 ignored issue
show
Coding Style Documentation introduced by
Missing doc comment for function __construct()
Loading history...
14
    {
15
        // This applies the appropriate policy to each resource route
16
        $this->authorizeResource(Manager::class, 'manager');
17
    }
18
19
    /**
20
     * Display a listing of the resource.
21
     *
22
     * @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...
23
     */
24
    public function index()
25
    {
26
        //TODO:
27
    }
28
29
    /**
30
     * Store a newly created resource in storage.
31
     *
32
     * @param  \Illuminate\Http\Request  $request
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
33
     * @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...
34
     */
35
    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

35
    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...
36
    {
37
        //TODO:
38
    }
39
40
    /**
41
     * Display the specified resource.
42
     *
43
     * @param  \App\Models\Manager  $manager
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
44
     * @return \Illuminate\Http\Response
45
     */
46
    public function show(Manager $manager)
0 ignored issues
show
introduced by
Method \App\Http\Controllers\Api\ManagerApiController::show() does not have return type hint for its return value but it should be possible to add it based on @return annotation "\Illuminate\Http\Response".
Loading history...
47
    {
48
        return $manager->toApiArray();
1 ignored issue
show
Bug Best Practice introduced by
The expression return $manager->toApiArray() returns the type array<mixed,mixed> which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
49
    }
50
51
    /**
52
     * Update the specified resource in storage.
53
     *
54
     * @param  App\Http\Requests\UpdateManager  $request
2 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Api...\Requests\UpdateManager was not found. Did you mean App\Http\Requests\UpdateManager? If so, make sure to prefix the type with \.
Loading history...
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
55
     * @param  \App\Models\Manager  $manager
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 2 found
Loading history...
56
     * @return \Illuminate\Http\Response
57
     */
58
    public function update(UpdateManager $request, Manager $manager)
0 ignored issues
show
introduced by
Method \App\Http\Controllers\Api\ManagerApiController::update() does not have return type hint for its return value but it should be possible to add it based on @return annotation "\Illuminate\Http\Response".
Loading history...
59
    {
60
        $request->validated();
61
        $manager->fill($request->input());
62
        $manager->save();
63
        return $manager->toApiArray();
1 ignored issue
show
Bug Best Practice introduced by
The expression return $manager->toApiArray() returns the type array<mixed,mixed> which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
64
    }
65
66
    /**
67
     * Remove the specified resource from storage.
68
     *
69
     * @param  \App\Models\Manager  $manager
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
70
     * @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...
71
     */
72
    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

72
    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...
73
    {
74
        //TODO:
75
    }
76
}
77