Completed
Pull Request — master (#31)
by
unknown
22:01
created

EntryTransactionDetail::setRemittanceInformation()   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 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
     * @param Reference $reference
45
     */
46 16
    public function addReference(Reference $reference)
47
    {
48 16
        $this->references[] = $reference;
49 16
    }
50
51
    /**
52
     * @return Reference[]
53
     */
54 1
    public function getReferences()
55
    {
56 1
        return $this->references;
57
    }
58
59
    /**
60
     * @return Reference
61
     * @throws BadMethodCallException
62
     */
63 1
    public function getReference()
64
    {
65 1
        if (isset($this->references[0])) {
66 1
            return $this->references[0];
67
        } else {
68
            throw new BadMethodCallException('There are no references at all for this transaction');
69
        }
70
    }
71
72
    /**
73
     * @param RelatedParty $relatedParty
74
     */
75 20
    public function addRelatedParty(RelatedParty $relatedParty)
76
    {
77 20
        $this->relatedParties[] = $relatedParty;
78 20
    }
79
80
    /**
81
     * @return RelatedParty[]
82
     */
83 3
    public function getRelatedParties()
84
    {
85 3
        return $this->relatedParties;
86
    }
87
88
    /**
89
     * @return RelatedParty
90
     * @throws BadMethodCallException
91
     */
92 1
    public function getRelatedParty()
93
    {
94 1
        if (isset($this->relatedParties[0])) {
95 1
            return $this->relatedParties[0];
96
        } else {
97
            throw new BadMethodCallException('There are no related parties at all for this transaction');
98
        }
99
    }
100
101
    /**
102
     * @param RelatedAgent $relatedAgent
103
     */
104 16
    public function addRelatedAgent(RelatedAgent $relatedAgent)
105
    {
106 16
        $this->relatedAgents[] = $relatedAgent;
107 16
    }
108
109
    /**
110
     * @return RelatedAgent[]
111
     */
112 1
    public function getRelatedAgents()
113
    {
114 1
        return $this->relatedAgents;
115
    }
116
117
    /**
118
     * @return RelatedAgent
119
     * @throws BadMethodCallException
120
     */
121
    public function getRelatedAgent()
122
    {
123
        if (isset($this->relatedAgents[0])) {
124
            return $this->relatedAgents[0];
125
        } else {
126
            throw new BadMethodCallException('There are no related agents at all for this transaction');
127
        }
128
    }
129
130
    /**
131
     * @param RemittanceInformation $remittanceInformation
132
     */
133 16
    public function setRemittanceInformation(RemittanceInformation $remittanceInformation)
134
    {
135 16
        $this->remittanceInformation = $remittanceInformation;
136 16
    }
137
138
    /**
139
     * @return RemittanceInformation
140
     */
141 3
    public function getRemittanceInformation()
142
    {
143 3
        if ($this->remittanceInformation === null) {
144
            throw new BadMethodCallException();
145
        }
146 3
        return $this->remittanceInformation;
147
    }
148
149
    /**
150
     * @return ReturnInformation|null
151
     */
152
    public function getReturnInformation()
153
    {
154
        return $this->returnInformation;
155
    }
156
157
    /**
158
     * @param ReturnInformation $information
159
     */
160
    public function setReturnInformation(ReturnInformation $information)
161
    {
162
        $this->returnInformation = $information;
163
    }
164
165
    /**
166
     * @param AdditionalTransactionInformation $additionalTransactionInformation
167
     */
168
    public function setAdditionalTransactionInformation(AdditionalTransactionInformation $additionalTransactionInformation)
169
    {
170
        $this->additionalTransactionInformation = $additionalTransactionInformation;
171
    }
172
173
    /**
174
     * @return AdditionalTransactionInformation
175
     */
176
    public function getAdditionalTransactionInformation()
177
    {
178
        if ($this->additionalTransactionInformation === null) {
179
            throw new BadMethodCallException();
180
        }
181
        return $this->additionalTransactionInformation;
182
    }
183
184
    /**
185
     * @return BankTransactionCode
186
     */
187 1
    public function getBankTransactionCode()
188
    {
189 1
        return $this->bankTransactionCode;
190
    }
191
192
    /**
193
     * @param BankTransactionCode $bankTransactionCode
194
     */
195 20
    public function setBankTransactionCode($bankTransactionCode)
196
    {
197 20
        $this->bankTransactionCode = $bankTransactionCode;
198 20
    }
199
}
200