Issues (1783)

src/models/Stats.php (32 issues)

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