Code Duplication    Length = 27-28 lines in 2 locations

src/Tokens/Elements/Col.php 1 location

@@ 15-41 (lines=27) @@
12
 *
13
 * https://html.spec.whatwg.org/multipage/semantics.html#the-col-element
14
 */
15
class Col extends ClosedElement
16
{
17
    protected function getAllowedAttributes()
18
    {
19
        $colAllowedAttributes = array(
20
            '/^span$/i' => Attribute::INT,
21
        );
22
23
        return array_merge(
24
            $colAllowedAttributes,
25
            parent::getAllowedAttributes()
26
        );
27
    }
28
29
    protected function removeInvalidSelf(LoggerInterface $logger) : bool
30
    {
31
        // "colgroup" must be parent.
32
        $parent = $this->getParent();
33
        if ($parent !== null && !$parent instanceof Colgroup) {
34
            $logger->debug('Removing ' . $this . '. Must be a child of the "colgroup" element.');
35
36
            return true;
37
        }
38
39
        return false;
40
    }
41
}
42

src/Tokens/Elements/Param.php 1 location

@@ 14-41 (lines=28) @@
11
 *
12
 * https://html.spec.whatwg.org/multipage/semantics.html#the-param-element
13
 */
14
class Param extends ClosedElement
15
{
16
    protected function getAllowedAttributes()
17
    {
18
        $paramAllowedAttributes = array(
19
            '/^name$/i' => Attribute::CS_STRING,
20
            '/^value$/i' => Attribute::CS_STRING
21
        );
22
23
        return array_merge(
24
            $paramAllowedAttributes,
25
            parent::getAllowedAttributes()
26
        );
27
    }
28
29
    protected function removeInvalidSelf(LoggerInterface $logger) : bool
30
    {
31
        // Must be child of "object" element.
32
        $parent = $this->getParent();
33
        if ($parent !== null && !$parent instanceof Object) {
34
            $logger->debug('Removing ' . $this . '. Must be a child of "object" element.');
35
36
            return true;
37
        }
38
39
        return false;
40
    }
41
}
42