Passed
Push — develop ( a2c384...cbede7 )
by Andrew
07:23
created

ManifestVariable::includeSafariNomoduleFix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace nystudio107\transcoder\variables;
4
5
use nystudio107\transcoder\helpers\Manifest as ManifestHelper;
6
use nystudio107\transcoder\assetbundles\transcoder\TranscoderAsset;
7
8
use Craft;
9
use craft\helpers\Template;
10
11
use yii\base\InvalidConfigException;
12
use yii\web\NotFoundHttpException;
13
14
use Twig\Markup;
15
16
class ManifestVariable
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class ManifestVariable
Loading history...
17
{
18
    // Public Methods
19
    // =========================================================================
20
21
    /**
22
     * Get the passed in JS modules from the manifest, and register them in the current Craft view
23
     *
24
     * @param array $modules
0 ignored issues
show
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
25
     * @throws InvalidConfigException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
26
     * @throws NotFoundHttpException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
27
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
28
    public function registerJsModules(array $modules)
29
    {
30
        ManifestHelper::registerJsModules($modules);
31
    }
32
33
    /**
34
     * Get the passed in CS modules from the manifest, and register them in the current Craft view
35
     *
36
     * @param array $modules
0 ignored issues
show
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
37
     * @throws InvalidConfigException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
38
     * @throws NotFoundHttpException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
39
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
40
    public function registerCssModules(array $modules)
41
    {
42
        ManifestHelper::registerCssModules($modules);
43
    }
44
45
    /**
46
     * Get the passed in JS module from the manifest, then output a `<script src="">` tag for it in the HTML
47
     *
48
     * @param string     $moduleName
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 5 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
49
     * @param bool       $async
0 ignored issues
show
Coding Style introduced by
Expected 3 spaces after parameter type; 7 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
50
     *
51
     * @return null|Markup
52
     * @throws NotFoundHttpException
53
     */
54
    public function includeJsModule(string $moduleName, bool $async = false)
55
    {
56
        return Template::raw(
57
            ManifestHelper::includeJsModule($moduleName, $async) ?? ''
58
        );
59
    }
60
61
    /**
62
     * Get the passed in CS module from the manifest, then output a `<link>` tag for it in the HTML
63
     *
64
     * @param string     $moduleName
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 5 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
65
     * @param bool       $async
0 ignored issues
show
Coding Style introduced by
Expected 3 spaces after parameter type; 7 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
66
     *
67
     * @return Markup
68
     * @throws NotFoundHttpException
69
     */
70
    public function includeCssModule(string $moduleName, bool $async = false): Markup
71
    {
72
        return Template::raw(
73
            ManifestHelper::includeCssModule($moduleName, $async) ?? ''
74
        );
75
    }
76
}
77