protected static function sortUnique($nodes) {
    $sort = [];
    $detached = [];
    foreach ($nodes as $node) {
      $key = $node->sortKey();
      if ($key[0] === '~') {
        $detached[] = $node;
      }
      else {
        $sort[$key] = $node;
      }
    }
    ksort($sort, SORT_NATURAL);
    return array_merge(array_values($sort), $detached);
  }
protected static function sortUnique($nodes) {
    $sort = [];
    $detached = [];
    foreach ($nodes as $node) {
      $key = $node->sortKey();
      if ($key[0] === '~') {
        $detached[] = $node;
      }
      else {
        $sort[$key] = $node;
      }
    }
    ksort($sort, SORT_NATURAL);
    return array_merge(array_values($sort), $detached);
  }
protected static function sortUnique ( $ nodes ) { $ sort = [ ] ; $ detached = [ ] ; foreach ( $ nodes as $ node ) { $ key = $ node -> sortKey ( ) ; if ( $ key [ 0 ] === '~' ) { $ detached [ ] = $ node ; } else { $ sort [ $ key ] = $ node ; } } ksort ( $ sort , SORT_NATURAL ) ; return array_merge ( array_values ( $ sort ) , $ detached ) ; }
Sort nodes and remove duplicates
@param Node[] $nodes
@return Node[]
Sort nodes and remove duplicates