1 | <?php |
||
13 | class Leaf implements Serializable { |
||
14 | |||
15 | /** |
||
16 | * @var double |
||
17 | */ |
||
18 | private $height; |
||
19 | |||
20 | /** |
||
21 | * @var double |
||
22 | */ |
||
23 | private $width; |
||
24 | |||
25 | /** |
||
26 | * @return float |
||
27 | */ |
||
28 | public function getHeight() { |
||
29 | return $this->height; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param float $height |
||
34 | * @return $this |
||
35 | */ |
||
36 | public function setHeight($height) { |
||
37 | $this->height = $height; |
||
38 | |||
39 | return $this; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return float |
||
44 | */ |
||
45 | public function getWidth() { |
||
46 | return $this->width; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param float $width |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function setWidth($width) { |
||
54 | $this->width = $width; |
||
55 | |||
56 | return $this; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param double $height |
||
61 | * @param double $width |
||
62 | */ |
||
63 | public function __construct($height = null, $width = null) { |
||
64 | $this->height = $height; |
||
65 | $this->width = $width; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return array |
||
70 | */ |
||
71 | public function jsonSerialize() { |
||
72 | return [ |
||
73 | 'height' => $this->getHeight(), |
||
74 | 'width' => $this->getWidth() |
||
75 | ]; |
||
76 | } |
||
77 | |||
78 | } |