Passed
Push — v4 ( a85639...e3291f )
by Andrew
04:30 queued 13s
created

Minify::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 3
1
<?php
2
/**
3
 * Minify plugin for Craft CMS
4
 *
5
 * @link      https://nystudio107.com/
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @copyright tag
Loading history...
6
 * @copyright Copyright (c) nystudio107
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
7
 * @license   MIT License https://opensource.org/licenses/MIT
8
 */
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...
9
10
namespace nystudio107\minify;
11
12
use Craft;
13
use craft\base\Model;
14
use craft\base\Plugin;
15
use nystudio107\minify\models\Settings;
16
use nystudio107\minify\services\ServicesTrait;
17
use nystudio107\minify\twigextensions\MinifyTwigExtension;
18
19
/**
20
 * Class Minify
21
 *
22
 * @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...
23
 * @package   Minify
0 ignored issues
show
Coding Style introduced by
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
24
 * @since     1.2.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...
25
 *
26
 * @method Settings getSettings()
27
 */
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...
28
class Minify extends Plugin
29
{
30
    // Traits
31
    // =========================================================================
32
33
    use ServicesTrait;
34
35
    // Static Properties
36
    // =========================================================================
37
38
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
39
     * @var Minify
40
     */
41
    public static Minify $plugin;
42
43
    // Public Properties
44
    // =========================================================================
45
46
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
47
     * @var string
48
     */
49
    public string $schemaVersion = '1.0.0';
50
51
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
52
     * @var bool
53
     */
54
    public bool $hasCpSettings = false;
55
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
56
     * @var bool
57
     */
58
    public bool $hasCpSection = false;
59
60
    // Public Methods
61
    // =========================================================================
62
63
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
64
     * @inheritdoc
65
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
66
    public function init(): void
67
    {
68
        parent::init();
69
        self::$plugin = $this;
70
        $this->name = $this->getName();
71
72
        // Add in our Twig extensions
73
        Craft::$app->view->registerTwigExtension(new MinifyTwigExtension());
74
75
        Craft::info(
76
            Craft::t(
77
                'minify',
78
                '{name} plugin loaded',
79
                ['name' => $this->name]
80
            ),
81
            __METHOD__
82
        );
83
    }
84
85
    /**
86
     * Returns the user-facing name of the plugin, which can override the name
87
     * in composer.json
88
     *
89
     * @return string
90
     */
91
    public function getName(): string
92
    {
93
        return Craft::t('minify', 'Minify');
94
    }
95
96
    // Protected Methods
97
    // =========================================================================
98
99
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
100
     * @inerhitDoc
101
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
102
    protected function createSettingsModel(): ?Model
103
    {
104
        return new Settings();
105
    }
106
}
107