private static function encodeIntValue($major_type, $value)
    {
        switch(true)
        {
            case $value <= AdditionalType::MAX_VALUE:
                return self::encodeFirstByte($major_type, $value);

            case $value <= Max::UINT_8:
                return self::encodeFirstByte($major_type, AdditionalType::UINT_8) . pack(PackFormat::UINT_8, $value);

            case $value <= Max::UINT_16:
                return self::encodeFirstByte($major_type, AdditionalType::UINT_16) . pack(PackFormat::UINT_16, $value);

            case $value <= Max::UINT_32:
                return self::encodeFirstByte($major_type, AdditionalType::UINT_32) . pack(PackFormat::UINT_32, $value);

            // Must be 64 if it's not in any of the previous cases
            default:
                return self::encodeFirstByte($major_type, AdditionalType::UINT_64) . pack(PackFormat::UINT_64, $value >> 32, $value & 0xffffffff);
        }
    }
private static function encodeIntValue($major_type, $value)
    {
        switch(true)
        {
            case $value <= AdditionalType::MAX_VALUE:
                return self::encodeFirstByte($major_type, $value);

            case $value <= Max::UINT_8:
                return self::encodeFirstByte($major_type, AdditionalType::UINT_8) . pack(PackFormat::UINT_8, $value);

            case $value <= Max::UINT_16:
                return self::encodeFirstByte($major_type, AdditionalType::UINT_16) . pack(PackFormat::UINT_16, $value);

            case $value <= Max::UINT_32:
                return self::encodeFirstByte($major_type, AdditionalType::UINT_32) . pack(PackFormat::UINT_32, $value);

            // Must be 64 if it's not in any of the previous cases
            default:
                return self::encodeFirstByte($major_type, AdditionalType::UINT_64) . pack(PackFormat::UINT_64, $value >> 32, $value & 0xffffffff);
        }
    }
private static function encodeIntValue ( $ major_type , $ value ) { switch ( true ) { case $ value <= AdditionalType :: MAX_VALUE : return self :: encodeFirstByte ( $ major_type , $ value ) ; case $ value <= Max :: UINT_8 : return self :: encodeFirstByte ( $ major_type , AdditionalType :: UINT_8 ) . pack ( PackFormat :: UINT_8 , $ value ) ; case $ value <= Max :: UINT_16 : return self :: encodeFirstByte ( $ major_type , AdditionalType :: UINT_16 ) . pack ( PackFormat :: UINT_16 , $ value ) ; case $ value <= Max :: UINT_32 : return self :: encodeFirstByte ( $ major_type , AdditionalType :: UINT_32 ) . pack ( PackFormat :: UINT_32 , $ value ) ; // Must be 64 if it's not in any of the previous cases default : return self :: encodeFirstByte ( $ major_type , AdditionalType :: UINT_64 ) . pack ( PackFormat :: UINT_64 , $ value >> 32 , $ value & 0xffffffff ) ; } }
Encodes a value into a CBOR string.

@param int $major_type The MajorType enum to set the first byte.
@param int $value Value to encode.
@throws CborException
@return string The encoded byte string.
Encodes a value into a CBOR string .