Exemple #1
0
 /**
  * Get a unique key for sorting this node.
  *
  * Used to sort nodes into tree order. That is top to bottom and then left
  * to right.
  *
  * @return string
  */
 public function sortKey()
 {
     if ($this instanceof RootNode) {
         return spl_object_hash($this);
     }
     if (!$this->parent) {
         return '~/' . spl_object_hash($this);
     }
     $path = $this->parent->sortKey() . '/';
     $position = 0;
     $previous = $this->previous;
     while ($previous) {
         $position++;
         $previous = $previous->previous;
     }
     $path .= $position;
     return $path;
 }