Passed
Push — develop ( 61f94b...a6fa2e )
by Andrew
12:21
created

ImageOptimizeUtility::iconPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * ImageOptimize plugin for Craft CMS 3.x
4
 *
5
 * Automatically optimize images after they've been transformed
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) 2020 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\imageoptimize\utilities;
12
13
use nystudio107\imageoptimize\ImageOptimize;
14
use nystudio107\imageoptimize\assetbundles\imageoptimizeutility\ImageOptimizeUtilityAsset;
15
16
use Craft;
17
use craft\base\Utility;
18
19
/**
20
 * ImageOptimize Utility
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   ImageOptimize
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.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...
25
 */
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...
26
class ImageOptimizeUtility extends Utility
27
{
28
    // Static
29
    // =========================================================================
30
31
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
32
     * @inheritdoc
33
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
34
    public static function displayName(): string
35
    {
36
        return Craft::t('image-optimize', 'ImageOptimizeUtility');
37
    }
38
39
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
40
     * @inheritdoc
41
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
42
    public static function id(): string
43
    {
44
        return 'imageoptimize-image-optimize-utility';
45
    }
46
47
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
48
     * @inheritdoc
49
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
50
    public static function iconPath()
51
    {
52
        return Craft::getAlias("@nystudio107/imageoptimize/assetbundles/imageoptimizeutility/dist/img/ImageOptimizeUtility-icon.svg");
0 ignored issues
show
Bug Best Practice introduced by
The expression return Craft::getAlias('...imizeUtility-icon.svg') also could return the type boolean which is incompatible with the return type mandated by craft\base\UtilityInterface::iconPath() of null|string.
Loading history...
53
    }
54
55
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
56
     * @inheritdoc
57
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
58
    public static function badgeCount(): int
59
    {
60
        return 0;
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 static function contentHtml(): string
67
    {
68
        Craft::$app->getView()->registerAssetBundle(ImageOptimizeUtilityAsset::class);
69
70
        $someVar = 'Have a nice day!';
71
        return Craft::$app->getView()->renderTemplate(
72
            'image-optimize/_components/utilities/ImageOptimizeUtility_content',
73
            [
74
                'someVar' => $someVar
75
            ]
76
        );
77
    }
78
}
79