bhq@iemsoft.cn
2018-11-27 e2b48dac099e43f4b3243cdf19a7522e4b5eccbe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
 
namespace JPush\Model;
 
use JPush\Exception\APIRequestException;
 
class DeviceResponse {
    public $isOk = false;
    public $json;
    public $response;
    public $body;
 
    function __construct($response)
    {
        if ($response->code !== 200) {
            throw APIRequestException::fromResponse($response);
        }
 
        if ($response->raw_body) {
            $this->body = json_decode($response->raw_body, true);
        } else {
            $this->body = null;
        }
        $this->json = $response->raw_body;
        $this->response = $response;
        $this->isOk = true;
    }
 
 
}