protected function insertBeforeChild(Node $child, Node $node) {
    $this->childCount++;
    $node->parent = $this;
    if ($child->previous === NULL) {
      $this->head = $node;
    }
    else {
      $child->previous->next = $node;
    }
    $node->previous = $child->previous;
    $node->next = $child;
    $child->previous = $node;
    return $this;
  }
protected function insertBeforeChild(Node $child, Node $node) {
    $this->childCount++;
    $node->parent = $this;
    if ($child->previous === NULL) {
      $this->head = $node;
    }
    else {
      $child->previous->next = $node;
    }
    $node->previous = $child->previous;
    $node->next = $child;
    $child->previous = $node;
    return $this;
  }
protected function insertBeforeChild ( Node $ child , Node $ node ) { $ this -> childCount ++ ; $ node -> parent = $ this ; if ( $ child -> previous === NULL ) { $ this -> head = $ node ; } else { $ child -> previous -> next = $ node ; } $ node -> previous = $ child -> previous ; $ node -> next = $ child ; $ child -> previous = $ node ; return $ this ; }
Insert a node before a child.
@param Node $child
@param Node $node
@return $this
Insert a node before a child .