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)
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

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