Completed
Push — develop ( f672ca...7b8dd8 )
by
unknown
07:11
created

PortController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 3
dl 56
loc 56
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 3 3 1
A index() 5 5 1
A show() 4 4 1
A edit() 4 4 1
A update() 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 App\Http\Controllers;
4
5
use Dingo\Api\Http;
6
use Dingo\Api\Routing\Router;
7
use Dingo\Api\Routing\Helpers;
8
use App\Http\Requests;
9
use Illuminate\Http\Request;
10
use JWTAuth;
11
12 View Code Duplication
class PortController 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
    use Helpers;
15
16
    /**
17
     * Constructor
18
     */
19
    public function __construct(Request $request) {
1 ignored issue
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...
20
        $this->middleware('auth');
21
    }
22
23
    /**
24
     * Display a listing of the resource.
25
     *
26
     * @return \Illuminate\Http\Response
27
     */
28
    public function index()
29
    {
30
        $ports = $this->api->be(auth()->user())->get('/api/ports');
0 ignored issues
show
Bug introduced by
The method user() does not seem to exist on object<Illuminate\Contracts\Auth\Factory>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
        return view('ports.list', ['ports'=>$ports]);
32
    }
33
34
    /**
35
     * Display the specified resource.
36
     *
37
     * @param  int  $id
38
     * @return \Illuminate\Http\Response
39
     */
40
    public function show($id)
1 ignored issue
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...
41
    {
42
        // show a single device
43
    }
44
45
    /**
46
     * Show the form for editing the specified resource.
47
     *
48
     * @param  int  $id
49
     * @return \Illuminate\Http\Response
50
     */
51
    public function edit($id)
1 ignored issue
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...
52
    {
53
        //edit device form??
54
    }
55
56
    /**
57
     * Update the specified resource in storage.
58
     *
59
     * @param  \Illuminate\Http\Request  $request
60
     * @param  int  $id
61
     * @return \Illuminate\Http\Response
62
     */
63
    public function update(Request $request, $id)
2 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...
64
    {
65
        //process device modify
66
    }
67
}
68