Code Duplication    Length = 14-19 lines in 3 locations

src/Tokens/Elements/Menu.php 1 location

@@ 40-57 (lines=18) @@
37
        }
38
    }
39
40
    protected function removeInvalidChildren(LoggerInterface $logger)
41
    {
42
        // Only "li" and ScriptSupporting elements allowed.
43
        foreach ($this->children as $child) {
44
            if ($child->getType() == Token::COMMENT) {
45
                continue;
46
            }
47
48
            if ($child->getType() != Token::ELEMENT) {
49
                $logger->debug('Removing ' . $child . '. Only elements "li", "menuitem", "hr", "menu", and script supporting elements allowed as children of "menu" element.');
50
                $this->removeChild($child);
51
52
                continue;
53
            }
54
55
            /// @todo
56
        }
57
    }
58
}
59

src/Tokens/Elements/Time.php 1 location

@@ 31-49 (lines=19) @@
28
        );
29
    }
30
31
    protected function removeInvalidChildren(LoggerInterface $logger)
32
    {
33
        // If attribute "datetime" is not present, then only TEXT type
34
        // children allowed.
35
        if (!$this->hasAttribute('datetime')) {
36
            foreach ($this->children as $child) {
37
                if ($child->getType() == Token::COMMENT) {
38
                    continue;
39
                }
40
41
                if ($child->getType() != Token::TEXT) {
42
                    $logger->debug('Removing ' . $child . '. Element "time" without "datetime" attribute may only contain TEXT.');
43
                    $this->removeChild($child);
44
45
                    continue;
46
                }
47
            }
48
        }
49
    }
50
}
51

src/Tokens/Elements/Title.php 1 location

@@ 16-29 (lines=14) @@
13
 */
14
class Title extends OpenElement implements MetadataContent
15
{
16
    protected function removeInvalidChildren(LoggerInterface $logger)
17
    {
18
        // TITLE must contain only non-whitespace text or comments.
19
        foreach ($this->children as $child) {
20
            if ($child->getType() == Token::COMMENT) {
21
                continue;
22
            }
23
24
            if ($child->getType() != Token::TEXT) {
25
                $logger->debug('Removing ' . $child . '. Only text allowed inside TITLE.');
26
                $this->removeChild($child);
27
            }
28
        }
29
    }
30
}
31