| @@ 9-69 (lines=61) @@ | ||
| 6 | * This describes a single area. It is a constituent of a number of other objects. This should not be confused with the |
|
| 7 | * areas object. |
|
| 8 | */ |
|
| 9 | class AreaObject implements \JsonSerializable |
|
| 10 | { |
|
| 11 | /** @var int **/ |
|
| 12 | private $value; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * Array of enum (sq_feet, sq_yards, sq_metres, acres, hectares) |
|
| 16 | * |
|
| 17 | * @var string e.g. sq_metres |
|
| 18 | */ |
|
| 19 | private $units; |
|
| 20 | ||
| 21 | /** |
|
| 22 | * @return int |
|
| 23 | */ |
|
| 24 | public function getValue() |
|
| 25 | { |
|
| 26 | return $this->value; |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @param int $value |
|
| 31 | * |
|
| 32 | * @return AreaObject |
|
| 33 | */ |
|
| 34 | public function setValue($value) |
|
| 35 | { |
|
| 36 | $this->value = $value; |
|
| 37 | ||
| 38 | return $this; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @return string |
|
| 43 | */ |
|
| 44 | public function getUnits() |
|
| 45 | { |
|
| 46 | return $this->units; |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @param string $units |
|
| 51 | * |
|
| 52 | * @return AreaObject |
|
| 53 | */ |
|
| 54 | public function setUnits($units) |
|
| 55 | { |
|
| 56 | $this->units = $units; |
|
| 57 | ||
| 58 | return $this; |
|
| 59 | } |
|
| 60 | ||
| 61 | /** {@inheritDoc} */ |
|
| 62 | public function jsonSerialize() |
|
| 63 | { |
|
| 64 | return [ |
|
| 65 | 'units' => $this->getUnits(), |
|
| 66 | 'value' => $this->getValue(), |
|
| 67 | ]; |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| @@ 8-68 (lines=61) @@ | ||
| 5 | /** |
|
| 6 | * This object describes a price which is provided as a function of floor area. |
|
| 7 | */ |
|
| 8 | class PricePerUnitAreaObject implements \JsonSerializable |
|
| 9 | { |
|
| 10 | /** @var float */ |
|
| 11 | private $price; |
|
| 12 | ||
| 13 | /** |
|
| 14 | * Enum (sq_feet, sq_yards, sq_metres, acres, hectares) |
|
| 15 | * |
|
| 16 | * @var string |
|
| 17 | */ |
|
| 18 | private $units; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @return float |
|
| 22 | */ |
|
| 23 | public function getPrice() |
|
| 24 | { |
|
| 25 | return $this->price; |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @param float $price |
|
| 30 | * |
|
| 31 | * @return PricePerUnitAreaObject |
|
| 32 | */ |
|
| 33 | public function setPrice($price) |
|
| 34 | { |
|
| 35 | $this->price = $price; |
|
| 36 | ||
| 37 | return $this; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @return string |
|
| 42 | */ |
|
| 43 | public function getUnits() |
|
| 44 | { |
|
| 45 | return $this->units; |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @param string $units |
|
| 50 | * |
|
| 51 | * @return PricePerUnitAreaObject |
|
| 52 | */ |
|
| 53 | public function setUnits($units) |
|
| 54 | { |
|
| 55 | $this->units = $units; |
|
| 56 | ||
| 57 | return $this; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** {@inheritDoc} */ |
|
| 61 | public function jsonSerialize() |
|
| 62 | { |
|
| 63 | return [ |
|
| 64 | 'price' => $this->getPrice(), |
|
| 65 | 'units' => $this->getUnits(), |
|
| 66 | ]; |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||