private static function _decodeIndefiniteLength(string $data, int &$offset): ElementBase
    {
        $idx = $offset;
        $elements = [];
        $end = strlen($data);
        while (true) {
            if ($idx >= $end) {
                throw new DecodeException(
                    'Unexpected end of data while decoding indefinite length structure.');
            }
            $el = Element::fromDER($data, $idx);
            if ($el->isType(self::TYPE_EOC)) {
                break;
            }
            $elements[] = $el;
        }
        $offset = $idx;
        $type = new static(...$elements);
        $type->_indefiniteLength = true;
        return $type;
    }
private static function _decodeIndefiniteLength(string $data, int &$offset): ElementBase
    {
        $idx = $offset;
        $elements = [];
        $end = strlen($data);
        while (true) {
            if ($idx >= $end) {
                throw new DecodeException(
                    'Unexpected end of data while decoding indefinite length structure.');
            }
            $el = Element::fromDER($data, $idx);
            if ($el->isType(self::TYPE_EOC)) {
                break;
            }
            $elements[] = $el;
        }
        $offset = $idx;
        $type = new static(...$elements);
        $type->_indefiniteLength = true;
        return $type;
    }
private static function _decodeIndefiniteLength ( string $ data , int & $ offset ) : ElementBase { $ idx = $ offset ; $ elements = [ ] ; $ end = strlen ( $ data ) ; while ( true ) { if ( $ idx >= $ end ) { throw new DecodeException ( 'Unexpected end of data while decoding indefinite length structure.' ) ; } $ el = Element :: fromDER ( $ data , $ idx ) ; if ( $ el -> isType ( self :: TYPE_EOC ) ) { break ; } $ elements [ ] = $ el ; } $ offset = $ idx ; $ type = new static ( ... $ elements ) ; $ type -> _indefiniteLength = true ; return $ type ; }
Decode elements for an indefinite length.

@param string $data DER data
@param int $offset Offset to data
@throws DecodeException
@return ElementBase
Decode elements for an indefinite length .