Issues (152)

src/Minify.php (23 issues)

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