Kraken\Util\Buffer\Buffer::shift PHP Method

shift() public method

public shift ( $length )
    public function shift($length)
    {
        $length = (int) $length;
        if (0 >= $length) {
            return '';
        }
        if (strlen($this->data) <= $length) {
            $buffer = $this->data;
            $this->data = '';
            return $buffer;
        }
        $buffer = (string) substr($this->data, 0, $length);
        $this->data = (string) substr($this->data, $length);
        return $buffer;
    }