src/Support/Collection/NodeSet.php
/**
     * Removes the given item from the set.
     *
     * @param TValue $item
     */
Removes the given item from the set.
Removes the given item from the set .
public function remove(Node $item): void
    {
        if (!$this->cache->contains($item)) {
            return;
        }
        $this->cache->detach($item);
        if ($this->list[--$this->length] === $item) {
            array_pop($this->list);
            return;
        }
        if ($this->list[0] === $item) {
            array_shift($this->list);
            return;
        }
        $index = array_search($item, $this->list, true);
        array_splice($this->list, $index, 1);
    }
public function remove ( Node $ item ) : void { if ( ! $ this -> cache -> contains ( $ item ) ) { return ; } $ this -> cache -> detach ( $ item ) ; if ( $ this -> list [ -- $ this -> length ] === $ item ) { array_pop ( $ this -> list ) ; return ; } if ( $ this -> list [ 0 ] === $ item ) { array_shift ( $ this -> list ) ; return ; } $ index = array_search ( $ item , $ this -> list , true ) ; array_splice ( $ this -> list , $ index , 1 ) ; }
Removes the given item from the set.
Removes the given item from the set .
// Remove the item from the cache. // If the given item is the last item in the array simply pop it off, // rather than searching the array and splicing the value out. // If item is the first item in the list shift it off the array as it // is faster than searching the array and then splicing out the value.