private static function _batchResponseFromFields(&$json, &$fields)
    {
        if ($fields->type == 'mt_text') {
            $result = new Api\MtBatchTextSmsResult();
            $result->setBody($fields->body);

            if (isset($fields->parameters)) {
                $result->setParameters(
                    Deserialize::_convertParameters($fields->parameters)
                );
            }
        } else if ($fields->type == 'mt_binary') {
            $result = new Api\MtBatchBinarySmsResult();
            $result->setUdh(hex2bin($fields->udh));
            $result->setBody(base64_decode($fields->body));
        } else {
            throw new UnexpectedResponseException(
                "Received unexpected batch type " . $fields->type,
                $json
            );
        }

        // Read the common fields.
        Deserialize::_batchResponseHelper($json, $fields, $result);

        return $result;
    }
private static function _batchResponseFromFields(&$json, &$fields)
    {
        if ($fields->type == 'mt_text') {
            $result = new Api\MtBatchTextSmsResult();
            $result->setBody($fields->body);

            if (isset($fields->parameters)) {
                $result->setParameters(
                    Deserialize::_convertParameters($fields->parameters)
                );
            }
        } else if ($fields->type == 'mt_binary') {
            $result = new Api\MtBatchBinarySmsResult();
            $result->setUdh(hex2bin($fields->udh));
            $result->setBody(base64_decode($fields->body));
        } else {
            throw new UnexpectedResponseException(
                "Received unexpected batch type " . $fields->type,
                $json
            );
        }

        // Read the common fields.
        Deserialize::_batchResponseHelper($json, $fields, $result);

        return $result;
    }
private static function _batchResponseFromFields ( & $ json , & $ fields ) { if ( $ fields -> type == 'mt_text' ) { $ result = new Api \ MtBatchTextSmsResult ( ) ; $ result -> setBody ( $ fields -> body ) ; if ( isset ( $ fields -> parameters ) ) { $ result -> setParameters ( Deserialize :: _convertParameters ( $ fields -> parameters ) ) ; } } else if ( $ fields -> type == 'mt_binary' ) { $ result = new Api \ MtBatchBinarySmsResult ( ) ; $ result -> setUdh ( hex2bin ( $ fields -> udh ) ) ; $ result -> setBody ( base64_decode ( $ fields -> body ) ) ; } else { throw new UnexpectedResponseException ( "Received unexpected batch type " . $ fields -> type , $ json ) ; } // Read the common fields. Deserialize :: _batchResponseHelper ( $ json , $ fields , $ result ) ; return $ result ; }
Helper that creates and populates a batch result object.

The result is populated from the result of `json_decode`.

@param string $json   the JSON formatted string
@param object $fields the `json_decode` containing the result

@return Api\MtBatchSmsResult the parsed result

@throws UnexpectedResponseException if the JSON contained an
unexpected message type
Helper that creates and populates a batch result object .