Rp::removeInvalidSelf()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 2
nop 1
crap 3
1
<?php
2
3
namespace Groundskeeper\Tokens\Elements;
4
5
use Groundskeeper\Tokens\ElementTypes\OpenElement;
6
use Psr\Log\LoggerInterface;
7
8
/**
9
 * "rp" element
10
 *
11
 * https://html.spec.whatwg.org/multipage/semantics.html#the-rp-element
12
 */
13 View Code Duplication
class Rp extends OpenElement
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...
14
{
15 2
    protected function removeInvalidSelf(LoggerInterface $logger) : bool
16
    {
17
        // Must be child of "ruby" element.
18 2
        $parent = $this->getParent();
19 2
        if ($parent !== null && !$parent instanceof Ruby) {
20 1
            $logger->debug('Removing ' . $this . '. Must be a child of a "ruby" element.');
21
22 1
            return true;
23
        }
24
25 1
        return false;
26
    }
27
}
28