LLMS_Dot_Com_API::parse_response( array $response )

Parse the body of the response and set a success/error


Parameters Parameters

$response

(array) (Required) response data


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.dot.com.api.php

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
protected function parse_response( $response ) {
 
    $body = json_decode( wp_remote_retrieve_body( $response ), true );
 
    if ( isset( $response['response'] ) && isset( $response['response']['code'] ) && ! in_array( $response['response']['code'], array( 200, 201 ) ) ) {
 
        $msg = isset( $body['message'] ) ? $body['message'] : $response['response']['message'];
        $this->set_error( $msg, isset( $body['code'] ) ? $body['code'] : $response['response']['code'], $body );
 
    } else {
 
        $this->set_result( $body );
 
    }
 
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.22.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.