m181013_122446_add_remote_ip   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 11 2
A safeDown() 0 4 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace nystudio107\retour\migrations;
4
5
use craft\db\Migration;
6
use yii\base\NotSupportedException;
7
8
/**
9
 * m181013_122446_add_remote_ip migration.
0 ignored issues
show
Coding Style introduced by
Doc comment short description must start with a capital letter
Loading history...
10
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
11
class m181013_122446_add_remote_ip extends Migration
0 ignored issues
show
Coding Style introduced by
Class name must begin with a capital letter
Loading history...
Coding Style introduced by
Class name is not valid; consider M181013_122446_Add_Remote_Ip instead
Loading history...
12
{
13
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
14
     * @inheritdoc
15
     * @throws NotSupportedException
0 ignored issues
show
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 5 spaces but found 1
Loading history...
16
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
17
    public function safeUp(): bool
18
    {
19
        if (!$this->db->columnExists('{{%retour_stats}}', 'remoteIp')) {
20
            $this->addColumn(
21
                '{{%retour_stats}}',
22
                'remoteIp',
23
                $this->string(45)->after('referrerUrl')->defaultValue('')
24
            );
25
        }
26
27
        return true;
28
    }
29
30
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
31
     * @inheritdoc
32
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
33
    public function safeDown(): bool
34
    {
35
        echo "m181013_122446_add_remote_ip cannot be reverted.\n";
36
        return false;
37
    }
38
}
39