public static function decode($encoded)
    {
        // Trying to decode null, eh?
        if (is_null($encoded) || empty($encoded))
        {
            return null;
        }

        // Unpack into array of characters
        $chars = str_split($encoded);

        // Convert the character array to an array of bytes
        $bytes = array();
        foreach ($chars as $char)
        {
            $bytes[] = ord($char);
        }

        $val = self::recursiveDecode($bytes);

        if (!empty($bytes))
        {
            throw new CborException("There are more bytes than expected in the CBOR byte array.");
        }

        return $val;
    }