id = $nodeData[$keys['id']]; $this->pid = $nodeData[$keys['pid']]; $this->left = $nodeData[$keys['left']]; $this->right = $nodeData[$keys['right']]; $this->level = $nodeData[$keys['level']]; $this->data = $nodeData; $a = $this->right - $this->left; if ($a > 1) { $this->hasChild = true; $this->numChild = ($a - 1) / 2; } return $this; } function getData($name) { if (isset($this->data[$name])) { return $this->data[$name]; } else { return null; } } function getLevel() { return $this->level; } function getLeft() { return $this->left; } function getRight() { return $this->right; } function getPid() { return $this->pid; } function getId() { return $this->id; } /** * Return true if node have chield * * @return boolean */ function isParent() { if ($this->right - $this->left > 1) { return true; } else { return false; } } }