Document::__toString()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
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