protected function parsePoints(string $native, int &$pos, int $count, bool $allowSquare = false): array
    {
        $hasDelimiters = $squareDelimiter = false;

        $char = $this->nextChar($native, $pos);
        if ('[' === $char) {
            if (!$allowSquare) {
                throw TypeConversionException::parsingFailed($this, "'(' or numeric value", $native, $pos);
            }
            $hasDelimiters = $squareDelimiter = true;
            $pos++;

        } elseif ('(' === $char) {
            $nextPos = $pos + 1;
            if ($pos === strrpos($native, '(')
                || '(' === $this->nextChar($native, $nextPos)
            ) {
                $hasDelimiters = true;
                $pos++;
            }
        }

        $points = [];
        for ($i = 0; $i < $count; $i++) {
            if ($i > 0) {
                $this->expectChar($native, $pos, ',');
            }
            $points[] = $this->point->parseInput($native, $pos);
        }

        if ($hasDelimiters) {
            $this->expectChar($native, $pos, $squareDelimiter ? ']' : ')');
        }

        if ($allowSquare) {
            $points['open'] = $squareDelimiter;
        }

        return $points;
    }
protected function parsePoints(string $native, int &$pos, int $count, bool $allowSquare = false): array
    {
        $hasDelimiters = $squareDelimiter = false;

        $char = $this->nextChar($native, $pos);
        if ('[' === $char) {
            if (!$allowSquare) {
                throw TypeConversionException::parsingFailed($this, "'(' or numeric value", $native, $pos);
            }
            $hasDelimiters = $squareDelimiter = true;
            $pos++;

        } elseif ('(' === $char) {
            $nextPos = $pos + 1;
            if ($pos === strrpos($native, '(')
                || '(' === $this->nextChar($native, $nextPos)
            ) {
                $hasDelimiters = true;
                $pos++;
            }
        }

        $points = [];
        for ($i = 0; $i < $count; $i++) {
            if ($i > 0) {
                $this->expectChar($native, $pos, ',');
            }
            $points[] = $this->point->parseInput($native, $pos);
        }

        if ($hasDelimiters) {
            $this->expectChar($native, $pos, $squareDelimiter ? ']' : ')');
        }

        if ($allowSquare) {
            $points['open'] = $squareDelimiter;
        }

        return $points;
    }
protected function parsePoints ( string $ native , int & $ pos , int $ count , bool $ allowSquare = false ) : array { $ hasDelimiters = $ squareDelimiter = false ; $ char = $ this -> nextChar ( $ native , $ pos ) ; if ( '[' === $ char ) { if ( ! $ allowSquare ) { throw TypeConversionException :: parsingFailed ( $ this , "'(' or numeric value" , $ native , $ pos ) ; } $ hasDelimiters = $ squareDelimiter = true ; $ pos ++ ; } elseif ( '(' === $ char ) { $ nextPos = $ pos + 1 ; if ( $ pos === strrpos ( $ native , '(' ) || '(' === $ this -> nextChar ( $ native , $ nextPos ) ) { $ hasDelimiters = true ; $ pos ++ ; } } $ points = [ ] ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { if ( $ i > 0 ) { $ this -> expectChar ( $ native , $ pos , ',' ) ; } $ points [ ] = $ this -> point -> parseInput ( $ native , $ pos ) ; } if ( $ hasDelimiters ) { $ this -> expectChar ( $ native , $ pos , $ squareDelimiter ? ']' : ')' ) ; } if ( $ allowSquare ) { $ points [ 'open' ] = $ squareDelimiter ; } return $ points ; }
Parses given number of points from native database value

@param string $native       native database value
@param int    $pos          position
@param int    $count        number of points to parse
@param bool   $allowSquare  whether square brackets [] are allowed around points
@return array
@throws TypeConversionException
Parses given number of points from native database value