1 | <?php |
||
31 | abstract class Rest |
||
32 | { |
||
33 | /** |
||
34 | * @var Http |
||
35 | */ |
||
36 | protected $http; |
||
37 | /** |
||
38 | * @var \light\Easemob\Core\AccessToken |
||
39 | */ |
||
40 | protected $accessToken; |
||
41 | |||
42 | 3 | public function __construct(AccessToken $accessToken, Http $http) |
|
49 | |||
50 | /** |
||
51 | * @return Http |
||
52 | */ |
||
53 | public function getHttp() |
||
57 | |||
58 | /** |
||
59 | * @param Http $http |
||
60 | */ |
||
61 | public function setHttp($http) |
||
65 | |||
66 | /** |
||
67 | * @return AccessToken |
||
68 | */ |
||
69 | public function getAccessToken() |
||
73 | |||
74 | /** |
||
75 | * @param AccessToken $accessToken |
||
76 | */ |
||
77 | public function setAccessToken($accessToken) |
||
81 | |||
82 | /** |
||
83 | * @param $name |
||
84 | * @param $arguments |
||
85 | * |
||
86 | * @throws MethodNotFoundException |
||
87 | * |
||
88 | * @return mixed |
||
89 | */ |
||
90 | 3 | public function __call($name, $arguments) |
|
101 | |||
102 | /** |
||
103 | * Parse response. |
||
104 | * |
||
105 | * @param ResponseInterface $response |
||
106 | * |
||
107 | * @throws EasemobException |
||
108 | * @throws \light\Easemob\Exception\HttpException |
||
109 | * |
||
110 | * @return mixed |
||
111 | */ |
||
112 | 3 | protected function parseResponse(ResponseInterface $response) |
|
139 | |||
140 | /** |
||
141 | * Set request access_token query. |
||
142 | */ |
||
143 | 3 | protected function registerHttpMiddleware() |
|
148 | |||
149 | /** |
||
150 | * Attache access token to request query. |
||
151 | * |
||
152 | * @return \Closure |
||
153 | */ |
||
154 | public function accessTokenMiddleware() |
||
169 | } |
||
170 |