Completed
Push — master ( 478aa0...3b6cb2 )
by Yann
02:11
created

EntryTransactionDetail   A

Complexity

Total Complexity 24

Size/Duplication

Total Lines 213
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 0

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
wmc 24
lcom 5
cbo 0
dl 0
loc 213
ccs 35
cts 56
cp 0.625
rs 10
c 0
b 0
f 0

19 Methods

Rating   Name   Duplication   Size   Complexity  
A addReference() 0 4 1
A getReferences() 0 4 1
A getReference() 0 8 2
A addRelatedParty() 0 4 1
A getRelatedParties() 0 4 1
A getRelatedParty() 0 8 2
A addRelatedAgent() 0 4 1
A getRelatedAgents() 0 4 1
A getRelatedAgent() 0 8 2
A setRemittanceInformation() 0 4 1
A getRemittanceInformation() 0 7 2
A getReturnInformation() 0 4 1
A setReturnInformation() 0 4 1
A setAdditionalTransactionInformation() 0 4 1
A getAdditionalTransactionInformation() 0 7 2
A getBankTransactionCode() 0 4 1
A setBankTransactionCode() 0 4 1
A getAmountDetails() 0 4 1
A setAmountDetails() 0 4 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 RelatedAgent[]
23
     */
24
    private $relatedAgents = [];
25
    /**
26
     * @var RemittanceInformation
27
     */
28
    private $remittanceInformation;
29
    /**
30
     * @var ReturnInformation
31
     */
32
    private $returnInformation;
33
    /**
34
     * @var AdditionalTransactionInformation
35
     */
36
    private $additionalTransactionInformation;
37
38
    /**
39
     * @var BankTransactionCode
40
     */
41
    private $bankTransactionCode;
42
43
    /**
44
     * @var AmountDetails
45
     */
46
    private $amountDetails;
47
48
    /**
49
     * @param Reference $reference
50
     */
51 16
    public function addReference(Reference $reference)
52
    {
53 16
        $this->references[] = $reference;
54 16
    }
55
56
    /**
57
     * @return Reference[]
58
     */
59 1
    public function getReferences()
60
    {
61 1
        return $this->references;
62
    }
63
64
    /**
65
     * @return Reference
66
     * @throws BadMethodCallException
67
     */
68 1
    public function getReference()
69
    {
70 1
        if (isset($this->references[0])) {
71 1
            return $this->references[0];
72
        } else {
73
            throw new BadMethodCallException('There are no references at all for this transaction');
74
        }
75
    }
76
77
    /**
78
     * @param RelatedParty $relatedParty
79
     */
80 20
    public function addRelatedParty(RelatedParty $relatedParty)
81
    {
82 20
        $this->relatedParties[] = $relatedParty;
83 20
    }
84
85
    /**
86
     * @return RelatedParty[]
87
     */
88 3
    public function getRelatedParties()
89
    {
90 3
        return $this->relatedParties;
91
    }
92
93
    /**
94
     * @return RelatedParty
95
     * @throws BadMethodCallException
96
     */
97 1
    public function getRelatedParty()
98
    {
99 1
        if (isset($this->relatedParties[0])) {
100 1
            return $this->relatedParties[0];
101
        } else {
102
            throw new BadMethodCallException('There are no related parties at all for this transaction');
103
        }
104
    }
105
106
    /**
107
     * @param RelatedAgent $relatedAgent
108
     */
109 16
    public function addRelatedAgent(RelatedAgent $relatedAgent)
110
    {
111 16
        $this->relatedAgents[] = $relatedAgent;
112 16
    }
113
114
    /**
115
     * @return RelatedAgent[]
116
     */
117 1
    public function getRelatedAgents()
118
    {
119 1
        return $this->relatedAgents;
120
    }
121
122
    /**
123
     * @return RelatedAgent
124
     * @throws BadMethodCallException
125
     */
126
    public function getRelatedAgent()
127
    {
128
        if (isset($this->relatedAgents[0])) {
129
            return $this->relatedAgents[0];
130
        } else {
131
            throw new BadMethodCallException('There are no related agents at all for this transaction');
132
        }
133
    }
134
135
    /**
136
     * @param RemittanceInformation $remittanceInformation
137
     */
138 16
    public function setRemittanceInformation(RemittanceInformation $remittanceInformation)
139
    {
140 16
        $this->remittanceInformation = $remittanceInformation;
141 16
    }
142
143
    /**
144
     * @return RemittanceInformation
145
     */
146 3
    public function getRemittanceInformation()
147
    {
148 3
        if ($this->remittanceInformation === null) {
149
            throw new BadMethodCallException();
150
        }
151 3
        return $this->remittanceInformation;
152
    }
153
154
    /**
155
     * @return ReturnInformation|null
156
     */
157
    public function getReturnInformation()
158
    {
159
        return $this->returnInformation;
160
    }
161
162
    /**
163
     * @param ReturnInformation $information
164
     */
165
    public function setReturnInformation(ReturnInformation $information)
166
    {
167
        $this->returnInformation = $information;
168
    }
169
170
    /**
171
     * @param AdditionalTransactionInformation $additionalTransactionInformation
172
     */
173
    public function setAdditionalTransactionInformation(AdditionalTransactionInformation $additionalTransactionInformation)
174
    {
175
        $this->additionalTransactionInformation = $additionalTransactionInformation;
176
    }
177
178
    /**
179
     * @return AdditionalTransactionInformation
180
     */
181
    public function getAdditionalTransactionInformation()
182
    {
183
        if ($this->additionalTransactionInformation === null) {
184
            throw new BadMethodCallException();
185
        }
186
        return $this->additionalTransactionInformation;
187
    }
188
189
    /**
190
     * @return BankTransactionCode
191
     */
192 1
    public function getBankTransactionCode()
193
    {
194 1
        return $this->bankTransactionCode;
195
    }
196
197
    /**
198
     * @param BankTransactionCode $bankTransactionCode
199
     */
200 20
    public function setBankTransactionCode(BankTransactionCode $bankTransactionCode)
201
    {
202 20
        $this->bankTransactionCode = $bankTransactionCode;
203 20
    }
204
205
206
    /**
207
     * @return AmountDetails
208
     */
209
    public function getAmountDetails()
210
    {
211
        return $this->amountDetails;
212
    }
213
214
    /**
215
     * @param AmountDetails $amountDetails
216
     */
217 6
    public function setAmountDetails(AmountDetails $amountDetails)
218
    {
219 6
        $this->amountDetails = $amountDetails;
220 6
    }
221
222
223
}
224