Completed
Push — master ( a21d65...78ef8c )
by Luke
02:31 queued 42s
created

PricingObject::setAuction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
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 3
    public function getTransactionType()
52
    {
53 3
        return $this->transactionType;
54
    }
55
56
    /**
57
     * @param string $transactionType
58
     *
59
     * @return PricingObject
60
     */
61 2
    public function setTransactionType($transactionType)
62
    {
63 2
        $this->transactionType = $transactionType;
64
65 2
        return $this;
66
    }
67
68
    /**
69
     * @return string
70
     */
71 3
    public function getCurrencyCode()
72
    {
73 3
        return $this->currencyCode;
74
    }
75
76
    /**
77
     * @param string $currencyCode
78
     *
79
     * @return PricingObject
80
     */
81 2
    public function setCurrencyCode($currencyCode)
82
    {
83 2
        $this->currencyCode = $currencyCode;
84
85 2
        return $this;
86
    }
87
88
    /**
89
     * @return float
90
     */
91 3
    public function getPrice()
92
    {
93 3
        return $this->price;
94
    }
95
96
    /**
97
     * @param float $price
98
     *
99
     * @return PricingObject
100
     */
101 2
    public function setPrice($price)
102
    {
103 2
        $this->price = $price;
104
105 2
        return $this;
106
    }
107
108
    /**
109
     * @return PricePerUnitAreaObject
110
     */
111 3
    public function getPricePerUnitArea()
112
    {
113 3
        return $this->pricePerUnitArea;
114
    }
115
116
    /**
117
     * @param PricePerUnitAreaObject $pricePerUnitArea
118
     *
119
     * @return PricingObject
120
     */
121 1
    public function setPricePerUnitArea(PricePerUnitAreaObject $pricePerUnitArea)
122
    {
123 1
        $this->pricePerUnitArea = $pricePerUnitArea;
124
125 1
        return $this;
126
    }
127
128
    /**
129
     * @return string
130
     */
131 3
    public function getRentFrequency()
132
    {
133 3
        return $this->rentFrequency;
134
    }
135
136
    /**
137
     * @param string $rentFrequency
138
     *
139
     * @return PricingObject
140
     */
141 1
    public function setRentFrequency($rentFrequency)
142
    {
143 1
        $this->rentFrequency = $rentFrequency;
144
145 1
        return $this;
146
    }
147
148
    /**
149
     * @return string
150
     */
151 3
    public function getPriceQualifier()
152
    {
153 3
        return $this->priceQualifier;
154
    }
155
156
    /**
157
     * @param string $priceQualifier
158
     *
159
     * @return PricingObject
160
     */
161 2
    public function setPriceQualifier($priceQualifier)
162
    {
163 2
        $this->priceQualifier = $priceQualifier;
164
165 2
        return $this;
166
    }
167
168
    /**
169
     * @return bool
170
     */
171 3
    public function isAuction()
172
    {
173 3
        return $this->auction;
174
    }
175
176
    /**
177
     * @param bool $auction
178
     *
179
     * @return PricingObject
180
     */
181 1
    public function setAuction($auction)
182
    {
183 1
        $this->auction = $auction;
184
185 1
        return $this;
186
    }
187
188
    /** {@inheritDoc} */
189 2
    public function jsonSerialize()
190
    {
191 2
        return array_filter([
192 2
            'transaction_type' => $this->getTransactionType(),
193 2
            'currency_code' => $this->getCurrencyCode(),
194 2
            'price' => $this->getPrice(),
195 2
            'price_per_unit_area' => $this->getPricePerUnitArea(),
196 2
            'rent_frequency' => $this->getRentFrequency(),
197 2
            'price_qualifier' => $this->getPriceQualifier(),
198 2
            'auction' => $this->isAuction(),
199
        ]);
200
    }
201
}
202