Completed
Push — master ( 6f5d59...afd2c7 )
by Andrey
06:35
created

m200609_141628_add_alias_to_pages_table   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 10 10 1
A safeDown() 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 yii\db\Migration;
4
5
/**
6
 * Class m200609_141628_add_alias_to_pages_table
7
 */
8 View Code Duplication
class m200609_141628_add_alias_to_pages_table extends Migration
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in 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...
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->addColumn('pages', 'alias', $this->string());
16
17
        $this->createIndex(
18
            'idx-pages-alias',
19
            'pages',
20
            'alias'
21
        );
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function safeDown()
28
    {
29
        $this->dropIndex(
30
            'idx-pages-alias',
31
            'pages'
32
        );
33
34
        $this->dropColumn('pages', 'alias');
35
    }
36
}
37