Code Duplication    Length = 57-61 lines in 4 locations

src/Objects/AreaObject.php 1 location

@@ 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 null|float **/
12
    private $value;
13
14
    /**
15
     * Array of enum (sq_feet, sq_yards, sq_metres, acres, hectares)
16
     *
17
     * @var null|string
18
     */
19
    private $units;
20
21
    /**
22
     * @return null|float
23
     */
24
    public function getValue()
25
    {
26
        return $this->value;
27
    }
28
29
    /**
30
     * @param float $value
31
     *
32
     * @return AreaObject
33
     */
34
    public function setValue(float $value): self
35
    {
36
        $this->value = $value;
37
38
        return $this;
39
    }
40
41
    /**
42
     * @return null|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(string $units): self
55
    {
56
        $this->units = $units;
57
58
        return $this;
59
    }
60
61
    /** {@inheritDoc} */
62
    public function jsonSerialize(): array
63
    {
64
        return array_filter([
65
            'units' => $this->getUnits(),
66
            'value' => $this->getValue(),
67
        ]);
68
    }
69
}
70

src/Objects/MinimumContractLengthObject.php 1 location

@@ 9-69 (lines=61) @@
6
 * The rental_term attribute can be specified with a minimum_contract_length object or, if the contract length is not
7
 * currently known, by an enum that roughly indicates its likely duration (e.g. "short_term").
8
 */
9
class MinimumContractLengthObject implements \JsonSerializable
10
{
11
    /** @var null|float */
12
    private $minimumLength;
13
14
    /**
15
     * Enum (days, weeks, months, years)
16
     *
17
     * @var null|string
18
     */
19
    private $units;
20
21
    /**
22
     * @return null|float
23
     */
24
    public function getMinimumLength()
25
    {
26
        return $this->minimumLength;
27
    }
28
29
    /**
30
     * @param float $minimumLength
31
     *
32
     * @return MinimumContractLengthObject
33
     */
34
    public function setMinimumLength(float $minimumLength): self
35
    {
36
        $this->minimumLength = $minimumLength;
37
38
        return $this;
39
    }
40
41
    /**
42
     * @return null|string
43
     */
44
    public function getUnits()
45
    {
46
        return $this->units;
47
    }
48
49
    /**
50
     * @param string $units
51
     *
52
     * @return MinimumContractLengthObject
53
     */
54
    public function setUnits(string $units): self
55
    {
56
        $this->units = $units;
57
58
        return $this;
59
    }
60
61
    /** {@inheritDoc} */
62
    public function jsonSerialize(): array
63
    {
64
        return array_filter([
65
            'minimum_length' => $this->getMinimumLength(),
66
            'units' => $this->getUnits(),
67
        ]);
68
    }
69
}
70

src/Objects/MinMaxAreaObject.php 1 location

@@ 9-65 (lines=57) @@
6
 * The min_max_area object defines an area range. Where only one is specified, we will regard them both as having the
7
 * same value - i.e. a fixed area.
8
 */
9
class MinMaxAreaObject implements \JsonSerializable
10
{
11
    /** @var null|AreaObject */
12
    private $minimum;
13
14
    /** @var null|AreaObject */
15
    private $maximum;
16
17
    /**
18
     * @return null|AreaObject
19
     */
20
    public function getMinimum()
21
    {
22
        return $this->minimum;
23
    }
24
25
    /**
26
     * @param AreaObject $minimum
27
     *
28
     * @return MinMaxAreaObject
29
     */
30
    public function setMinimum(AreaObject $minimum): self
31
    {
32
        $this->minimum = $minimum;
33
34
        return $this;
35
    }
36
37
    /**
38
     * @return null|AreaObject
39
     */
40
    public function getMaximum()
41
    {
42
        return $this->maximum;
43
    }
44
45
    /**
46
     * @param AreaObject $maximum
47
     *
48
     * @return MinMaxAreaObject
49
     */
50
    public function setMaximum(AreaObject $maximum): self
51
    {
52
        $this->maximum = $maximum;
53
54
        return $this;
55
    }
56
57
    /** {@inheritDoc} */
58
    public function jsonSerialize(): array
59
    {
60
        return array_filter([
61
            'minimum' => $this->getMinimum(),
62
            'maximum' => $this->getMaximum(),
63
        ]);
64
    }
65
}
66

src/Objects/PricePerUnitAreaObject.php 1 location

@@ 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 null|float */
11
    private $price;
12
13
    /**
14
     * Enum (sq_feet, sq_yards, sq_metres, acres, hectares)
15
     *
16
     * @var null|string
17
     */
18
    private $units;
19
20
    /**
21
     * @return null|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(float $price): self
34
    {
35
        $this->price = $price;
36
37
        return $this;
38
    }
39
40
    /**
41
     * @return null|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(string $units): self
54
    {
55
        $this->units = $units;
56
57
        return $this;
58
    }
59
60
    /** {@inheritDoc} */
61
    public function jsonSerialize(): array
62
    {
63
        return array_filter([
64
            'price' => $this->getPrice(),
65
            'units' => $this->getUnits(),
66
        ]);
67
    }
68
}
69