Passed
Branch master (7a0b0e)
by Randy
02:56
created

Root::appendPerson()   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\Test\Object;
4
5
use Dgame\Soap\Element;
6
use Dgame\Soap\Hydrator\Dom\AssemblableInterface;
7
use Dgame\Soap\Hydrator\Hydratable;
8
use Dgame\Soap\XmlNode;
9
10
/**
11
 * Class Root
12
 * @package Dgame\Soap\Test\Object
13
 */
14
final class Root extends Hydratable implements AssemblableInterface
15
{
16
    /**
17
     * @var Person[]
18
     */
19
    private $persons = [];
20
21
    /**
22
     * @param Person $person
23
     */
24
    public function appendPerson(Person $person)
25
    {
26
        $this->persons[] = $person;
27
    }
28
29
    /**
30
     * @return Person[]
31
     */
32
    public function getPersons(): array
33
    {
34
        return $this->persons;
35
    }
36
37
    /**
38
     * @return Element
39
     */
40
    public function assemble(): Element
41
    {
42
        $node = new XmlNode('soap-env');
43
        foreach ($this->persons as $person) {
44
            $node->appendChild($person->assemble());
45
        }
46
47
        return $node;
48
    }
49
}