Rp   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 15
loc 15
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A removeInvalidSelf() 12 12 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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