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

Root   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 36
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A appendPerson() 0 4 1
A getPersons() 0 4 1
A assemble() 0 9 2
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
}