Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| Script | |
100.00% |
7 / 7 |
|
100.00% |
5 / 5 |
6 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| src | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| defer | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| async | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| type | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Epic64\Elem\Elements; |
| 6 | |
| 7 | use Epic64\Elem\Element; |
| 8 | |
| 9 | class Script extends Element |
| 10 | { |
| 11 | public function __construct(?string $code = null, ?string $src = null) |
| 12 | { |
| 13 | parent::__construct('script', $code); |
| 14 | if ($src !== null) { |
| 15 | $this->element->setAttribute('src', $src); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | public function src(string $src): static |
| 20 | { |
| 21 | return $this->attr('src', $src); |
| 22 | } |
| 23 | |
| 24 | public function defer(): static |
| 25 | { |
| 26 | return $this->attr('defer', 'defer'); |
| 27 | } |
| 28 | |
| 29 | public function async(): static |
| 30 | { |
| 31 | return $this->attr('async', 'async'); |
| 32 | } |
| 33 | |
| 34 | public function type(string $type): static |
| 35 | { |
| 36 | return $this->attr('type', $type); |
| 37 | } |
| 38 | } |