Passed
Push — master ( 09d163...3c33c7 )
by Andrey
14:44
created

m190220_013101_create_qualities_table   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 27
loc 27
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 10 1
A safeDown() 0 3 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 yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `qualities`.
7
 */
8
class m190220_013101_create_qualities_table extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createTable('qualities',
16
            [
17
                'id' => $this->primaryKey(),
18
                'title' => $this->string(128)->notNull(),
19
                'description' => $this->text()->notNull(),
20
                'icon' => $this->string(128)->notNull(),
21
                'created_at' => $this->dateTime(),
22
                'updated_at' => $this->dateTime(),
23
            ]
24
        );
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function safeDown()
31
    {
32
        $this->dropTable('qualities');
33
    }
34
}
35