Completed
Push — master ( aabf4d...606f02 )
by Frederik
9s
created

EntryTransactionDetail::getReturnInformation()   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 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Genkgo\Camt\Camt053\DTO;
4
5
use BadMethodCallException;
6
7
/**
8
 * Class EntryTransactionDetail
9
 * @package Genkgo\Camt\Camt053
10
 */
11
class EntryTransactionDetail
12
{
13
    /**
14
     * @var Reference[]
15
     */
16
    private $references = [];
17
    /**
18
     * @var RelatedParty[]
19
     */
20
    private $relatedParties = [];
21
    /**
22
     * @var RemittanceInformation
23
     */
24
    private $remittanceInformation;
25
    /**
26
     * @var ReturnInformation
27
     */
28
    private $returnInformation;
29
    /**
30
     * @var AdditionalTransactionInformation
31
     */
32
    private $additionalTransactionInformation;
33
34
    /**
35
     * @param Reference $reference
36
     */
37 7
    public function addReference(Reference $reference)
38
    {
39 7
        $this->references[] = $reference;
40 7
    }
41
42
    /**
43
     * @return Reference[]
44
     */
45 1
    public function getReferences()
46
    {
47 1
        return $this->references;
48
    }
49
50
    /**
51
     * @return Reference
52
     * @throws BadMethodCallException
53
     */
54 1
    public function getReference()
55
    {
56 1
        if (isset($this->references[0])) {
57 1
            return $this->references[0];
58
        } else {
59
            throw new BadMethodCallException('There are no references at all for this transaction');
60
        }
61
    }
62
63
    /**
64
     * @param RelatedParty $relatedParty
65
     */
66 9
    public function addRelatedParty(RelatedParty $relatedParty)
67
    {
68 9
        $this->relatedParties[] = $relatedParty;
69 9
    }
70
71
    /**
72
     * @return RelatedParty[]
73
     */
74 1
    public function getRelatedParties()
75
    {
76 1
        return $this->relatedParties;
77
    }
78
79
    /**
80
     * @return RelatedParty
81
     * @throws BadMethodCallException
82
     */
83 1
    public function getRelatedParty()
84
    {
85 1
        if (isset($this->relatedParties[0])) {
86 1
            return $this->relatedParties[0];
87
        } else {
88
            throw new BadMethodCallException('There are no related parties at all for this transaction');
89
        }
90
    }
91
92
    /**
93
     * @param RemittanceInformation $remittanceInformation
94
     */
95 9
    public function setRemittanceInformation(RemittanceInformation $remittanceInformation)
96
    {
97 9
        $this->remittanceInformation = $remittanceInformation;
98 9
    }
99
100
    /**
101
     * @return RemittanceInformation
102
     */
103 3
    public function getRemittanceInformation()
104
    {
105 3
        if ($this->remittanceInformation === null) {
106
            throw new BadMethodCallException();
107
        }
108 3
        return $this->remittanceInformation;
109
    }
110
111
    /**
112
     * @return ReturnInformation|null
113
     */
114
    public function getReturnInformation()
115
    {
116
        return $this->returnInformation;
117
    }
118
119
    /**
120
     * @param ReturnInformation $information
121
     */
122
    public function setReturnInformation(ReturnInformation $information)
123
    {
124
        $this->returnInformation = $information;
125
    }
126
127
    /**
128
     * @param AdditionalTransactionInformation $additionalTransactionInformation
129
     */
130
    public function setAdditionalTransactionInformation(AdditionalTransactionInformation $additionalTransactionInformation)
131
    {
132
        $this->additionalTransactionInformation = $additionalTransactionInformation;
133
    }
134
135
    /**
136
     * @return AdditionalTransactionInformation
137
     */
138
    public function getAdditionalTransactionInformation()
139
    {
140
        if ($this->additionalTransactionInformation === null) {
141
            throw new BadMethodCallException();
142
        }
143
        return $this->additionalTransactionInformation;
144
    }
145
}
146