Completed
Push — scrutinizer ( 42ac6a...7bc18e )
by z38
02:40
created

FinancialInstitutionAddress   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

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 of the FI
25
     */
26 2
    public function __construct($name, PostalAddressInterface $address)
27
    {
28 2
        $this->name = (string) $name;
29 2
        $this->address = $address;
30 2
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 2
    public function asDom(\DOMDocument $doc)
36
    {
37 2
        $xml = $doc->createElement('FinInstnId');
38 2
        $xml->appendChild($doc->createElement('Nm', $this->name));
39 2
        $xml->appendChild($this->address->asDom($doc));
40
41 2
        return $xml;
42
    }
43
}
44