Completed
Push — wip ( 681ec1 )
by z38
02:37
created

CreditorReferenceInformation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A asDom() 0 18 1
1
<?php
2
3
namespace Z38\SwissPayment\RemittanceInformation;
4
5
use Z38\SwissPayment\CreditorReference;
6
7
/**
8
 * CreditorReference
9
 */
10
class CreditorReferenceInformation implements RemittanceInformation
11
{
12
    protected $reference;
13
14
    /**
15
     * @param CreditorReference $reference
16
     */
17
    public function __construct(CreditorReference $reference)
18
    {
19
        $this->reference = $reference;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function asDom(\DOMDocument $doc)
26
    {
27
        $structured = $doc->createElement('Strd');
28
        $referenceInformation = $doc->createElement('CdtrRefInf');
29
30
        $type = $doc->createElement('Tp');
31
        $code = $doc->createElement('CdOrPrtry');
32
        $code->appendChild($doc->createElement('Cd', 'SCOR'));
33
        $type->appendChild($code);
34
        $referenceInformation->appendChild($type);
35
36
        $reference = $doc->createElement('Ref', $this->reference->format());
37
        $referenceInformation->appendChild($reference);
38
39
        $structured->appendChild($referenceInformation);
40
41
        return $structured;
42
    }
43
}
44