Stats   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 130
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 50
c 0
b 0
f 0
dl 0
loc 130
ccs 0
cts 55
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A behaviors() 0 5 1
A rules() 0 48 1
1
<?php
2
/**
3
 * Retour plugin for Craft CMS
4
 *
5
 * Retour allows you to intelligently redirect legacy URLs, so that you don't
6
 * lose SEO value when rebuilding & restructuring a website
7
 *
8
 * @link      https://nystudio107.com/
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @copyright tag
Loading history...
9
 * @copyright Copyright (c) 2018 nystudio107
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
10
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
11
12
namespace nystudio107\retour\models;
13
14
use nystudio107\retour\validators\DbStringValidator;
15
16
use yii\behaviors\AttributeTypecastBehavior;
17
18
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
19
 * @author    nystudio107
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @package tag
Loading history...
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
Coding Style introduced by
Tag value for @author tag indented incorrectly; expected 2 spaces but found 4
Loading history...
20
 * @package   Retour
0 ignored issues
show
Coding Style introduced by
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
21
 * @since     3.0.0
0 ignored issues
show
Coding Style introduced by
The tag in position 3 should be the @author tag
Loading history...
Coding Style introduced by
Tag value for @since tag indented incorrectly; expected 3 spaces but found 5
Loading history...
22
 */
0 ignored issues
show
Coding Style introduced by
Missing @category 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...
23
class Stats extends DbModel
24
{
25
    // Public Properties
26
    // =========================================================================
27
28
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
29
     * @var int
30
     */
31
    public $id;
32
33
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
34
     * @var null|int
35
     */
36
    public $siteId;
37
38
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
39
     * @var string
40
     */
41
    public $redirectSrcUrl;
42
43
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
44
     * @var string
45
     */
46
    public $referrerUrl;
47
48
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
49
     * @var string
50
     */
51
    public $remoteIp;
52
53
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
54
     * @var string
55
     */
56
    public $userAgent;
57
58
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
59
     * @var string
60
     */
61
    public $exceptionMessage;
62
63
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
64
     * @var string
65
     */
66
    public $exceptionFilePath;
67
68
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
69
     * @var int
70
     */
71
    public $exceptionFileLine;
72
73
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
74
     * @var int
75
     */
76
    public $hitCount;
77
78
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
79
     * @var string
80
     */
81
    public $hitLastTime;
82
83
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
84
     * @var int
85
     */
86
    public $handledByRetour;
87
88
    // Public Methods
89
    // =========================================================================
90
91
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
92
     * @inheritdoc
93
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
94
    public function rules()
95
    {
96
        return [
97
            ['id', 'integer'],
98
            ['siteId', 'integer'],
99
            ['siteId', 'default', 'value' => null],
100
            [
101
                [
102
                    'redirectSrcUrl',
103
                    'userAgent',
104
                    'exceptionMessage',
105
                    'exceptionFilePath',
106
                ],
107
                DbStringValidator::class,
108
                'max' => 255,
109
            ],
110
            [
111
                [
112
                    'redirectSrcUrl',
113
                    'userAgent',
114
                    'exceptionMessage',
115
                    'exceptionFilePath',
116
                ],
117
                'string',
118
            ],
119
            [
120
                [
121
                    'redirectSrcUrl',
122
                    'userAgent',
123
                    'exceptionMessage',
124
                    'exceptionFilePath',
125
                ],
126
                'default',
127
                'value' => '',
128
            ],
129
            ['exceptionFileLine', 'integer'],
130
            ['exceptionFileLine', 'default', 'value' => 0],
131
            ['referrerUrl', DbStringValidator::class, 'max' => 2000],
132
            ['referrerUrl', 'string'],
133
            ['referrerUrl', 'default', 'value' => ''],
134
            ['remoteIp', DbStringValidator::class, 'max' => 45],
135
            ['remoteIp', 'string'],
136
            ['remoteIp', 'default', 'value' => ''],
137
            ['hitCount', 'integer'],
138
            ['hitCount', 'default', 'value' => 0],
139
            ['hitLastTime', 'safe'],
140
            ['handledByRetour', 'integer', 'min' => 0, 'max' => 1],
141
            ['handledByRetour', 'default', 'value' => 0],
142
        ];
143
    }
144
145
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
146
     * @return array
147
     */
148
    public function behaviors()
149
    {
150
        return [
151
            'typecast' => [
152
                'class' => AttributeTypecastBehavior::class,
153
                // 'attributeTypes' will be composed automatically according to `rules()`
154
            ],
155
        ];
156
    }
157
}
158