public static function fromDER(string $data, int &$offset = null): Identifier
    {
        $idx = $offset ?? 0;
        $datalen = strlen($data);
        if ($idx >= $datalen) {
            throw new DecodeException("Invalid offset.");
        }
        $byte = ord($data[$idx++]);
        // bits 8 and 7 (class)
        // 0 = universal, 1 = application, 2 = context-specific, 3 = private
        $class = (0b11000000 & $byte) >> 6;
        // bit 6 (0 = primitive / 1 = constructed)
        $pc = (0b00100000 & $byte) >> 5;
        // bits 5 to 1 (tag number)
        $tag = (0b00011111 & $byte);
        // long-form identifier
        if (0x1f == $tag) {
            $tag = self::_decodeLongFormTag($data, $idx);
        }
        if (isset($offset)) {
            $offset = $idx;
        }
        return new self($class, $pc, $tag);
    }
public static function fromDER(string $data, int &$offset = null): Identifier
    {
        $idx = $offset ?? 0;
        $datalen = strlen($data);
        if ($idx >= $datalen) {
            throw new DecodeException("Invalid offset.");
        }
        $byte = ord($data[$idx++]);
        // bits 8 and 7 (class)
        // 0 = universal, 1 = application, 2 = context-specific, 3 = private
        $class = (0b11000000 & $byte) >> 6;
        // bit 6 (0 = primitive / 1 = constructed)
        $pc = (0b00100000 & $byte) >> 5;
        // bits 5 to 1 (tag number)
        $tag = (0b00011111 & $byte);
        // long-form identifier
        if (0x1f == $tag) {
            $tag = self::_decodeLongFormTag($data, $idx);
        }
        if (isset($offset)) {
            $offset = $idx;
        }
        return new self($class, $pc, $tag);
    }
public static function fromDER ( string $ data , int & $ offset = null ) : Identifier { $ idx = $ offset ?? 0 ; $ datalen = strlen ( $ data ) ; if ( $ idx >= $ datalen ) { throw new DecodeException ( "Invalid offset." ) ; } $ byte = ord ( $ data [ $ idx ++ ] ) ; // bits 8 and 7 (class) // 0 = universal, 1 = application, 2 = context-specific, 3 = private $ class = ( 0b11000000 & $ byte ) >> 6 ; // bit 6 (0 = primitive / 1 = constructed) $ pc = ( 0b00100000 & $ byte ) >> 5 ; // bits 5 to 1 (tag number) $ tag = ( 0b00011111 & $ byte ) ; // long-form identifier if ( 0x1f == $ tag ) { $ tag = self :: _decodeLongFormTag ( $ data , $ idx ) ; } if ( isset ( $ offset ) ) { $ offset = $ idx ; } return new self ( $ class , $ pc , $ tag ) ; }
Decode identifier component from DER data.

@param string $data DER encoded data
@param int|null $offset Reference to the variable that contains offset
into the data where to start parsing. Variable is updated to
the offset next to the parsed identifier. If null, start from
offset 0.
@throws DecodeException If decoding fails
@return self
Decode identifier component from DER data .