Passed
Push — develop ( 71abba...d7f64b )
by Andrew
09:10
created

DataSample::behaviors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Webperf plugin for Craft CMS 3.x
4
 *
5
 * Monitor the performance of your webpages through real-world user timing data
6
 *
7
 * @link      https://nystudio107.com
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @copyright tag
Loading history...
8
 * @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...
9
 */
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...
10
11
namespace nystudio107\webperf\models;
12
13
use nystudio107\retour\validators\DbStringValidator;
0 ignored issues
show
Bug introduced by
The type nystudio107\retour\validators\DbStringValidator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
use yii\behaviors\AttributeTypecastBehavior;
0 ignored issues
show
Bug introduced by
The type yii\behaviors\AttributeTypecastBehavior was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
17
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
18
 * @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 indented incorrectly; expected 2 spaces but found 4
Loading history...
19
 * @package   Webperf
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 1 spaces but found 3
Loading history...
20
 * @since     1.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 indented incorrectly; expected 3 spaces but found 5
Loading history...
21
 */
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...
22
class DataSample extends DbModel
23
{
24
    // Public Properties
25
    // =========================================================================
26
27
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
28
     * @var int
29
     */
30
    public $siteId;
31
32
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
33
     * @var string u - the URL of the User Timing sample
34
     */
35
    public $url;
36
37
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
38
     * @var int (nt_dns_end - nt_dns_st) in ms
39
     */
40
    public $dns;
41
42
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
43
     * @var int (nt_con_end - nt_con_st) in ms
44
     */
45
    public $connect;
46
47
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
48
     * @var int t_resp in ms
49
     */
50
    public $firstByte;
51
52
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
53
     * @var int pt_fp in ms
54
     */
55
    public $firstPaint;
56
57
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
58
     * @var int pt_fcp in ms
59
     */
60
    public $firstContentfulPaint;
61
62
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
63
     * @var int (nt_domint - nt_nav_st) in ms
64
     */
65
    public $domInteractive;
66
67
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
68
     * @var int (nt_domcomp - nt_nav_st) or t_done in ms
69
     */
70
    public $pageLoad;
71
72
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
73
     * @var string the country code from the IP address
74
     */
75
    public $countryCode;
76
77
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
78
     * @var string the browser name
79
     */
80
    public $browser;
81
82
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
83
     * @var string the operating system
84
     */
85
    public $os;
86
87
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
88
     * @var bool mobile or non-mobile
89
     */
90
    public $mobile;
91
92
    // Public Methods
93
    // =========================================================================
94
95
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
96
     * @inheritdoc
97
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
98
    public function rules()
99
    {
100
        return [
101
            ['siteId', 'integer'],
102
            ['url', 'required'],
103
            ['url', DbStringValidator::class, 'max' => 255],
104
            ['countryCode', DbStringValidator::class, 'max' => 2],
105
            ['browser', DbStringValidator::class, 'max' => 50],
106
            ['os', DbStringValidator::class, 'max' => 50],
107
            [
108
                [
109
                    'url',
110
                    'countryCode',
111
                    'browser',
112
                    'os',
113
                ],
114
                'string'
115
            ],
116
            [
117
                [
118
                    'dns',
119
                    'connect',
120
                    'firstByte',
121
                    'firstPaint',
122
                    'firstContentfulPaint',
123
                    'domInteractive',
124
                    'pageLoad',
125
                ],
126
                'integer'
127
            ],
128
            ['mobile', 'boolean'],
129
        ];
130
    }
131
132
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
133
     * @return array
134
     */
135
    public function behaviors()
136
    {
137
        return [
138
            'typecast' => [
139
                'class' => AttributeTypecastBehavior::class,
140
                // 'attributeTypes' will be composed automatically according to `rules()`
141
            ],
142
        ];
143
    }
144
}
145