@@ -19,51 +19,46 @@ public function __construct(AssetsPicker $assetsPicker)
19
19
}
20
20
21
21
/**
22
- * @param null $type
22
+ * @param bool|false $isInline
23
23
*
24
24
* @return string
25
25
*/
26
- public function renderScript ($ type = ' src ' )
26
+ public function renderScript ($ isInline = false )
27
27
{
28
28
$ assets = $ this ->asstsPicker ->pickScriptAssets ();
29
- $ mask = $ type == 'inline ' ? '<script>%s</script> ' : '<script src="%s?%s"></script> ' ;
29
+ $ mask = $ type == 'inline ' ? '<script>%s</script> ' : '<script src="%s?%s"></script> ' ;
30
30
31
- return $ this ->render ($ mask , $ assets , $ type );
31
+ return $ this ->render ($ mask , $ assets , $ isInline );
32
32
}
33
33
34
34
/**
35
- * @param null $type
35
+ * @param bool|false $isInline
36
36
*
37
37
* @return string
38
38
*/
39
- public function renderStyle ($ type = ' src ' )
39
+ public function renderStyle ($ isInline = false )
40
40
{
41
41
$ assets = $ this ->asstsPicker ->pickStyleAssets ();
42
- $ mask = $ type == 'inline ' ? '<style>%s</style> ' : '<link rel="stylesheet" type="text/css" href="%s?%s"> ' ;
42
+ $ mask = $ type == 'inline ' ? '<style>%s</style> ' : '<link rel="stylesheet" type="text/css" href="%s?%s"> ' ;
43
43
44
- return $ this ->render ($ mask , $ assets , $ type );
44
+ return $ this ->render ($ mask , $ assets , $ isInline );
45
45
}
46
46
47
47
/**
48
- * @param $mask
48
+ * @param String $mask
49
49
* @param Asset[] $assets
50
- * @param $type
50
+ * @param boolean $isInline
51
51
*
52
52
* @return string
53
53
*/
54
- private function render ($ mask , $ assets , $ type )
54
+ private function render ($ mask , $ assets , $ isInline )
55
55
{
56
56
$ ret = '' ;
57
57
58
- if ($ type == ' src ' )
58
+ if (! $ isInline )
59
59
{
60
60
foreach ($ assets as $ asset )
61
61
{
62
- if (!file_exists ($ asset ->getSrc ()))
63
- {
64
- throw new \LogicException (sprintf ('File %s not found ' , $ asset ->getSrc ()));
65
- }
66
-
67
62
if ($ asset ->getSrc ())
68
63
{
69
64
$ ret .= sprintf ($ mask , $ asset ->getSrc (), crc32 (file_get_contents ($ asset ->getSrc ())));
@@ -74,11 +69,6 @@ private function render($mask, $assets, $type)
74
69
{
75
70
foreach ($ assets as $ asset )
76
71
{
77
- if (!file_exists ($ asset ->getInline ()))
78
- {
79
- throw new \LogicException (sprintf ('File %s not found ' , $ asset ->getInline ()));
80
- }
81
-
82
72
if ($ asset ->getInline ())
83
73
{
84
74
$ ret .= file_get_contents ($ asset ->getInline ());
@@ -94,6 +84,3 @@ private function render($mask, $assets, $type)
94
84
return $ ret ;
95
85
}
96
86
}
97
-
98
-
99
-
0 commit comments