Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
DomElement | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
getDomNode | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getContentModel | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
hasName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
hasAttribute | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
hasCategory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace pvc\html\dom; |
4 | |
5 | use pvc\interfaces\html\content_model\ContentCategory; |
6 | use pvc\interfaces\html\content_model\ContentModelInterface; |
7 | use pvc\interfaces\html\dom\DomElementInterface; |
8 | use pvc\interfaces\html\dom\DomNodeInterface; |
9 | |
10 | abstract class DomElement implements DomElementInterface |
11 | { |
12 | protected DomNodeInterface $domNode; |
13 | |
14 | protected ContentModelInterface $contentModel; |
15 | |
16 | /** |
17 | * @return DomNodeInterface |
18 | */ |
19 | public function getDomNode(): DomNodeInterface |
20 | { |
21 | return $this->domNode; |
22 | } |
23 | |
24 | /** |
25 | * @return ContentModelInterface |
26 | */ |
27 | public function getContentModel(): ContentModelInterface |
28 | { |
29 | return $this->contentModel; |
30 | } |
31 | |
32 | public function hasName(string $name): bool |
33 | { |
34 | return $this->getName() == $name; |
35 | } |
36 | |
37 | public function hasAttribute(string $name): bool |
38 | { |
39 | return $this->getAttribute($name) !== null; |
40 | } |
41 | |
42 | public function hasCategory(ContentCategory $category): bool |
43 | { |
44 | return (0 < ($this->getContentModel()->getCategories() & $category->value)); |
45 | } |
46 | } |