Completed
Push — master ( 56a459...0ee720 )
by Randy
03:34
created

XmlNode::hydration()   A

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 Dgame\Soap;
4
5
use Dgame\Soap\Hydrator\HydratorInterface;
6
7
/**
8
 * Class XmlNode
9
 * @package Dgame\Soap
10
 */
11
final class XmlNode extends XmlElement
12
{
13
    /**
14
     * @var Element[]
15
     */
16
    private $children = [];
17
18
    /**
19
     * @param Element $element
20
     */
21
    public function appendChild(Element $element)
22
    {
23
        $this->children[] = $element;
24
    }
25
26
    /**
27
     * @return Element[]|XmlNode[]
28
     */
29
    public function getChildren(): array
30
    {
31
        return $this->children;
32
    }
33
34
    /**
35
     * @return bool
36
     */
37
    public function hasChildren(): bool
38
    {
39
        return !empty($this->children);
40
    }
41
42
    /**
43
     * @param HydratorInterface $hydrator
44
     */
45
    public function hydration(HydratorInterface $hydrator)
46
    {
47
        $hydrator->hydrateXmlNode($this);
48
    }
49
}