Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| Html | |
100.00% |
6 / 6 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| lang | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toHtml | |
100.00% |
2 / 2 |
|
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 Html extends Element |
| 10 | { |
| 11 | public function __construct(?string $lang = null) |
| 12 | { |
| 13 | parent::__construct('html'); |
| 14 | if ($lang !== null) { |
| 15 | $this->element->setAttribute('lang', $lang); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | public function lang(string $lang): static |
| 20 | { |
| 21 | return $this->attr('lang', $lang); |
| 22 | } |
| 23 | |
| 24 | public function toHtml(bool $pretty = false): string |
| 25 | { |
| 26 | $doctype = "<!DOCTYPE html>\n"; |
| 27 | return $doctype . parent::toHtml($pretty); |
| 28 | } |
| 29 | } |