Completed
Pull Request — master (#31)
by
unknown
20:56
created

EntryTransactionDetail::setBankTransactionCode()   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 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
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 ReturnInformation
31
     */
32
    private $returnInformation;
33
    /**
34
     * @var AdditionalTransactionInformation
35
     */
36
    private $additionalTransactionInformation;
37
38
    /**
39
     * @var BankTransactionCode
40
     */
41 16
    private $bankTransactionCode;
42
43 16
    /**
44 16
     * @param Reference $reference
45
     */
46
    public function addReference(Reference $reference)
47
    {
48
        $this->references[] = $reference;
49 1
    }
50
51 1
    /**
52
     * @return Reference[]
53
     */
54
    public function getReferences()
55
    {
56
        return $this->references;
57
    }
58 1
59
    /**
60 1
     * @return Reference
61 1
     * @throws BadMethodCallException
62
     */
63
    public function getReference()
64
    {
65
        if (isset($this->references[0])) {
66
            return $this->references[0];
67
        } else {
68
            throw new BadMethodCallException('There are no references at all for this transaction');
69
        }
70 17
    }
71
72 17
    /**
73 17
     * @param RelatedParty $relatedParty
74
     */
75
    public function addRelatedParty(RelatedParty $relatedParty)
76
    {
77
        $this->relatedParties[] = $relatedParty;
78 2
    }
79
80 2
    /**
81
     * @return RelatedParty[]
82
     */
83
    public function getRelatedParties()
84
    {
85
        return $this->relatedParties;
86
    }
87 1
88
    /**
89 1
     * @return RelatedParty
90 1
     * @throws BadMethodCallException
91
     */
92
    public function getRelatedParty()
93
    {
94
        if (isset($this->relatedParties[0])) {
95
            return $this->relatedParties[0];
96
        } else {
97
            throw new BadMethodCallException('There are no related parties at all for this transaction');
98
        }
99 14
    }
100
101 14
    /**
102 14
     * @param RelatedAgent $relatedAgent
103
     */
104
    public function addRelatedAgent(RelatedAgent $relatedAgent)
105
    {
106
        $this->relatedAgents[] = $relatedAgent;
107 1
    }
108
109 1
    /**
110
     * @return RelatedAgent[]
111
     */
112
    public function getRelatedAgents()
113
    {
114
        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 16
    }
129
130 16
    /**
131 16
     * @param RemittanceInformation $remittanceInformation
132
     */
133
    public function setRemittanceInformation(RemittanceInformation $remittanceInformation)
134
    {
135
        $this->remittanceInformation = $remittanceInformation;
136 3
    }
137
138 3
    /**
139
     * @return RemittanceInformation
140
     */
141 3
    public function getRemittanceInformation()
142
    {
143
        if ($this->remittanceInformation === null) {
144
            throw new BadMethodCallException();
145
        }
146
        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
    public function getBankTransactionCode()
188
    {
189
        return $this->bankTransactionCode;
190
    }
191
192
    /**
193
     * @param BankTransactionCode $bankTransactionCode
194
     */
195
    public function setBankTransactionCode($bankTransactionCode)
196
    {
197
        $this->bankTransactionCode = $bankTransactionCode;
198
    }
199
}
200