CreateShowsTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 37.5 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 12 15 1
A down() 0 6 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
namespace CosmicRadioTV\Podcast\Updates;
4
5
use DB;
6
use Illuminate\Database\Schema\Blueprint;
7
use Schema;
8
use October\Rain\Database\Updates\Migration;
9
10
class CreateShowsTable extends Migration
11
{
12
13
    /**
14
     * Migration
15
     */
16
    public function up()
17
    {
18 View Code Duplication
        DB::transaction(function () {
19
            Schema::create('cosmicradiotv_podcast_shows', function (Blueprint $table) {
20
                $table->engine = 'InnoDB';
21
                $table->increments('id');
22
                $table->string('name');
23
                $table->string('slug');
24
                $table->text('description')->nullable();
25
                $table->timestamps();
26
27
                $table->unique('slug');
28
            });
29
        });
30
    }
31
32
    /**
33
     * Rollback
34
     */
35
    public function down()
36
    {
37
        DB::transaction(function () {
38
            Schema::drop('cosmicradiotv_podcast_shows');
39
        });
40
    }
41
}