CreateStatusesTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 65.22 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 15
loc 23
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 15 15 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 namespace Bedard\Shop\Updates;
2
3
use October\Rain\Database\Schema\Blueprint;
4
use October\Rain\Database\Updates\Migration;
5
use Schema;
6
7
class CreateStatusesTable extends Migration
8
{
9 View Code Duplication
    public function up()
10
    {
11
        Schema::create('bedard_shop_statuses', function (Blueprint $table) {
12
            $table->engine = 'InnoDB';
13
            $table->increments('id');
14
            $table->string('name')->default('')->index();
15
            $table->string('color')->nullable();
16
            $table->string('icon')->nullable();
17
            $table->boolean('is_abandoned')->default(false);
18
            $table->boolean('is_default')->default(false);
19
            $table->boolean('is_reducing')->default(false);
20
            $table->timestamps();
21
            $table->softDeletes();
22
        });
23
    }
24
25
    public function down()
26
    {
27
        Schema::dropIfExists('bedard_shop_statuses');
28
    }
29
}
30