Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| NamesPermitted | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| test | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace pvc\html\rules\content_rules\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 NamesPermitted 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 | { |
| 22 | if (in_array($content->getDomElement()->getName(), $this->names)) return ContentPermission::GRANTED; |
| 23 | return ContentPermission::NOT_APPLICABLE; |
| 24 | } |
| 25 | } |