Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
50.00% |
5 / 10 |
|
33.33% |
2 / 6 |
CRAP | |
0.00% |
0 / 1 |
| DocumentType | |
50.00% |
5 / 10 |
|
33.33% |
2 / 6 |
10.50 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| nodeType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| nodeName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| textContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setTextContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| shallowClone | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Html\Dom; |
| 6 | |
| 7 | /** |
| 8 | * The DOCTYPE node. Per HTML5, only one DOCTYPE per document is supported and |
| 9 | * it must precede the documentElement. |
| 10 | */ |
| 11 | final class DocumentType extends Node |
| 12 | { |
| 13 | public string $name; |
| 14 | public string $publicId; |
| 15 | public string $systemId; |
| 16 | |
| 17 | public function __construct( |
| 18 | Document $ownerDocument, |
| 19 | string $name, |
| 20 | string $publicId = '', |
| 21 | string $systemId = '', |
| 22 | ) { |
| 23 | parent::__construct($ownerDocument); |
| 24 | $this->name = $name; |
| 25 | $this->publicId = $publicId; |
| 26 | $this->systemId = $systemId; |
| 27 | } |
| 28 | |
| 29 | public function nodeType(): NodeType |
| 30 | { |
| 31 | return NodeType::DocumentType; |
| 32 | } |
| 33 | |
| 34 | public function nodeName(): string |
| 35 | { |
| 36 | return $this->name; |
| 37 | } |
| 38 | |
| 39 | public function textContent(): string |
| 40 | { |
| 41 | return ''; |
| 42 | } |
| 43 | |
| 44 | public function setTextContent(string $text): void |
| 45 | { |
| 46 | // DocumentType has no editable text content per WHATWG. |
| 47 | } |
| 48 | |
| 49 | protected function shallowClone(): static |
| 50 | { |
| 51 | $copy = new self($this->ownerDocument, $this->name, $this->publicId, $this->systemId); |
| 52 | /** @var static $copy */ |
| 53 | return $copy; |
| 54 | } |
| 55 | } |