@@ 423-452 (lines=30) @@ | ||
420 | /** |
|
421 | * Required by the Removable interface. |
|
422 | */ |
|
423 | public function remove(LoggerInterface $logger) |
|
424 | { |
|
425 | $hasRemovableElements = $this->configuration->get('element-blacklist') != ''; |
|
426 | $hasRemovableTypes = $this->configuration->get('type-blacklist') != ''; |
|
427 | foreach ($this->children as $child) { |
|
428 | // Check types. |
|
429 | if ($hasRemovableTypes && |
|
430 | !$this->configuration->isAllowedType($child->getType())) { |
|
431 | $logger->debug('Removing ' . $child); |
|
432 | $this->removeChild($child); |
|
433 | ||
434 | continue; |
|
435 | } |
|
436 | ||
437 | // Check elements. |
|
438 | if ($hasRemovableElements && |
|
439 | $child instanceof self && |
|
440 | !$this->configuration->isAllowedElement($child->getName())) { |
|
441 | $logger->debug('Removing ' . $child); |
|
442 | $this->removeChild($child); |
|
443 | ||
444 | continue; |
|
445 | } |
|
446 | ||
447 | // Check children. |
|
448 | if ($child instanceof Removable) { |
|
449 | $child->remove($logger); |
|
450 | } |
|
451 | } |
|
452 | } |
|
453 | ||
454 | /** |
|
455 | * Required by the Token interface. |
@@ 91-120 (lines=30) @@ | ||
88 | /** |
|
89 | * Required by the Removable interface. |
|
90 | */ |
|
91 | public function remove(LoggerInterface $logger) |
|
92 | { |
|
93 | $hasRemovableElements = $this->configuration->get('element-blacklist') != ''; |
|
94 | $hasRemovableTypes = $this->configuration->get('type-blacklist') != ''; |
|
95 | foreach ($this->children as $child) { |
|
96 | // Check types. |
|
97 | if ($hasRemovableTypes && |
|
98 | !$this->configuration->isAllowedType($child->getType())) { |
|
99 | $logger->debug('Removing ' . $child . ' on type blacklist.'); |
|
100 | $this->removeChild($child); |
|
101 | ||
102 | continue; |
|
103 | } |
|
104 | ||
105 | // Check elements. |
|
106 | if ($hasRemovableElements && |
|
107 | $child instanceof Element && |
|
108 | !$this->configuration->isAllowedElement($child->getName())) { |
|
109 | $logger->debug('Removing ' . $child . ' on element blacklist.'); |
|
110 | $this->removeChild($child); |
|
111 | ||
112 | continue; |
|
113 | } |
|
114 | ||
115 | // Check children. |
|
116 | if ($child instanceof Removable) { |
|
117 | $child->remove($logger); |
|
118 | } |
|
119 | } |
|
120 | } |
|
121 | } |
|
122 |