public static function batchDeliveryReport($json)
    {
        $fields = Deserialize::_fromJson($json);

        if (!isset($fields->type) || $fields->type != 'delivery_report_sms') {
            throw new UnexpectedResponseException(
                "Expected delivery report", $json
            );
        }

        $result = new Api\BatchDeliveryReport();
        $result->setBatchId($fields->batch_id);
        $result->setTotalMessageCount($fields->total_message_count);
        $result->setStatuses(
            array_map(
                function ($s) {
                    $r = new Api\BatchDeliveryReportStatus();
                    $r->setCode($s->code);
                    $r->setStatus($s->status);
                    $r->setCount($s->count);
                    if (isset($s->recipients)) {
                        $r->setRecipients($s->recipients);
                    }
                    return $r;
                },
                $fields->statuses
            )
        );

        return $result;
    }
public static function batchDeliveryReport($json)
    {
        $fields = Deserialize::_fromJson($json);

        if (!isset($fields->type) || $fields->type != 'delivery_report_sms') {
            throw new UnexpectedResponseException(
                "Expected delivery report", $json
            );
        }

        $result = new Api\BatchDeliveryReport();
        $result->setBatchId($fields->batch_id);
        $result->setTotalMessageCount($fields->total_message_count);
        $result->setStatuses(
            array_map(
                function ($s) {
                    $r = new Api\BatchDeliveryReportStatus();
                    $r->setCode($s->code);
                    $r->setStatus($s->status);
                    $r->setCount($s->count);
                    if (isset($s->recipients)) {
                        $r->setRecipients($s->recipients);
                    }
                    return $r;
                },
                $fields->statuses
            )
        );

        return $result;
    }
public static function batchDeliveryReport ( $ json ) { $ fields = Deserialize :: _fromJson ( $ json ) ; if ( ! isset ( $ fields -> type ) || $ fields -> type != 'delivery_report_sms' ) { throw new UnexpectedResponseException ( "Expected delivery report" , $ json ) ; } $ result = new Api \ BatchDeliveryReport ( ) ; $ result -> setBatchId ( $ fields -> batch_id ) ; $ result -> setTotalMessageCount ( $ fields -> total_message_count ) ; $ result -> setStatuses ( array_map ( function ( $ s ) { $ r = new Api \ BatchDeliveryReportStatus ( ) ; $ r -> setCode ( $ s -> code ) ; $ r -> setStatus ( $ s -> status ) ; $ r -> setCount ( $ s -> count ) ; if ( isset ( $ s -> recipients ) ) { $ r -> setRecipients ( $ s -> recipients ) ; } return $ r ; } , $ fields -> statuses ) ) ; return $ result ; }
Reads a JSON blob describing a batch delivery report.

@param string $json the JSON text

@return Api\BatchDeliveryReport the parsed batch delivery report

@throws UnexpectedResponseException if the JSON contained an
unexpected message type
Reads a JSON blob describing a batch delivery report .