public function clear()
    {
        $this->emitOnChange(__METHOD__);
        $items = &$this->items();
        if (count($this->listeners('item.remove'))) {
            foreach ($items as $item) {
                $this->emit('item.remove', [$item, $this]);
            }
        }

        // It's not mistake that $items never used after assigning empty array.
        // Yep, it really clears the collection.
        $items = [];
        $this->endEmitOnChange(__METHOD__);
        return $this;
    }
public function clear()
    {
        $this->emitOnChange(__METHOD__);
        $items = &$this->items();
        if (count($this->listeners('item.remove'))) {
            foreach ($items as $item) {
                $this->emit('item.remove', [$item, $this]);
            }
        }

        // It's not mistake that $items never used after assigning empty array.
        // Yep, it really clears the collection.
        $items = [];
        $this->endEmitOnChange(__METHOD__);
        return $this;
    }
public function clear ( ) { $ this -> emitOnChange ( __METHOD__ ) ; $ items = & $ this -> items ( ) ; if ( count ( $ this -> listeners ( 'item.remove' ) ) ) { foreach ( $ items as $ item ) { $ this -> emit ( 'item.remove' , [ $ item , $ this ] ) ; } } // It's not mistake that $items never used after assigning empty array. // Yep, it really clears the collection. $ items = [ ] ; $ this -> endEmitOnChange ( __METHOD__ ) ; return $ this ; }
Removes all items from collection.

@return $this
Removes all items from collection .