Container::isValidChild()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace hemio\form;
4
5
use hemio\html;
6
7
/**
8
 * Containers collect several HTML generating elements without
9
 * adding additional visible structure to the output. They basically act like
10
 * (@link hemio\html\Abstract_\ElementContent) without producing an element tag.
11
 *
12
 * @since 1.0
13
 */
14
class Container implements html\Interface_\MaintainsChilds, html\Interface_\HtmlCode
15
{
16
17
    use html\Trait_\AppendageMaintainance,
18
        html\Trait_\ChildMaintainance,
19
        \hemio\html\Trait_\HooksToString;
20
21
    /**
22
     *
23
     * @return string
24
     */
25
    public function __toString()
26
    {
27
        foreach ($this->hooksToString as $hook)
28
            $hook($this);
29
30
        $return = '';
31
32
        foreach ($this as $child)
33
            $return .= $child->__toString();
34
35
        return $return;
36
    }
37
38
    public function isValidChild(html\Interface_\HtmlCode $child)
39
    {
40
        return true;
41
    }
42
43
    public function addChild(html\Interface_\HtmlCode $child)
44
    {
45
        return $this->addChildInternal($child);
46
    }
47
48
    public function describe()
49
    {
50
        return sprintf('CONTAINER(%d)', $this->count());
51
    }
52
}
53