CreateCoachesTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 2
c 4
b 0
f 2
lcom 0
cbo 3
dl 34
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 16 16 1
A down() 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
use Illuminate\Database\Capsule\Manager as Capsule;
4
use \Illuminate\Database\Schema\Blueprint as Blueprint;
5
6 View Code Duplication
class CreateCoachesTable
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function run()
14
    {
15
        Capsule::schema()->dropIfExists('coaches');
16
        Capsule::schema()->create('coaches', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->string('name');
19
            $table->string('surname');
20
            $table->tinyInteger('age');
21
            $table->string('nationality',2);
22
            $table->float('skillAvg');
23
            $table->float('wageReq');
24
            $table->string('favouriteModule',10);
25
            $table->integer('team_id')->nullable();
26
            $table->timestamps();
27
        });
28
    }
29
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        Schema::drop('coaches');
38
    }
39
}
40