Completed
Push — master ( 91ab9a...64950e )
by Kevin
04:15
created

Meter::removeInvalidSelf()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 11
loc 11
ccs 0
cts 9
cp 0
rs 9.4285
cc 2
eloc 6
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Groundskeeper\Tokens\Elements;
4
5
use Groundskeeper\Tokens\Attribute;
6
use Groundskeeper\Tokens\ElementTypes\FlowContent;
7
use Groundskeeper\Tokens\ElementTypes\OpenElement;
8
use Groundskeeper\Tokens\ElementTypes\PhrasingContent;
9
10
/**
11
 * "meter" element
12
 *
13
 * https://html.spec.whatwg.org/multipage/forms.html#the-meter-element
14
 */
15
class Meter extends OpenElement implements FlowContent, PhrasingContent
16
{
17
    protected function getAllowedAttributes()
18
    {
19
        $meterAllowedAttributes = array(
20
            '/^value$/i' => Attribute::CS_STRING,
21
            '/^min$/i' => Attribute::CS_STRING,
22
            '/^max$/i' => Attribute::CS_STRING,
23
            '/^low$/i' => Attribute::CS_STRING,
24
            '/^high$/i' => Attribute::CS_STRING,
25
            '/^optimum$/i' => Attribute::CS_STRING
26
        );
27
28
        return array_merge(
29
            $meterAllowedAttributes,
30
            parent::getAllowedAttributes()
31
        );
32
    }
33
34 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...
35
    {
36
        $meter = new self($this->configuration, 'meter');
37
        if ($this->hasAncestor($meter)) {
38
            $logger->debug('Removing ' . $this . '. "Meter" element cannot contain other "meter" elements.');
39
40
            return true;
41
        }
42
43
        return false;
44
    }
45
}
46