AddUserDataAndUrlToLernTables   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 9 9 1
A down() 9 9 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\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6 View Code Duplication
class AddUserDataAndUrlToLernTables extends Migration {
7
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::table(config('lern.record.table'), function(Blueprint $table) {
16
            $table->integer('user_id')->nullable();
17
            $table->text('data')->nullable();
18
            $table->string('url')->nullable();
19
            $table->string('method')->nullable();
20
        });
21
    }
22
23
    /**
24
     * Reverse the migrations.
25
     *
26
     * @return void
27
     */
28
    public function down()
29
    {
30
        Schema::table(config('lern.record.table'), function(Blueprint $table) {
31
            $table->dropColumn('user_id');
32
            $table->dropColumn('data');
33
            $table->dropColumn('url');
34
            $table->dropColumn('method');
35
        });
36
    }
37
38
}