Completed
Push — master ( 62c01b...6e9edd )
by Kevin
02:26
created

DocType   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 88.89%

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 4
c 4
b 0
f 2
lcom 1
cbo 2
dl 0
loc 31
ccs 8
cts 9
cp 0.8889
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A clean() 0 9 2
A toHtml() 0 4 1
1
<?php
2
3
namespace Groundskeeper\Tokens;
4
5
use Groundskeeper\Configuration;
6
use Psr\Log\LoggerInterface;
7
8
class DocType extends AbstractValuedToken implements Cleanable
9
{
10
    /**
11
     * Constructor
12
     */
13 4
    public function __construct(Configuration $configuration, $parent = null, $value = null)
14
    {
15 4
        parent::__construct(Token::DOCTYPE, $configuration, $parent, $value);
16 4
    }
17
18
    /**
19
     * Required by the Cleanable interface.
20
     */
21 2
    public function clean(LoggerInterface $logger = null)
22
    {
23 2
        if ($this->configuration->get('clean-strategy') == Configuration::CLEAN_STRATEGY_NONE) {
24
            return true;
25
        }
26
27
        // DocType must not have any parent elements.
28 2
        return $this->getParent() === null;
29
    }
30
31
    /**
32
     * Required by the Token interface.
33
     */
34 3
    public function toHtml($prefix, $suffix)
35
    {
36 3
        return $prefix . '<!DOCTYPE ' . $this->getValue() . '>' . $suffix;
37
    }
38
}
39