private static function decodeIntValue($additional, &$bytes)
    {
        switch($additional)
        {
            case AdditionalType::UINT_8:
                $length = 1;
                break;

            case AdditionalType::UINT_16:
                $length = 2;
                break;

            case AdditionalType::UINT_32:
                $length = 4;
                break;

            case AdditionalType::UINT_64:
                $length = 8;
                break;

            default:
                return $additional;
        }

        self::checkByteArrayLength($bytes, $length);

        // Construct the value
        $value = 0;
        for ($i = $length-1; $i >= 0; $i--)
        {
            $value += array_shift($bytes) << ($i * 8);
        }

        return $value;
    }
private static function decodeIntValue($additional, &$bytes)
    {
        switch($additional)
        {
            case AdditionalType::UINT_8:
                $length = 1;
                break;

            case AdditionalType::UINT_16:
                $length = 2;
                break;

            case AdditionalType::UINT_32:
                $length = 4;
                break;

            case AdditionalType::UINT_64:
                $length = 8;
                break;

            default:
                return $additional;
        }

        self::checkByteArrayLength($bytes, $length);

        // Construct the value
        $value = 0;
        for ($i = $length-1; $i >= 0; $i--)
        {
            $value += array_shift($bytes) << ($i * 8);
        }

        return $value;
    }
private static function decodeIntValue ( $ additional , & $ bytes ) { switch ( $ additional ) { case AdditionalType :: UINT_8 : $ length = 1 ; break ; case AdditionalType :: UINT_16 : $ length = 2 ; break ; case AdditionalType :: UINT_32 : $ length = 4 ; break ; case AdditionalType :: UINT_64 : $ length = 8 ; break ; default : return $ additional ; } self :: checkByteArrayLength ( $ bytes , $ length ) ; // Construct the value $ value = 0 ; for ( $ i = $ length - 1 ; $ i >= 0 ; $ i -- ) { $ value += array_shift ( $ bytes ) << ( $ i * 8 ) ; } return $ value ; }
Decodes an integer value, based on the first byte and additional data.

@param int $additional Additional type.
@param array $bytes Remaining bytes in string.
@throws CborException If the byte array is not long enough for the specified type of integer.
@return int Decoded integer.
Decodes an integer value based on the first byte and additional data .