TreeItem::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace ezTreeBuilder\Item;
3
4
use ezTreeBuilder\Base\Branch;
5
use ezTreeBuilder\Base\AbstractBranch;
6
7
/**
8
 * TreeItem class - Limited concern to caller
9
 *
10
 * Used to build \TreeBuilder\Base\Branch to be used by \TreeBuilder\Tree
11
 *
12
 * @package ezTreeBuilder
13
 * @author Adrian Tilita <[email protected]>
14
 * @version 1.0
15
 */
16
class TreeItem extends AbstractBranch implements Branch
17
{
18
    /**
19
     * An identifier for the tree item
20
     * @var int
21
     */
22
    protected $id;
23
24
    /**
25
     * The identifier of the parent item - default to 0 for root node
26
     * @var int
27
     */
28
    protected $parentId = 0;
29
30
    /**
31
     * Passed data for the tree item
32
     * @var mixed
33
     */
34
    protected $data;
35
36
    /**
37
     * Set the tree item id
38
     * @param int $value
39
     * @return \TreeBuilder\Base\Branch
40
     */
41
    public function setId($value)
42
    {
43
        $this->id = $value;
44
        return $this;
45
    }
46
47
    /**
48
     * Get the tree item id
49
     * @return int
50
     */
51
    public function getId()
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * Set the parent's id
58
     * @param int $value
59
     * @return \TreeBuilder\Base\Branch
60
     */
61
    public function setParentId($value)
62
    {
63
        $this->parentId = $value;
64
        return $this;
65
    }
66
67
    /**
68
     * Get the parent's id
69
     * @return int
70
     */
71
    public function getParentId()
72
    {
73
        return $this->parentId;
74
    }
75
76
    /**
77
     * Store data to be passed for the tree item
78
     * @param mixed $value
79
     * @return \TreeBuilder\Base\Branch
80
     */
81
    public function setData($value)
82
    {
83
        $this->data = $value;
84
        return $this;
85
    }
86
87
    /**
88
     * Retrieve the tree item passed data
89
     * @return mixed
90
     */
91
    public function getData()
92
    {
93
        return $this->data;
94
    }
95
}
96