Completed
Push — master ( e0ac7a...8eddfc )
by Kevin
03:21
created

Dd::doClean()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 8
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 14
loc 14
ccs 8
cts 8
cp 1
rs 9.2
cc 4
eloc 8
nc 2
nop 1
crap 4
1
<?php
2
3
namespace Groundskeeper\Tokens\Elements;
4
5
use Groundskeeper\Configuration;
6
use Groundskeeper\Tokens\ElementTypes\OpenElement;
7
use Psr\Log\LoggerInterface;
8
9
/**
10
 * "dd" element
11
 *
12
 * https://html.spec.whatwg.org/multipage/semantics.html#the-dd-element
13
 */
14 View Code Duplication
class Dd 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...
15
{
16 3
    protected function doClean(LoggerInterface $logger)
17
    {
18
        // Must be child of "dl" element.
19 3
        $parent = $this->getParent();
20 3
        if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT &&
21 3
            $parent !== null &&
22 3
            $parent->getName() != 'dl') {
23 1
            $logger->debug('Element "dt" must be a child of a "dl" element.');
24
25 1
            return false;
26
        }
27
28 3
        return true;
29
    }
30
}
31