| @@ 92-121 (lines=30) @@ | ||
| 89 | /** |
|
| 90 | * Required by the Removable interface. |
|
| 91 | */ |
|
| 92 | public function remove(LoggerInterface $logger) |
|
| 93 | { |
|
| 94 | $hasRemovableElements = $this->configuration->get('element-blacklist') != ''; |
|
| 95 | $hasRemovableTypes = $this->configuration->get('type-blacklist') != ''; |
|
| 96 | foreach ($this->children as $child) { |
|
| 97 | // Check types. |
|
| 98 | if ($hasRemovableTypes && |
|
| 99 | !$this->configuration->isAllowedType($child->getType())) { |
|
| 100 | $logger->debug('Removing ' . $child . ' on type blacklist.'); |
|
| 101 | $this->removeChild($child); |
|
| 102 | ||
| 103 | continue; |
|
| 104 | } |
|
| 105 | ||
| 106 | // Check elements. |
|
| 107 | if ($hasRemovableElements && |
|
| 108 | $child instanceof Element && |
|
| 109 | !$this->configuration->isAllowedElement($child->getName())) { |
|
| 110 | $logger->debug('Removing ' . $child . ' on element blacklist.'); |
|
| 111 | $this->removeChild($child); |
|
| 112 | ||
| 113 | continue; |
|
| 114 | } |
|
| 115 | ||
| 116 | // Check children. |
|
| 117 | if ($child instanceof Removable) { |
|
| 118 | $child->remove($logger); |
|
| 119 | } |
|
| 120 | } |
|
| 121 | } |
|
| 122 | } |
|
| 123 | ||
| @@ 459-488 (lines=30) @@ | ||
| 456 | /** |
|
| 457 | * Required by the Removable interface. |
|
| 458 | */ |
|
| 459 | public function remove(LoggerInterface $logger) |
|
| 460 | { |
|
| 461 | $hasRemovableElements = $this->configuration->get('element-blacklist') != ''; |
|
| 462 | $hasRemovableTypes = $this->configuration->get('type-blacklist') != ''; |
|
| 463 | foreach ($this->children as $child) { |
|
| 464 | // Check types. |
|
| 465 | if ($hasRemovableTypes && |
|
| 466 | !$this->configuration->isAllowedType($child->getType())) { |
|
| 467 | $logger->debug('Removing ' . $child); |
|
| 468 | $this->removeChild($child); |
|
| 469 | ||
| 470 | continue; |
|
| 471 | } |
|
| 472 | ||
| 473 | // Check elements. |
|
| 474 | if ($hasRemovableElements && |
|
| 475 | $child instanceof self && |
|
| 476 | !$this->configuration->isAllowedElement($child->getName())) { |
|
| 477 | $logger->debug('Removing ' . $child); |
|
| 478 | $this->removeChild($child); |
|
| 479 | ||
| 480 | continue; |
|
| 481 | } |
|
| 482 | ||
| 483 | // Check children. |
|
| 484 | if ($child instanceof Removable) { |
|
| 485 | $child->remove($logger); |
|
| 486 | } |
|
| 487 | } |
|
| 488 | } |
|
| 489 | ||
| 490 | /** |
|
| 491 | * Required by the Token interface. |
|