Code Duplication    Length = 17-17 lines in 4 locations

src/Tokens/Elements/Dd.php 1 location

@@ 15-31 (lines=17) @@
12
 *
13
 * https://html.spec.whatwg.org/multipage/semantics.html#the-dd-element
14
 */
15
class Dd extends OpenElement
16
{
17
    protected function doClean(LoggerInterface $logger)
18
    {
19
        // Must be child of "dl" element.
20
        $parent = $this->getParent();
21
        if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT &&
22
            $parent !== null &&
23
            $parent->getName() != 'dl') {
24
            $logger->debug('Element "dt" must be a child of a "dl" element.');
25
26
            return false;
27
        }
28
29
        return true;
30
    }
31
}
32

src/Tokens/Elements/Figcaption.php 1 location

@@ 16-32 (lines=17) @@
13
 *
14
 * https://html.spec.whatwg.org/multipage/semantics.html#the-figcaption-element
15
 */
16
class Figcaption extends OpenElement implements FlowContent, SectioningRoot
17
{
18
    protected function doClean(LoggerInterface $logger)
19
    {
20
        // Must be child of "figure" element.
21
        $parent = $this->getParent();
22
        if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT &&
23
            $parent !== null &&
24
            $parent->getName() != 'figure') {
25
            $logger->debug('Element "figcaption" must be a child of a "figure" element.');
26
27
            return false;
28
        }
29
30
        return true;
31
    }
32
}
33

src/Tokens/Elements/Rp.php 1 location

@@ 17-33 (lines=17) @@
14
 *
15
 * https://html.spec.whatwg.org/multipage/semantics.html#the-rp-element
16
 */
17
class Rp extends OpenElement
18
{
19
    protected function doClean(LoggerInterface $logger)
20
    {
21
        // Must be child of "ruby" element.
22
        $parent = $this->getParent();
23
        if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT &&
24
            $parent !== null &&
25
            $parent->getName() != 'ruby') {
26
            $logger->debug('Element "rp" must be a child of a "ruby" element.');
27
28
            return false;
29
        }
30
31
        return true;
32
    }
33
}
34

src/Tokens/Elements/Rt.php 1 location

@@ 17-33 (lines=17) @@
14
 *
15
 * https://html.spec.whatwg.org/multipage/semantics.html#the-rt-element
16
 */
17
class Rt extends OpenElement
18
{
19
    protected function doClean(LoggerInterface $logger)
20
    {
21
        // Must be child of "ruby" element.
22
        $parent = $this->getParent();
23
        if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT &&
24
            $parent !== null &&
25
            $parent->getName() != 'ruby') {
26
            $logger->debug('Element "rt" must be a child of a "ruby" element.');
27
28
            return false;
29
        }
30
31
        return true;
32
    }
33
}
34