public function getDescendants()
    {
        $descendants = [];

        $descendants[$this->name] = $this->appName;

        /** @var $child Node */
        foreach ($this->children as $child) {
            $childDescendats = $child->getDescendants();
            $descendants = array_merge($childDescendats, $descendants);
        }

        return $descendants;
    }
public function getDescendants()
    {
        $descendants = [];

        $descendants[$this->name] = $this->appName;

        /** @var $child Node */
        foreach ($this->children as $child) {
            $childDescendats = $child->getDescendants();
            $descendants = array_merge($childDescendats, $descendants);
        }

        return $descendants;
    }
public function getDescendants ( ) { $ descendants = [ ] ; $ descendants [ $ this -> name ] = $ this -> appName ; /** @var $child Node */ foreach ( $ this -> children as $ child ) { $ childDescendats = $ child -> getDescendants ( ) ; $ descendants = array_merge ( $ childDescendats , $ descendants ) ; } return $ descendants ; }
Get all nodes the consider this node there first ancestor, including this one.
This puts the last child as the first element on returned array while this node becomes the last.

@return array
Get all nodes the consider this node there first ancestor including this one . This puts the last child as the first element on returned array while this node becomes the last .