Col::getAllowedAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Groundskeeper\Tokens\Elements;
4
5
use Groundskeeper\Tokens\Attribute;
6
use Groundskeeper\Tokens\Element;
7
use Groundskeeper\Tokens\ElementTypes\ClosedElement;
8
use Psr\Log\LoggerInterface;
9
10
/**
11
 * "col" element
12
 *
13
 * https://html.spec.whatwg.org/multipage/semantics.html#the-col-element
14
 */
15 View Code Duplication
class Col extends ClosedElement
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17 2
    protected function getAllowedAttributes()
18
    {
19
        $colAllowedAttributes = array(
20 2
            '/^span$/i' => Attribute::INT,
21
        );
22
23 2
        return array_merge(
24 2
            $colAllowedAttributes,
25 2
            parent::getAllowedAttributes()
26
        );
27
    }
28
29 2
    protected function removeInvalidSelf(LoggerInterface $logger) : bool
30
    {
31
        // "colgroup" must be parent.
32 2
        $parent = $this->getParent();
33 2
        if ($parent !== null && !$parent instanceof Colgroup) {
34 1
            $logger->debug('Removing ' . $this . '. Must be a child of the "colgroup" element.');
35
36 1
            return true;
37
        }
38
39 1
        return false;
40
    }
41
}
42