Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| NamesNotPermitted | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| test | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace pvc\html\rules\content_rules\not_permitted; |
| 4 | |
| 5 | use pvc\html\rules\AbstractRule; |
| 6 | use pvc\interfaces\html\content_model\ContentPermission; |
| 7 | use pvc\interfaces\html\dom\DomNodeInterface; |
| 8 | use pvc\interfaces\html\rules\ContentRuleInterface; |
| 9 | |
| 10 | class NamesNotPermitted extends AbstractRule implements ContentRuleInterface |
| 11 | { |
| 12 | /** |
| 13 | * @param array<string> $names |
| 14 | */ |
| 15 | public function __construct( |
| 16 | protected array $names) |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | public function test(DomNodeInterface $content): ContentPermission { |
| 21 | foreach ($this->names as $name) { |
| 22 | if ($content->getDomElement()->hasName($name)) return ContentPermission::DENIED; |
| 23 | } |
| 24 | return ContentPermission::NOT_APPLICABLE; |
| 25 | } |
| 26 | } |