Issues (287)

src/models/Settings.php (26 issues)

1
<?php
2
/**
3
 * Template Comments plugin for Craft CMS
4
 *
5
 * Adds a HTML comment to demarcate each Twig template that is included or extended.
6
 *
7
 * @link      https://nystudio107.com/
0 ignored issues
show
The tag in position 1 should be the @copyright tag
Loading history...
8
 * @copyright Copyright (c)  nystudio107
0 ignored issues
show
@copyright tag must contain a year and the name of the copyright holder
Loading history...
9
 */
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...
10
11
namespace nystudio107\templatecomments\models;
12
13
use craft\base\Model;
14
use craft\validators\ArrayValidator;
15
16
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
17
 * @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...
18
 * @package   TemplateComments
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
19
 * @since     1.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...
20
 */
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...
21
class Settings extends Model
22
{
23
    // Public Properties
24
    // =========================================================================
25
26
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
27
     * @var bool Whether comments should be generated for site templates
28
     */
29
    public bool $siteTemplateComments = true;
30
31
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
32
     * @var bool Whether comments should be generated for Control Panel templates
33
     */
34
    public bool $cpTemplateComments = false;
35
36
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
37
     * @var bool Whether to generate comments only when `devMode` is on
38
     */
39
    public bool $onlyCommentsInDevMode = true;
40
41
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
42
     * @var array Don't add comments to template blocks that contain these strings (case-insensitive)
43
     */
44
    public array $excludeBlocksThatContain = [
45
        'css',
46
        'js',
47
        'javascript',
48
    ];
49
50
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
51
     * @var bool Whether or not to show comments for templates that are include'd
52
     */
53
    public bool $templateCommentsEnabled = true;
54
55
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
56
     * @var bool Whether or not to show comments for `{% block %}`s
57
     */
58
    public bool $blockCommentsEnabled = true;
59
60
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
61
     * @var array Template file suffixes that Template Comments should be enabled for
62
     */
63
    public array $allowedTemplateSuffixes = [
64
        '',
65
        'twig',
66
        'htm',
67
        'html',
68
    ];
69
70
    // Public Methods
71
    // =========================================================================
72
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
73
     * @inerhitdoc
74
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
75
    public function rules(): array
76
    {
77
        return [
78
            [
79
                [
80
                    'siteTemplateComments',
81
                    'cpTemplateComments',
82
                    'onlyCommentsInDevMode',
83
                    'templateCommentsEnabled',
84
                    'blockCommentsEnabled',
85
                ],
86
                'boolean',
87
            ],
88
            [
89
                [
90
                    'excludeBlocksThatContain',
91
                    'allowedTemplateSuffixes',
92
                ],
93
                ArrayValidator::class,
94
            ],
95
        ];
96
    }
97
}
98