Completed
Push — master ( b096cd...cd95cc )
by Luke
01:56
created

PricingObject::setPrice()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace ZpgRtf\Objects;
4
5
/**
6
 * The pricing object's structure is determined by whether its component attribute transaction_type indicates that the
7
 * listing is for sale or rent. Please note that we do not currently support multiple pricing, nor multiple
8
 * transaction_types, for a single listing. If you do have multiple pricing models, perhaps due to a range of incentive
9
 * schemes being available, then you should supply the non-subsidised price in the pricing object and indicate available
10
 * incentive plans via listing/update:buyer_incentives.
11
 */
12
class PricingObject implements \JsonSerializable
13
{
14
    /**
15
     * Enum (rent, sale)
16
     *
17
     * @var string
18
     */
19
    private $transactionType;
20
21
    /** @var string */
22
    private $currencyCode;
23
24
    /** @var float */
25
    private $price;
26
27
    /** @var PricePerUnitAreaObject */
28
    private $pricePerUnitArea;
29
30
    /**
31
     * Enum (per_person_per_week, per_week, per_month, per_quarter, per_year)
32
     *
33
     * @var string
34
     */
35
    private $rentFrequency;
36
37
    /**
38
     * Enum (fixed_price, from, guide_price, non_quoting, offers_in_the_region_of, offers_over, price_on_application,
39
     * sale_by_tender)
40
     *
41
     * @var string
42
     */
43
    private $priceQualifier;
44
45
    /** @var bool */
46
    private $auction;
47
48
    /**
49
     * @return string
50
     */
51 1
    public function getTransactionType()
52
    {
53 1
        return $this->transactionType;
54
    }
55
56
    /**
57
     * @param string $transactionType
58
     *
59
     * @return PricingObject
60
     */
61
    public function setTransactionType($transactionType)
62
    {
63
        $this->transactionType = $transactionType;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @return string
70
     */
71 1
    public function getCurrencyCode()
72
    {
73 1
        return $this->currencyCode;
74
    }
75
76
    /**
77
     * @param string $currencyCode
78
     *
79
     * @return PricingObject
80
     */
81
    public function setCurrencyCode($currencyCode)
82
    {
83
        $this->currencyCode = $currencyCode;
84
85
        return $this;
86
    }
87
88
    /**
89
     * @return float
90
     */
91 1
    public function getPrice()
92
    {
93 1
        return $this->price;
94
    }
95
96
    /**
97
     * @param float $price
98
     *
99
     * @return PricingObject
100
     */
101
    public function setPrice($price)
102
    {
103
        $this->price = $price;
104
105
        return $this;
106
    }
107
108
    /**
109
     * @return PricePerUnitAreaObject
110
     */
111 1
    public function getPricePerUnitArea()
112
    {
113 1
        return $this->pricePerUnitArea;
114
    }
115
116
    /**
117
     * @param PricePerUnitAreaObject $pricePerUnitArea
118
     *
119
     * @return PricingObject
120
     */
121
    public function setPricePerUnitArea(PricePerUnitAreaObject $pricePerUnitArea)
122
    {
123
        $this->pricePerUnitArea = $pricePerUnitArea;
124
125
        return $this;
126
    }
127
128
    /**
129
     * @return string
130
     */
131 1
    public function getRentFrequency()
132
    {
133 1
        return $this->rentFrequency;
134
    }
135
136
    /**
137
     * @param string $rentFrequency
138
     *
139
     * @return PricingObject
140
     */
141
    public function setRentFrequency($rentFrequency)
142
    {
143
        $this->rentFrequency = $rentFrequency;
144
145
        return $this;
146
    }
147
148
    /**
149
     * @return string
150
     */
151 1
    public function getPriceQualifier()
152
    {
153 1
        return $this->priceQualifier;
154
    }
155
156
    /**
157
     * @param string $priceQualifier
158
     *
159
     * @return PricingObject
160
     */
161
    public function setPriceQualifier($priceQualifier)
162
    {
163
        $this->priceQualifier = $priceQualifier;
164
165
        return $this;
166
    }
167
168
    /**
169
     * @return bool
170
     */
171 1
    public function isAuction()
172
    {
173 1
        return $this->auction;
174
    }
175
176
    /**
177
     * @param bool $auction
178
     *
179
     * @return PricingObject
180
     */
181
    public function setAuction($auction)
182
    {
183
        $this->auction = $auction;
184
185
        return $this;
186
    }
187
188
    /** {@inheritDoc} */
189 1
    public function jsonSerialize()
190
    {
191
        return [
192 1
            'transaction_type' => $this->getTransactionType(),
193 1
            'currency_code' => $this->getCurrencyCode(),
194 1
            'price' => $this->getPrice(),
195 1
            'price_per_unit_area' => $this->getPricePerUnitArea(),
196 1
            'rent_frequency' => $this->getRentFrequency(),
197 1
            'price_qualifier' => $this->getPriceQualifier(),
198 1
            'auction' => $this->isAuction(),
199
        ];
200
    }
201
}
202