private function read(int $words, int $wordLength) : string
    {
        $length = $words * $wordLength;

        if ($this->position + $length > $this->length) {
            throw GeometryIOException::invalidWKB('unexpected end of stream');
        }

        if ($length === 1) {
            return $this->wkb[$this->position++];
        }

        if ($this->invert) {
            $data = '';

            for ($i = 0; $i < $words; $i++) {
                $data .= strrev(substr($this->wkb, $this->position + $i * $wordLength, $wordLength));
            }
        } else {
            $data = substr($this->wkb, $this->position, $length);
        }

        $this->position += $length;

        return $data;
    }
private function read(int $words, int $wordLength) : string
    {
        $length = $words * $wordLength;

        if ($this->position + $length > $this->length) {
            throw GeometryIOException::invalidWKB('unexpected end of stream');
        }

        if ($length === 1) {
            return $this->wkb[$this->position++];
        }

        if ($this->invert) {
            $data = '';

            for ($i = 0; $i < $words; $i++) {
                $data .= strrev(substr($this->wkb, $this->position + $i * $wordLength, $wordLength));
            }
        } else {
            $data = substr($this->wkb, $this->position, $length);
        }

        $this->position += $length;

        return $data;
    }
private function read ( int $ words , int $ wordLength ) : string { $ length = $ words * $ wordLength ; if ( $ this -> position + $ length > $ this -> length ) { throw GeometryIOException :: invalidWKB ( 'unexpected end of stream' ) ; } if ( $ length === 1 ) { return $ this -> wkb [ $ this -> position ++ ] ; } if ( $ this -> invert ) { $ data = '' ; for ( $ i = 0 ; $ i < $ words ; $ i ++ ) { $ data .= strrev ( substr ( $ this -> wkb , $ this -> position + $ i * $ wordLength , $ wordLength ) ) ; } } else { $ data = substr ( $ this -> wkb , $ this -> position , $ length ) ; } $ this -> position += $ length ; return $ data ; }
Reads words from the buffer.

@param int $words      The number of words to read.
@param int $wordLength The word length in bytes.

@return string

@throws GeometryIOException
Reads words from the buffer .