Completed
Pull Request — master (#44)
by
unknown
06:33
created

EntryTransactionDetail::setCharges()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
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 RelatedDates
31
     */
32
    private $relatedDates;
33
    /**
34
     * @var ReturnInformation
35
     */
36
    private $returnInformation;
37
    /**
38
     * @var AdditionalTransactionInformation
39
     */
40
    private $additionalTransactionInformation;
41
42
    /**
43
     * @var BankTransactionCode
44
     */
45
    private $bankTransactionCode;
46
47
    /**
48
     * @var AmountDetails
49
     */
50
    private $amountDetails;
51 16
52
    /**
53 16
     * @var Amount
54 16
     */
55
    private $amount;
56
57
    /**
58
     * @param Reference $reference
59 1
     */
60
    public function addReference(Reference $reference)
61 1
    {
62
        $this->references[] = $reference;
63
    }
64
65
    /**
66
     * @return Reference[]
67
     */
68 1
    public function getReferences()
69
    {
70 1
        return $this->references;
71 1
    }
72
73
    /**
74
     * @return Reference
75
     * @throws BadMethodCallException
76
     */
77
    public function getReference()
78
    {
79
        if (isset($this->references[0])) {
80 20
            return $this->references[0];
81
        } else {
82 20
            throw new BadMethodCallException('There are no references at all for this transaction');
83 20
        }
84
    }
85
86
    /**
87
     * @param RelatedParty $relatedParty
88 3
     */
89
    public function addRelatedParty(RelatedParty $relatedParty)
90 3
    {
91
        $this->relatedParties[] = $relatedParty;
92
    }
93
94
    /**
95
     * @return RelatedParty[]
96
     */
97 1
    public function getRelatedParties()
98
    {
99 1
        return $this->relatedParties;
100 1
    }
101
102
    /**
103
     * @return RelatedParty
104
     * @throws BadMethodCallException
105
     */
106
    public function getRelatedParty()
107
    {
108
        if (isset($this->relatedParties[0])) {
109 16
            return $this->relatedParties[0];
110
        } else {
111 16
            throw new BadMethodCallException('There are no related parties at all for this transaction');
112 16
        }
113
    }
114
115
    /**
116
     * @param RelatedAgent $relatedAgent
117 1
     */
118
    public function addRelatedAgent(RelatedAgent $relatedAgent)
119 1
    {
120
        $this->relatedAgents[] = $relatedAgent;
121
    }
122
123
    /**
124
     * @return RelatedAgent[]
125
     */
126
    public function getRelatedAgents()
127
    {
128
        return $this->relatedAgents;
129
    }
130
131
    /**
132
     * @return RelatedAgent
133
     * @throws BadMethodCallException
134
     */
135
    public function getRelatedAgent()
136
    {
137
        if (isset($this->relatedAgents[0])) {
138 16
            return $this->relatedAgents[0];
139
        } else {
140 16
            throw new BadMethodCallException('There are no related agents at all for this transaction');
141 16
        }
142
    }
143
144
    /**
145
     * @param RemittanceInformation $remittanceInformation
146 3
     */
147
    public function setRemittanceInformation(RemittanceInformation $remittanceInformation)
148 3
    {
149
        $this->remittanceInformation = $remittanceInformation;
150
    }
151 3
152
    /**
153
     * @return RemittanceInformation
154
     */
155
    public function getRemittanceInformation()
156
    {
157
        if ($this->remittanceInformation === null) {
158
            throw new BadMethodCallException();
159
        }
160
        return $this->remittanceInformation;
161
    }
162
    
163
    /**
164
     * @param RelatedDates $relatedDates
165
     */
166
    public function setRelatedDates(RelatedDates $relatedDates)
167
    {
168
        $this->relatedDates = $relatedDates;
169
    }
170
171
    /**
172
     * @return RelatedDates
173
     */
174
    public function getRelatedDates()
175
    {
176
        return $this->relatedDates;
177
    }    
178
179
    /**
180
     * @return ReturnInformation|null
181
     */
182
    public function getReturnInformation()
183
    {
184
        return $this->returnInformation;
185
    }
186
187
    /**
188
     * @param ReturnInformation $information
189
     */
190
    public function setReturnInformation(ReturnInformation $information)
191
    {
192 1
        $this->returnInformation = $information;
193
    }
194 1
195
    /**
196
     * @param AdditionalTransactionInformation $additionalTransactionInformation
197
     */
198
    public function setAdditionalTransactionInformation(AdditionalTransactionInformation $additionalTransactionInformation)
199
    {
200 20
        $this->additionalTransactionInformation = $additionalTransactionInformation;
201
    }
202 20
203 20
    /**
204
     * @return AdditionalTransactionInformation
205
     */
206
    public function getAdditionalTransactionInformation()
207
    {
208
        if ($this->additionalTransactionInformation === null) {
209
            throw new BadMethodCallException();
210
        }
211
        return $this->additionalTransactionInformation;
212
    }
213
214
    /**
215
     * @return BankTransactionCode
216
     */
217 6
    public function getBankTransactionCode()
218
    {
219 6
        return $this->bankTransactionCode;
220 6
    }
221
222
    /**
223
     * @param BankTransactionCode $bankTransactionCode
224
     */
225
    public function setBankTransactionCode(BankTransactionCode $bankTransactionCode)
226
    {
227
        $this->bankTransactionCode = $bankTransactionCode;
228
    }
229
230
    /**
231
     * @return Charges
232
     */
233
    public function getCharges()
234
    {
235
        return $this->charges;
0 ignored issues
show
Bug introduced by
The property charges does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
236
    }
237
238
    /**
239
     * @param Charges $charges
240
     */
241
    public function setCharges(Charges $charges)
242
    {
243
        $this->charges = $charges;
244
    }
245
246
    /**
247
     * @return AmountDetails
248
     */
249
    public function getAmountDetails()
250
    {
251
        return $this->amountDetails;
252
    }
253
254
    /**
255
     * @param AmountDetails $amountDetails
256
     */
257
    public function setAmountDetails(AmountDetails $amountDetails)
258
    {
259
        $this->amountDetails = $amountDetails;
260
    }
261
262
    /**
263
     * @return Amount
264
     */
265
    public function getAmount()
266
    {
267
        return $this->amount;
268
    }
269
270
    /**
271
     * @param Amount $amount
272
     */
273
    public function setAmount(Amount $amount)
274
    {
275
        $this->amount = $amount;
276
    }    
277
278
}
279