public function remove()
    {
        if ($this->count() === 0) {
            throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.');
        }

        $head = $this[$this->index];

        unset($this[$this->index]);
        $this->index++;

        return $head;
    }
public function remove()
    {
        if ($this->count() === 0) {
            throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.');
        }

        $head = $this[$this->index];

        unset($this[$this->index]);
        $this->index++;

        return $head;
    }
public function remove ( ) { if ( $ this -> count ( ) === 0 ) { throw new NoSuchElementException ( 'Can\'t return element from Queue. Queue is empty.' ) ; } $ head = $ this [ $ this -> index ] ; unset ( $ this [ $ this -> index ] ) ; $ this -> index ++ ; return $ head ; }
Retrieves and removes the head of this queue.

This method differs from `poll()` only in that it throws an exception if
this queue is empty.

@return mixed the head of this queue.

@throws NoSuchElementException if this queue is empty.

@see self::poll()
Retrieves and removes the head of this queue .