@@ 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); |
|
101 | $this->removeChild($child); |
|
102 | ||
103 | continue; |
|
104 | } |
|
105 | ||
106 | // Check elements. |
|
107 | if ($hasRemovableElements && |
|
108 | $child->getType() == Token::ELEMENT && |
|
109 | !$this->configuration->isAllowedElement($child->getName())) { |
|
110 | $logger->debug('Removing ' . $child); |
|
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 |
@@ 416-445 (lines=30) @@ | ||
413 | /** |
|
414 | * Required by the Removable interface. |
|
415 | */ |
|
416 | public function remove(LoggerInterface $logger) |
|
417 | { |
|
418 | $hasRemovableElements = $this->configuration->get('element-blacklist') != ''; |
|
419 | $hasRemovableTypes = $this->configuration->get('type-blacklist') != ''; |
|
420 | foreach ($this->children as $child) { |
|
421 | // Check types. |
|
422 | if ($hasRemovableTypes && |
|
423 | !$this->configuration->isAllowedType($child->getType())) { |
|
424 | $logger->debug('Removing ' . $child); |
|
425 | $this->removeChild($child); |
|
426 | ||
427 | continue; |
|
428 | } |
|
429 | ||
430 | // Check elements. |
|
431 | if ($hasRemovableElements && |
|
432 | $child->getType() == Token::ELEMENT && |
|
433 | !$this->configuration->isAllowedElement($child->getName())) { |
|
434 | $logger->debug('Removing ' . $child); |
|
435 | $this->removeChild($child); |
|
436 | ||
437 | continue; |
|
438 | } |
|
439 | ||
440 | // Check children. |
|
441 | if ($child instanceof Removable) { |
|
442 | $child->remove($logger); |
|
443 | } |
|
444 | } |
|
445 | } |
|
446 | ||
447 | /** |
|
448 | * Required by the Token interface. |