Completed
Push — master ( e1cce4...d2c19b )
by David
09:34 queued 11s
created

UpdateUserTable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 50 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
dl 12
loc 24
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 6 11 2
A down() 6 9 2

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\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\DB;
6
use Illuminate\Support\Facades\Schema;
7
8
class UpdateUserTable extends Migration
9
{
10
    public function up()
11
    {
12
        DB::connection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
13
14 View Code Duplication
        if (Schema::hasTable('users')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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
            Schema::table('users', function (Blueprint $table) {
16
                $table->string('password', 255)->nullable()->change();
17
                $table->string('mail', 255)->change();
18
            });
19
        }
20
    }
21
22
    public function down()
23
    {
24 View Code Duplication
        if (Schema::hasTable('users')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
25
            Schema::table('users', function (Blueprint $table) {
26
                $table->string('password', 64)->nullable(false)->change();
27
                $table->string('mail', 50)->change();
28
            });
29
        }
30
    }
31
}
32