Document   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 6
c 3
b 0
f 1
lcom 0
cbo 4
dl 0
loc 39
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 7 2
A getHtml() 0 4 1
A isValidChild() 0 4 1
A describe() 0 4 1
1
<?php
2
3
namespace hemio\html;
4
5
/**
6
 *
7
 *
8
 */
9
class Document implements Interface_\HtmlCode, Interface_\MaintainsChilds
10
{
11
12
    use Trait_\AppendageMaintainance,
13
        Trait_\ChildMaintainance,
14
        Trait_\HooksToString;
15
16
    public function __construct(Interface_\ContentModelText $objTitleContent)
17
    {
18
        $this['_HTML'] = new Html($objTitleContent);
19
    }
20
21
    public function __toString()
22
    {
23
        foreach ($this->hooksToString as $hook)
24
            $hook($this);
25
26
        return '<!DOCTYPE html>'.PHP_EOL.$this['_HTML']->__toString();
27
    }
28
29
    /**
30
     *
31
     * @return Html
32
     */
33
    public function getHtml()
34
    {
35
        return $this['_HTML'];
36
    }
37
38
    public function isValidChild(Interface_\HtmlCode $child)
39
    {
40
        return $child instanceof Html;
41
    }
42
43
    public function describe()
44
    {
45
        return __CLASS__;
46
    }
47
}
48