private static function _decodeDefiniteLength(string $data, int &$offset,
        int $length): ElementBase
    {
        $idx = $offset;
        $end = $idx + $length;
        $elements = [];
        while ($idx < $end) {
            $elements[] = Element::fromDER($data, $idx);
            // check that element didn't overflow length
            if ($idx > $end) {
                throw new DecodeException(
                    "Structure's content overflows length.");
            }
        }
        $offset = $idx;
        // return instance by static late binding
        return new static(...$elements);
    }
private static function _decodeDefiniteLength(string $data, int &$offset,
        int $length): ElementBase
    {
        $idx = $offset;
        $end = $idx + $length;
        $elements = [];
        while ($idx < $end) {
            $elements[] = Element::fromDER($data, $idx);
            // check that element didn't overflow length
            if ($idx > $end) {
                throw new DecodeException(
                    "Structure's content overflows length.");
            }
        }
        $offset = $idx;
        // return instance by static late binding
        return new static(...$elements);
    }
private static function _decodeDefiniteLength ( string $ data , int & $ offset , int $ length ) : ElementBase { $ idx = $ offset ; $ end = $ idx + $ length ; $ elements = [ ] ; while ( $ idx < $ end ) { $ elements [ ] = Element :: fromDER ( $ data , $ idx ) ; // check that element didn't overflow length if ( $ idx > $ end ) { throw new DecodeException ( "Structure's content overflows length." ) ; } } $ offset = $ idx ; // return instance by static late binding return new static ( ... $ elements ) ; }
Decode elements for a definite length.

@param string $data DER data
@param int $offset Offset to data
@param int $length Number of bytes to decode
@throws DecodeException
@return ElementBase
Decode elements for a definite length .