public static function create($class, $isConstructed, $tagNumber)
    {
        if (!is_numeric($class) || $class < self::CLASS_UNIVERSAL || $class > self::CLASS_PRIVATE) {
            throw new Exception(sprintf('Invalid class %d given', $class));
        }

        if (!is_bool($isConstructed)) {
            throw new Exception("\$isConstructed must be a boolean value ($isConstructed given)");
        }

        $tagNumber = self::makeNumeric($tagNumber);
        if ($tagNumber < 0) {
            throw new Exception(sprintf('Invalid $tagNumber %d given. You can only use positive integers.', $tagNumber));
        }

        if ($tagNumber < self::LONG_FORM) {
            return ($class << 6) | ($isConstructed << 5) | $tagNumber;
        }

        $firstOctet = ($class << 6) | ($isConstructed << 5) | self::LONG_FORM;

        // Tag numbers formatted in long form are base-128 encoded. See X.609#8.1.2.4
        return chr($firstOctet).Base128::encode($tagNumber);
    }
public static function create($class, $isConstructed, $tagNumber)
    {
        if (!is_numeric($class) || $class < self::CLASS_UNIVERSAL || $class > self::CLASS_PRIVATE) {
            throw new Exception(sprintf('Invalid class %d given', $class));
        }

        if (!is_bool($isConstructed)) {
            throw new Exception("\$isConstructed must be a boolean value ($isConstructed given)");
        }

        $tagNumber = self::makeNumeric($tagNumber);
        if ($tagNumber < 0) {
            throw new Exception(sprintf('Invalid $tagNumber %d given. You can only use positive integers.', $tagNumber));
        }

        if ($tagNumber < self::LONG_FORM) {
            return ($class << 6) | ($isConstructed << 5) | $tagNumber;
        }

        $firstOctet = ($class << 6) | ($isConstructed << 5) | self::LONG_FORM;

        // Tag numbers formatted in long form are base-128 encoded. See X.609#8.1.2.4
        return chr($firstOctet).Base128::encode($tagNumber);
    }
public static function create ( $ class , $ isConstructed , $ tagNumber ) { if ( ! is_numeric ( $ class ) || $ class < self :: CLASS_UNIVERSAL || $ class > self :: CLASS_PRIVATE ) { throw new Exception ( sprintf ( 'Invalid class %d given' , $ class ) ) ; } if ( ! is_bool ( $ isConstructed ) ) { throw new Exception ( "\$isConstructed must be a boolean value ($isConstructed given)" ) ; } $ tagNumber = self :: makeNumeric ( $ tagNumber ) ; if ( $ tagNumber < 0 ) { throw new Exception ( sprintf ( 'Invalid $tagNumber %d given. You can only use positive integers.' , $ tagNumber ) ) ; } if ( $ tagNumber < self :: LONG_FORM ) { return ( $ class << 6 ) | ( $ isConstructed << 5 ) | $ tagNumber ; } $ firstOctet = ( $ class << 6 ) | ( $ isConstructed << 5 ) | self :: LONG_FORM ; // Tag numbers formatted in long form are base-128 encoded. See X.609#8.1.2.4 return chr ( $ firstOctet ) . Base128 :: encode ( $ tagNumber ) ; }
Creates an identifier. Short form identifiers are returned as integers
for BC, long form identifiers will be returned as a string of octets.

@param int $class
@param bool $isConstructed
@param int $tagNumber

@throws Exception if the given arguments are invalid

@return int|string
Creates an identifier . Short form identifiers are returned as integers for BC long form identifiers will be returned as a string of octets .