Completed
Push — master ( 0af765...4a87b5 )
by claudio
03:49
created

EmployeesController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 78
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 2
dl 78
loc 78
ccs 0
cts 23
cp 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A index() 9 9 1
A store() 4 4 1
A show() 4 4 1
A update() 4 4 1
A destroy() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace plunner\Http\Controllers\Companies;
4
5
use Illuminate\Http\Request;
6
7
use plunner\Http\Requests;
8
use plunner\Http\Controllers\Controller;
9
use Tymon\JWTAuth\Facades\JWTAuth;
10
use plunner\Company;
11
12 View Code Duplication
class EmployeesController extends Controller
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * @var \plunner\Company
16
     */
17
    private $user;
0 ignored issues
show
Unused Code introduced by
The property $user is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
18
19
    /**
20
     * ExampleController constructor.
21
     */
22
    public function __construct()
23
    {
24
        config(['auth.model' => \plunner\Company::class]);
25
        config(['jwt.user' => \plunner\Company::class]);
26
        $this->middleware('jwt.authandrefresh:mode-cn');
27
    }
28
29
30
    /**
31
     * Display a listing of the resource.
32
     *
33
     * @return \Illuminate\Http\Response
34
     */
35
    public function index()
36
    {
37
        //
38
        /**
39
         * @var $company Company
40
         */
41
        $company = JWTAuth::getUserModel();
42
        return $company->employees;
43
    }
44
45
    /**
46
     * Store a newly created resource in storage.
47
     *
48
     * @param  \Illuminate\Http\Request  $request
49
     * @return \Illuminate\Http\Response
50
     */
51
    public function store(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

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

Loading history...
52
    {
53
        //
54
    }
55
56
    /**
57
     * Display the specified resource.
58
     *
59
     * @param  int  $id
60
     * @return \Illuminate\Http\Response
61
     */
62
    public function show($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

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

Loading history...
63
    {
64
        //
65
    }
66
67
    /**
68
     * Update the specified resource in storage.
69
     *
70
     * @param  \Illuminate\Http\Request  $request
71
     * @param  int  $id
72
     * @return \Illuminate\Http\Response
73
     */
74
    public function update(Request $request, $id)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $id is not used and could be removed.

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

Loading history...
75
    {
76
        //
77
    }
78
79
    /**
80
     * Remove the specified resource from storage.
81
     *
82
     * @param  int  $id
83
     * @return \Illuminate\Http\Response
84
     */
85
    public function destroy($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

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

Loading history...
86
    {
87
        //
88
    }
89
}
90