Kraken\Util\Buffer\BufferIterator::remove PHP Method

remove() public method

Remove the byte at the current iterator position and moves the iterator to the previous character.
public remove ( ) : string
return string
    public function remove()
    {
        if (!$this->valid()) {
            throw new OutOfBoundsException('The iterator is not valid!');
        }
        $temp = $this->buffer[$this->current];
        unset($this->buffer[$this->current]);
        --$this->current;
        return $temp;
    }

Usage Example

Ejemplo n.º 1
0
 public function testApiRemove_ThrowsException_OnInvalidIterator()
 {
     $this->setExpectedException(OutOfBoundsException::class);
     for ($this->iterator->rewind(); $this->iterator->valid(); $this->iterator->next()) {
     }
     $this->iterator->remove();
 }