Passed
Pull Request — master (#2)
by
unknown
15:51
created

m180603_123208_create_home_table   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeDown() 0 3 1
A safeUp() 0 12 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 Itstructure\AdminModule\components\MultilanguageMigration;
4
5
/**
6
 * Handles the creation of table `home`.
7
 */
8
class m180603_123208_create_home_table extends MultilanguageMigration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createMultiLanguageTable('home',
16
            [
17
                'title' => $this->string(128),
18
                'description' => $this->text(),
19
                'content' => $this->text(),
20
                'metaKeys' => $this->string(128),
21
                'metaDescription' => $this->string(),
22
            ],
23
            [
24
                'default' => $this->tinyInteger()->defaultValue(0),
25
            ]
26
        );
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function safeDown()
33
    {
34
        $this->dropMultiLanguageTable('home');
35
    }
36
}
37