Completed
Push — master ( f59553...fef96a )
by Kevin
02:59
created

Address   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 8
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 34
ccs 0
cts 22
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C doClean() 0 31 8
1
<?php
2
3
namespace Groundskeeper\Tokens\Elements;
4
5
use Groundskeeper\Tokens\ElementTypes\FlowContent;
6
use Groundskeeper\Tokens\ElementTypes\HeadingContent;
7
use Groundskeeper\Tokens\ElementTypes\OpenElement;
8
use Groundskeeper\Tokens\ElementTypes\SectioningContent;
9
use Groundskeeper\Tokens\Token;
10
use Psr\Log\LoggerInterface;
11
12
/**
13
 * "address" element
14
 *
15
 * https://html.spec.whatwg.org/multipage/semantics.html#the-address-element
16
 */
17
class Address extends OpenElement implements FlowContent
18
{
19
    protected function doClean(LoggerInterface $logger)
20
    {
21
        // No HeadingContent descendants
22
        // No SectioningContent descendants
23
        // No "header", "footer", or "address" element descendants.
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
24
        foreach ($this->children as $child) {
25
            if ($child instanceof HeadingContent) {
26
                $logger->debug('Heading Content elements not allowed as "address" element child.');
27
28
                return false;
29
            }
30
31
            if ($child instanceof SectioningContent) {
32
                $logger->debug('Sectioning Content elements not allowed as "address" element child.');
33
34
                return false;
35
            }
36
37
            if ($child->getType() == Token::ELEMENT) {
38
                if ($child->getName() == 'header' ||
39
                    $child->getName() == 'footer' ||
40
                    $child->getName() == 'address') {
41
                    $logger->debug('Elements "header", "footer", and "address" not allowed as "address" element child.');
42
43
                    return false;
44
                }
45
            }
46
        }
47
48
        return true;
49
    }
50
}
51