Settings   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A defineRules() 0 5 1
1
<?php
2
/**
3
 * CodeEditor for Craft CMS
4
 *
5
 * Provides a code editor field with Twig & Craft API autocomplete
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) 2022 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\codeeditor\models;
12
13
use craft\base\Model;
14
use craft\validators\ArrayValidator;
15
use nystudio107\codeeditor\autocompletes\CraftApiAutocomplete;
16
use nystudio107\codeeditor\autocompletes\SectionShorthandFieldsAutocomplete;
17
use nystudio107\codeeditor\autocompletes\TwigLanguageAutocomplete;
18
19
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
20
 * @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...
21
 * @package   CodeEditor
0 ignored issues
show
Coding Style introduced by
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
22
 * @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...
23
 */
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...
24
class Settings extends Model
25
{
26
    // Public Properties
27
    // =========================================================================
28
29
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
30
     * @var bool Whether to allow anonymous access be allowed to the codeeditor/autocomplete/index endpoint
31
     */
32
    public $allowFrontendAccess = false;
33
34
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
35
     * @var bool Whether to allow frontend templates access to the `codeeditor/codeEditor.twig` Twig template
36
     */
37
    public $allowTemplateAccess = true;
38
39
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
40
     * @var string[] The default autocompletes to use for the default `CodeEditor` field type
41
     */
42
    public $defaultCodeEditorAutocompletes = [
43
        CraftApiAutocomplete::class,
44
        TwigLanguageAutocomplete::class,
45
        SectionShorthandFieldsAutocomplete::class,
46
    ];
47
48
    // Public Methods
49
    // =========================================================================
50
51
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
52
     * @inheritdoc
53
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
54
    public function defineRules(): array
55
    {
56
        return [
57
            [['allowFrontendAccess', 'allowTemplateAccess'], 'boolean'],
58
            ['defaultCodeFieldAutocompletes', ArrayValidator::class],
59
        ];
60
    }
61
}
62