1 | <?php |
||
15 | class Tree implements JsonSerializable { |
||
16 | |||
17 | /** |
||
18 | * @var float |
||
19 | */ |
||
20 | public $height; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $name; |
||
26 | |||
27 | /** |
||
28 | * @var BranchClass |
||
29 | */ |
||
30 | private $branch; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $something; |
||
36 | |||
37 | /** |
||
38 | * @return float |
||
39 | */ |
||
40 | public function getHeight() { |
||
41 | return $this->height; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param float $height |
||
46 | * @return $this |
||
47 | */ |
||
48 | public function setHeight($height) { |
||
49 | $this->height = $height; |
||
50 | |||
51 | return $this; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | public function getName() { |
||
58 | return $this->name; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @param string $name |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function setName($name) { |
||
66 | $this->name = $name; |
||
67 | |||
68 | return $this; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return BranchClass |
||
73 | */ |
||
74 | public function getBranch() { |
||
75 | return $this->branch; |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * @param BranchClass $branch |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function setBranch(BranchClass $branch = null) { |
||
83 | $this->branch = $branch; |
||
84 | |||
85 | return $this; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @param double $height |
||
90 | * @param string $name |
||
91 | * @param BranchClass $branch |
||
92 | */ |
||
93 | public function __construct($height = null, $name = null, BranchClass $branch = null) { |
||
94 | $this->height = $height; |
||
95 | $this->name = $name; |
||
96 | $this->branch = $branch; |
||
97 | $this->something = 'something'; |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @return array |
||
102 | */ |
||
103 | public function jsonSerialize() { |
||
104 | return [ |
||
105 | 'name' => $this->getName(), |
||
106 | 'height' => $this->getHeight(), |
||
107 | 'branch' => $this->getBranch() |
||
108 | ]; |
||
109 | } |
||
110 | |||
111 | } |