Settings   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 101
Duplicated Lines 0 %

Importance

Changes 10
Bugs 1 Features 1
Metric Value
wmc 1
eloc 27
c 10
b 1
f 1
dl 0
loc 101
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A rules() 0 27 1
1
<?php
2
/**
3
 * Vite plugin for Craft CMS
4
 *
5
 * Allows the use of the Vite.js next generation frontend tooling with Craft CMS
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) 2021 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\vite\models;
12
13
use craft\base\Model;
14
15
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
16
 * @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...
17
 * @package   Vite
0 ignored issues
show
Coding Style introduced by
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
18
 * @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 for @since tag indented incorrectly; expected 3 spaces but found 5
Loading history...
19
 */
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...
20
class Settings extends Model
21
{
22
    // Public Properties
23
    // =========================================================================
24
25
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
26
     * @var bool Should the dev server be used for?
27
     */
28
    public bool $useDevServer = false;
29
30
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
31
     * @var string File system path (or URL) to the Vite-built manifest.json
32
     */
33
    public string $manifestPath = '';
34
35
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
36
     * @var string The public URL to the dev server (what appears in `<script src="">` tags
37
     */
38
    public string $devServerPublic = '';
39
40
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
41
     * @var string The public URL to use when not using the dev server
42
     */
43
    public string $serverPublic = '';
44
45
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
46
     * @var string|array The JavaScript entry from the manifest.json to inject on Twig error pages
47
     *              This can be a string or an array of strings
48
     */
49
    public string|array $errorEntry = '';
50
51
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
52
     * @var string String to be appended to the cache key
53
     */
54
    public string $cacheKeySuffix = '';
55
56
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
57
     * @var string The internal URL to the dev server, when accessed from the environment in which PHP is executing
58
     *              This can be the same as `$devServerPublic`, but may be different in containerized or VM setups.
59
     *              ONLY used if $checkDevServer = true
60
     */
61
    public string $devServerInternal = '';
62
63
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
64
     * @var bool Should we check for the presence of the dev server by pinging $devServerInternal to make sure it's running?
65
     */
66
    public bool $checkDevServer = false;
67
68
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
69
     * @var bool Whether the react-refresh-shim should be included
70
     */
71
    public bool $includeReactRefreshShim = false;
72
73
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
74
     * @var bool Whether the modulepreload-polyfill shim should be included
75
     */
76
    public bool $includeModulePreloadShim = true;
77
78
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
79
     * @var string File system path (or URL) to where the Critical CSS files are stored
80
     */
81
    public string $criticalPath = '';
82
83
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
84
     * @var string the suffix added to the name of the currently rendering template for the critical css file name
85
     */
86
    public string $criticalSuffix = '_critical.min.css';
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(): array
95
    {
96
        return [
97
            [
98
                [
99
                    'useDevServer',
100
                    'checkDevServer',
101
                    'includeReactRefreshShim',
102
                    'includeModulePreloadShim',
103
                ],
104
                'boolean',
105
            ],
106
            [
107
                [
108
                    'manifestPath',
109
                    'devServerPublic',
110
                    'serverPublic',
111
                    'cacheKeySuffix',
112
                    'devServerInternal',
113
                ],
114
                'string',
115
            ],
116
            [
117
                [
118
                    'errorEntry',
119
                ],
120
                'string',
121
            ],
122
        ];
123
    }
124
}
125