Completed
Push — master ( 0490e0...5154b1 )
by Kevin
03:30
created

Label::isInteractiveContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
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\FlowContent;
8
use Groundskeeper\Tokens\ElementTypes\InteractiveContent;
9
use Groundskeeper\Tokens\ElementTypes\OpenElement;
10
use Groundskeeper\Tokens\ElementTypes\PhrasingContent;
11
use Psr\Log\LoggerInterface;
12
13
/**
14
 * "label" element
15
 *
16
 * https://html.spec.whatwg.org/multipage/semantics.html#the-label-element
17
 */
18
class Label extends OpenElement implements FlowContent, InteractiveContent, PhrasingContent
19
{
20 2
    protected function getAllowedAttributes()
21
    {
22
        $labelAllowedAttributes = array(
23
            '/^for$/i' => Attribute::CS_STRING
24 2
        );
25
26 2
        return array_merge(
27 2
            $labelAllowedAttributes,
28 2
            parent::getAllowedAttributes()
29 2
        );
30
    }
31
32 7 View Code Duplication
    protected function removeInvalidSelf(LoggerInterface $logger)
0 ignored issues
show
Duplication introduced by
This method 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...
33
    {
34 7
        $label = new self($this->configuration, 0, 0, 'label');
35 7
        if ($this->hasAncestor($label)) {
36 1
            $logger->debug('Removing ' . $this . '. Cannot be have "label" element ancestor.');
37
38 1
            return true;
39
        }
40
41 7
        return false;
42
    }
43
44 1
    public function isInteractiveContent()
45
    {
46 1
        return true;
47
    }
48
}
49