Completed
Push — master ( 44f193...41cc43 )
by Luke
11s
created

src/Objects/AreaObject.php (1 issue)

1
<?php
2
3
namespace ZpgRtf\Objects;
4
5
/**
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 View Code Duplication
class AreaObject implements \JsonSerializable
10
{
11
    /** @var null|int **/
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|int
23
     */
24 2
    public function getValue()
25
    {
26 2
        return $this->value;
27
    }
28
29
    /**
30
     * @param int $value
31
     *
32
     * @return AreaObject
33
     */
34 1
    public function setValue(string $value): self
35
    {
36 1
        $this->value = $value;
0 ignored issues
show
Documentation Bug introduced by
It seems like $value of type string is incompatible with the declared type null|integer of property $value.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
37
38 1
        return $this;
39
    }
40
41
    /**
42
     * @return null|string
43
     */
44 2
    public function getUnits()
45
    {
46 2
        return $this->units;
47
    }
48
49
    /**
50
     * @param string $units
51
     *
52
     * @return AreaObject
53
     */
54 1
    public function setUnits(string $units): self
55
    {
56 1
        $this->units = $units;
57
58 1
        return $this;
59
    }
60
61
    /** {@inheritDoc} */
62 1
    public function jsonSerialize(): array
63
    {
64 1
        return array_filter([
65 1
            'units' => $this->getUnits(),
66 1
            'value' => $this->getValue(),
67
        ]);
68
    }
69
}
70