1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Leonidas\Library\Core\Asset; |
4
|
|
|
|
5
|
|
|
use Leonidas\Contracts\Ui\Asset\ScriptInterface; |
6
|
|
|
use Leonidas\Library\Core\Asset\Abstracts\HasScriptDataTrait; |
7
|
|
|
use WebTheory\HttpPolicy\ServerRequestPolicyInterface; |
8
|
|
|
|
9
|
|
|
class Script extends AbstractAsset implements ScriptInterface |
10
|
|
|
{ |
11
|
|
|
use HasScriptDataTrait; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @var bool |
15
|
|
|
*/ |
16
|
|
|
protected $shouldLoadInFooter; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var null|bool |
20
|
|
|
*/ |
21
|
|
|
protected $isAsync; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var null|bool |
25
|
|
|
*/ |
26
|
|
|
protected $isDeferred; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var null|string |
30
|
|
|
*/ |
31
|
|
|
protected $integrity; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var null|bool |
35
|
|
|
*/ |
36
|
|
|
protected $isNoModule; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var null|string |
40
|
|
|
*/ |
41
|
|
|
protected $nonce; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var null|string |
45
|
|
|
*/ |
46
|
|
|
protected $referrerPolicy; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var null|string |
50
|
|
|
*/ |
51
|
|
|
protected $type; |
52
|
|
|
|
53
|
|
|
public function __construct( |
54
|
|
|
string $handle, |
55
|
|
|
string $src, |
56
|
|
|
?array $dependencies, |
57
|
|
|
$version = null, |
58
|
|
|
?bool $shouldLoadInFooter = null, |
59
|
|
|
?bool $shouldBeEnqueued = null, |
60
|
|
|
?ServerRequestPolicyInterface $policy = null, |
61
|
|
|
?array $attributes = null, |
62
|
|
|
?bool $isAsync = null, |
63
|
|
|
?string $crossorigin = null, |
64
|
|
|
?bool $isDeferred = null, |
65
|
|
|
?string $integrity = null, |
66
|
|
|
?bool $isNoModule = null, |
67
|
|
|
?string $nonce = null, |
68
|
|
|
?string $referrerPolicy = null, |
69
|
|
|
?string $type = null |
70
|
|
|
) { |
71
|
|
|
parent::__construct( |
72
|
|
|
$handle, |
73
|
|
|
$src, |
74
|
|
|
$dependencies, |
75
|
|
|
$version, |
76
|
|
|
$shouldBeEnqueued, |
77
|
|
|
$policy, |
78
|
|
|
$attributes, |
79
|
|
|
$crossorigin |
80
|
|
|
); |
81
|
|
|
|
82
|
|
|
$shouldLoadInFooter && $this->shouldLoadInFooter = $shouldLoadInFooter; |
83
|
|
|
$isAsync && $this->isAsync = $isAsync; |
84
|
|
|
$isDeferred && $this->isDeferred = $isDeferred; |
85
|
|
|
$integrity && $this->integrity = $integrity; |
86
|
|
|
$isNoModule && $this->isNoModule = $isNoModule; |
87
|
|
|
$nonce && $this->nonce = $nonce; |
88
|
|
|
$referrerPolicy && $this->referrerPolicy = $referrerPolicy; |
89
|
|
|
$type && $this->type = $type; |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|