original_string: public function remove($key, $type=null) {
          $child = $this->get($key, $type);
          if ($child !== false) {
              foreach ($this->collection as $colkey => $node) {
                  if ($node->key === $key && (is_null($type) || $node->type == $type)) {
                      unset($this->collection[$colkey]);
                      $this->collection = array_values($this->collection);
                      break;
                  }
              }
              unset($this->orderedcollection[$child->type][$child->key]);
              $this->count--;
              return true;
          }
          return false;
      }
code: public function remove($key, $type=null) {
          $child = $this->get($key, $type);
          if ($child !== false) {
              foreach ($this->collection as $colkey => $node) {
                  if ($node->key === $key && (is_null($type) || $node->type == $type)) {
                      unset($this->collection[$colkey]);
                      $this->collection = array_values($this->collection);
                      break;
                  }
              }
              unset($this->orderedcollection[$child->type][$child->key]);
              $this->count--;
              return true;
          }
          return false;
      }
code_tokens: public function remove ( $ key , $ type = null ) { $ child = $ this -> get ( $ key , $ type ) ; if ( $ child !== false ) { foreach ( $ this -> collection as $ colkey => $ node ) { if ( $ node -> key === $ key && ( is_null ( $ type ) || $ node -> type == $ type ) ) { unset ( $ this -> collection [ $ colkey ] ) ; $ this -> collection = array_values ( $ this -> collection ) ; break ; } } unset ( $ this -> orderedcollection [ $ child -> type ] [ $ child -> key ] ) ; $ this -> count -- ; return true ; } return false ; }
docstring: Removes the node with the given key and type from the collection
  
  @param string|int $key The key of the node we want to find.
  @param int $type
  @return bool
docstring_tokens: Removes the node with the given key and type from the collection