Completed
Pull Request — master (#31)
by
unknown
02:29
created

EntryTransactionDetail::addReference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Genkgo\Camt\DTO;
4
5
use BadMethodCallException;
6
7
/**
8
 * Class EntryTransactionDetail
9
 * @package Genkgo\Camt\DTO
10
 */
11
class EntryTransactionDetail
12
{
13
    /**
14
     * @var Reference[]
15
     */
16
    private $references = [];
17
    /**
18
     * @var RelatedParty[]
19
     */
20
    private $relatedParties = [];
21
    /**
22
     * @var RemittanceInformation
23
     */
24
    private $remittanceInformation;
25
    /**
26
     * @var ReturnInformation
27
     */
28
    private $returnInformation;
29
    /**
30
     * @var AdditionalTransactionInformation
31
     */
32
    private $additionalTransactionInformation;
33
34
    /**
35
     * @var BankTransactionCode
36
     */
37
    private $bankTransactionCode;
38
39
    /**
40
     * @param Reference $reference
41
     */
42 16
    public function addReference(Reference $reference)
43
    {
44 16
        $this->references[] = $reference;
45 16
    }
46
47
    /**
48
     * @return Reference[]
49
     */
50 1
    public function getReferences()
51
    {
52 1
        return $this->references;
53
    }
54
55
    /**
56
     * @return Reference
57
     * @throws BadMethodCallException
58
     */
59 1
    public function getReference()
60
    {
61 1
        if (isset($this->references[0])) {
62 1
            return $this->references[0];
63
        } else {
64
            throw new BadMethodCallException('There are no references at all for this transaction');
65
        }
66
    }
67
68
    /**
69
     * @param RelatedParty $relatedParty
70
     */
71 17
    public function addRelatedParty(RelatedParty $relatedParty)
72
    {
73 17
        $this->relatedParties[] = $relatedParty;
74 17
    }
75
76
    /**
77
     * @return RelatedParty[]
78
     */
79 1
    public function getRelatedParties()
80
    {
81 1
        return $this->relatedParties;
82
    }
83
84
    /**
85
     * @return RelatedParty
86
     * @throws BadMethodCallException
87
     */
88 1
    public function getRelatedParty()
89
    {
90 1
        if (isset($this->relatedParties[0])) {
91 1
            return $this->relatedParties[0];
92
        } else {
93
            throw new BadMethodCallException('There are no related parties at all for this transaction');
94
        }
95
    }
96
97
    /**
98
     * @param RemittanceInformation $remittanceInformation
99
     */
100 16
    public function setRemittanceInformation(RemittanceInformation $remittanceInformation)
101
    {
102 16
        $this->remittanceInformation = $remittanceInformation;
103 16
    }
104
105
    /**
106
     * @return RemittanceInformation
107
     */
108 3
    public function getRemittanceInformation()
109
    {
110 3
        if ($this->remittanceInformation === null) {
111
            throw new BadMethodCallException();
112
        }
113 3
        return $this->remittanceInformation;
114
    }
115
116
    /**
117
     * @return ReturnInformation|null
118
     */
119
    public function getReturnInformation()
120
    {
121
        return $this->returnInformation;
122
    }
123
124
    /**
125
     * @param ReturnInformation $information
126
     */
127
    public function setReturnInformation(ReturnInformation $information)
128
    {
129
        $this->returnInformation = $information;
130
    }
131
132
    /**
133
     * @param AdditionalTransactionInformation $additionalTransactionInformation
134
     */
135
    public function setAdditionalTransactionInformation(AdditionalTransactionInformation $additionalTransactionInformation)
136
    {
137
        $this->additionalTransactionInformation = $additionalTransactionInformation;
138
    }
139
140
    /**
141
     * @return AdditionalTransactionInformation
142
     */
143
    public function getAdditionalTransactionInformation()
144
    {
145
        if ($this->additionalTransactionInformation === null) {
146
            throw new BadMethodCallException();
147
        }
148
        return $this->additionalTransactionInformation;
149
    }
150
151
    /**
152
     * @return BankTransactionCode
153
     */
154 1
    public function getBankTransactionCode()
155
    {
156 1
        return $this->bankTransactionCode;
157
    }
158
159
    /**
160
     * @param BankTransactionCode $bankTransactionCode
161
     */
162 17
    public function setBankTransactionCode($bankTransactionCode)
163
    {
164 17
        $this->bankTransactionCode = $bankTransactionCode;
165 17
    }
166
}
167