Completed
Pull Request — master (#44)
by
unknown
02:41
created

EntryTransactionDetail::setRelatedDates()   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 3
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
52
    /**
53
     * @var Amount
54
     */
55
    private $amount;
56
57
    /**
58
     * @param Reference $reference
59
     */
60 16
    public function addReference(Reference $reference)
61
    {
62 16
        $this->references[] = $reference;
63 16
    }
64
65
    /**
66
     * @return Reference[]
67
     */
68 1
    public function getReferences()
69
    {
70 1
        return $this->references;
71
    }
72
73
    /**
74
     * @return Reference
75
     * @throws BadMethodCallException
76
     */
77 1
    public function getReference()
78
    {
79 1
        if (isset($this->references[0])) {
80 1
            return $this->references[0];
81
        } else {
82
            throw new BadMethodCallException('There are no references at all for this transaction');
83
        }
84
    }
85
86
    /**
87
     * @param RelatedParty $relatedParty
88
     */
89 20
    public function addRelatedParty(RelatedParty $relatedParty)
90
    {
91 20
        $this->relatedParties[] = $relatedParty;
92 20
    }
93
94
    /**
95
     * @return RelatedParty[]
96
     */
97 3
    public function getRelatedParties()
98
    {
99 3
        return $this->relatedParties;
100
    }
101
102
    /**
103
     * @return RelatedParty
104
     * @throws BadMethodCallException
105
     */
106 1
    public function getRelatedParty()
107
    {
108 1
        if (isset($this->relatedParties[0])) {
109 1
            return $this->relatedParties[0];
110
        } else {
111
            throw new BadMethodCallException('There are no related parties at all for this transaction');
112
        }
113
    }
114
115
    /**
116
     * @param RelatedAgent $relatedAgent
117
     */
118 16
    public function addRelatedAgent(RelatedAgent $relatedAgent)
119
    {
120 16
        $this->relatedAgents[] = $relatedAgent;
121 16
    }
122
123
    /**
124
     * @return RelatedAgent[]
125
     */
126 1
    public function getRelatedAgents()
127
    {
128 1
        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
            return $this->relatedAgents[0];
139
        } else {
140
            throw new BadMethodCallException('There are no related agents at all for this transaction');
141
        }
142
    }
143
144
    /**
145
     * @param RemittanceInformation $remittanceInformation
146
     */
147 16
    public function setRemittanceInformation(RemittanceInformation $remittanceInformation)
148
    {
149 16
        $this->remittanceInformation = $remittanceInformation;
150 16
    }
151
152
    /**
153
     * @return RemittanceInformation
154
     */
155 3
    public function getRemittanceInformation()
156
    {
157 3
        if ($this->remittanceInformation === null) {
158
            throw new BadMethodCallException();
159
        }
160 3
        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
        $this->returnInformation = $information;
193
    }
194
195
    /**
196
     * @param AdditionalTransactionInformation $additionalTransactionInformation
197
     */
198
    public function setAdditionalTransactionInformation(AdditionalTransactionInformation $additionalTransactionInformation)
199
    {
200
        $this->additionalTransactionInformation = $additionalTransactionInformation;
201
    }
202
203
    /**
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 1
    public function getBankTransactionCode()
218
    {
219 1
        return $this->bankTransactionCode;
220
    }
221
222
    /**
223
     * @param BankTransactionCode $bankTransactionCode
224
     */
225 20
    public function setBankTransactionCode(BankTransactionCode $bankTransactionCode)
226
    {
227 20
        $this->bankTransactionCode = $bankTransactionCode;
228 20
    }
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 3
    public function setCharges(Charges $charges)
242
    {
243 3
        $this->charges = $charges;
244 3
    }
245
246
    /**
247
     * @return AmountDetails
248
     */
249
    public function getAmountDetails()
250
    {
251
        return $this->amountDetails;
252
    }
253
254
    /**
255
     * @param AmountDetails $amountDetails
256
     */
257 6
    public function setAmountDetails(AmountDetails $amountDetails)
258
    {
259 6
        $this->amountDetails = $amountDetails;
260 6
    }
261
262
    /**
263
     * @return Amount
264
     */
265
    public function getAmount()
266
    {
267
        return $this->amount;
268
    }
269
270
    /**
271
     * @param Amount $amount
272
     */
273 13
    public function setAmount(Amount $amount)
274
    {
275 13
        $this->amount = $amount;
276 13
    }    
277
278
}
279