Completed
Push — master ( 872a00...e2f753 )
by Troy
01:33
created

CreateFeaturesTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 40 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 3
dl 12
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 12 12 1
A down() 0 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\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateFeaturesTable extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14 View Code Duplication
    public function up()
0 ignored issues
show
Duplication introduced by
This method 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...
15
    {
16
        Schema::create('features', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->string('name')->index();
19
            $table->string('model');
20
            $table->string('label')->nullable();
21
            $table->text('description')->nullable();
22
            $table->boolean('auto_add')->default(false);
23
            $table->timestamps();
24
        });
25
    }
26
27
    /**
28
     * Reverse the migrations.
29
     *
30
     * @return void
31
     */
32
    public function down()
33
    {
34
        Schema::dropIfExists('features');
35
    }
36
}
37