Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| AbstractRule | |
0.00% |
0 / 5 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| getContentModel | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDomElement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDomNode | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| hasParentWith | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| hasAncestorWith | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace pvc\html\rules; |
| 4 | |
| 5 | use pvc\interfaces\html\content_model\ContentModelInterface; |
| 6 | use pvc\interfaces\html\dom\DomElementInterface; |
| 7 | use pvc\interfaces\html\dom\DomNodeInterface; |
| 8 | use pvc\interfaces\html\rules\AbstractRuleInterface; |
| 9 | |
| 10 | abstract class AbstractRule implements AbstractRuleInterface |
| 11 | { |
| 12 | protected ContentModelInterface $contentModel; |
| 13 | |
| 14 | public function getContentModel(): ContentModelInterface |
| 15 | { |
| 16 | return $this->contentModel; |
| 17 | } |
| 18 | |
| 19 | public function getDomElement(): DomElementInterface |
| 20 | { |
| 21 | return $this->contentModel->getDomElement(); |
| 22 | } |
| 23 | |
| 24 | public function getDomNode(): DomNodeInterface |
| 25 | { |
| 26 | return $this->contentModel->getDomElement()->getDomNode(); |
| 27 | } |
| 28 | |
| 29 | public function hasParentWith(callable $callback): bool |
| 30 | { |
| 31 | return $this->getDomNode()->hasParentWith($callback); |
| 32 | } |
| 33 | |
| 34 | public function hasAncestorWith(callable $callback): bool |
| 35 | { |
| 36 | return $this->getDomNode()->hasAncestorWith($callback); |
| 37 | } |
| 38 | } |