public function isDescendantOf($subj) { $owner = $this->getOwner(); $result = $owner->{$this->leftAttribute} > $subj->{$this->leftAttribute} && $owner->{$this->rightAttribute} < $subj->{$this->rightAttribute}; if ($this->hasManyRoots) { $result = $result && $owner->{$this->rootAttribute} === $subj->{$this->rootAttribute}; } return $result; }