Completed
Push — master ( 25f365...554d02 )
by Alexey
02:46
created

Tree::setName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Reflection\Tests\Dummy;
6
7
use \JsonSerializable;
8
use \Reflection\Tests\Dummy\Branch as BranchClass;
9
use \Reflection\Tests\Dummy\Leaf;
10
11
/**
12
 * Class Tree
13
 * @package Reflection\Tests\Dummy
14
 */
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
}