TeamController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 26
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 6 6 1
A store() 6 6 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 App\Team;
6
use Illuminate\Support\Facades\Request;
7
use Illuminate\Support\Facades\Response;
8
9
/**
10
 * Class TeamController
11
 * @package App\Http\Controllers
12
 */
13 View Code Duplication
class TeamController 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...
14
{
15
    /**
16
     * Display a listing of the resource.
17
     *
18
     * @return Response
19
     */
20
    public function index()
21
    {
22
        $teams = Team::all();
23
24
        return view('team.index', compact('teams'));
25
    }
26
27
    /**
28
     * Store a newly created resource in storage.
29
     *
30
     * @return Response
31
     */
32
    public function store()
33
    {
34
        Team::create(Request::all());
0 ignored issues
show
Bug introduced by
The method create() does not exist on App\Team. Did you maybe mean created()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
35
36
        return redirect('team');
37
    }
38
}
39