FinancialInstitutionAddress   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 38
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A asDom() 0 8 1
1
<?php
2
3
namespace Z38\SwissPayment;
4
5
/**
6
 * FinancialInstitutionAddress holds information to identify a FI by name and address
7
 */
8
class FinancialInstitutionAddress implements FinancialInstitutionInterface
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $name;
14
15
    /**
16
     * @var PostalAddressInterface
17
     */
18
    protected $address;
19
20
    /**
21
     * Constructor
22
     *
23
     * @param string                 $name    Name of the FI
24
     * @param PostalAddressInterface $address Address of the FI
25
     *
26
     * @throws \InvalidArgumentException When the name is invalid.
27
     */
28 3
    public function __construct($name, PostalAddressInterface $address)
29
    {
30 3
        $this->name = Text::assert($name, 70);
31 3
        $this->address = $address;
32 3
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 2
    public function asDom(\DOMDocument $doc)
38
    {
39 2
        $xml = $doc->createElement('FinInstnId');
40 2
        $xml->appendChild(Text::xml($doc, 'Nm', $this->name));
41 2
        $xml->appendChild($this->address->asDom($doc));
42
43 2
        return $xml;
44
    }
45
}
46