1 | <?php |
||
8 | abstract class Core |
||
9 | { |
||
10 | /** |
||
11 | * $serverHost |
||
12 | * 接口域名. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $serverHost = ''; |
||
17 | /** |
||
18 | * $secretKey |
||
19 | * secretKey. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $secretKey = ''; |
||
24 | |||
25 | /** |
||
26 | * __construct. |
||
27 | * |
||
28 | * @param array $config [description] |
||
29 | */ |
||
30 | public function __construct($config = []) |
||
36 | |||
37 | /** |
||
38 | * setConfig |
||
39 | * 设置配置. |
||
40 | * |
||
41 | * @param array $config 模块配置 |
||
42 | */ |
||
43 | public function setConfig($config) |
||
66 | |||
67 | /** |
||
68 | * setConfigSecretKey |
||
69 | * 设置secretKey. |
||
70 | * |
||
71 | * @param string $secretKey |
||
72 | */ |
||
73 | public function setConfigSecretKey($secretKey) |
||
79 | |||
80 | /** |
||
81 | * setConfigRequestMethod |
||
82 | * 设置请求方法. |
||
83 | * |
||
84 | * @param string $method |
||
|
|||
85 | */ |
||
86 | public function setConfigContentType($contentType) |
||
92 | |||
93 | /** |
||
94 | * setConfigSecretKey |
||
95 | * 设置secretKey. |
||
96 | * |
||
97 | * @param string $secretKey |
||
98 | */ |
||
99 | public function setConfigRequestMethod($requestMethod) |
||
105 | |||
106 | /** |
||
107 | * getLastRequest |
||
108 | * 获取上次请求的url. |
||
109 | * |
||
110 | * @return |
||
111 | */ |
||
112 | public function getLastRequest() |
||
116 | |||
117 | /** |
||
118 | * getLastResponse |
||
119 | * 获取请求的原始返回. |
||
120 | * |
||
121 | * @return |
||
122 | */ |
||
123 | public function getLastResponse($response) |
||
129 | |||
130 | /** |
||
131 | * generateUrl |
||
132 | * 生成请求的URL,不发起请求 |
||
133 | * |
||
134 | * @param string $name 接口方法名 |
||
135 | * @param array $params 请求参数 |
||
136 | * @param string $body 请求Body |
||
137 | * |
||
138 | * @return |
||
139 | */ |
||
140 | public function generateUrl($name, $params, $body) |
||
146 | |||
147 | /** |
||
148 | * generateUrlBody |
||
149 | * 生成请求的URLBody. |
||
150 | * |
||
151 | * @param array $paramArray 请求参数 |
||
152 | * @param string $secretKey 订阅密钥 |
||
153 | * @param string $ContentType 请求Body的类型 |
||
154 | * @param string $requestMethod 请求方式,GET/POST |
||
155 | * @param string $url 接口URL |
||
156 | * @param string $body 请求Body |
||
157 | * |
||
158 | * @return |
||
159 | */ |
||
160 | public static function generateUrlBody($paramArray, $secretKey, $contentType, $requestMethod, $url, $body) |
||
183 | |||
184 | /** |
||
185 | * __call |
||
186 | * 通过__call转发请求 |
||
187 | * |
||
188 | * @param string $name 方法名 |
||
189 | * @param array $arguments 参数 |
||
190 | * |
||
191 | * @return |
||
192 | */ |
||
193 | public function call($name, $arguments) |
||
200 | |||
201 | /** |
||
202 | * _dispatchRequest |
||
203 | * 发起接口请求 |
||
204 | * |
||
205 | * @param string $name 接口名 |
||
206 | * @param array $arguments 接口参数 |
||
207 | * |
||
208 | * @return |
||
209 | */ |
||
210 | protected function dispatchRequest($name, $arguments) |
||
225 | |||
226 | /** |
||
227 | * send |
||
228 | * 发起请求 |
||
229 | * |
||
230 | * @param array $paramArray 请求参数 |
||
231 | * @param string $secretKey 订阅密钥 |
||
232 | * @param string $ContentType 请求Body的类型 |
||
233 | * @param string $requestMethod 请求方式,GET/POST |
||
234 | * @param string $url 接口URL |
||
235 | * @param string $body 请求Body |
||
236 | * |
||
237 | * @return |
||
238 | */ |
||
239 | public static function send($paramArray, $secretKey, $contentType, $requestMethod, $requestHost) |
||
263 | |||
264 | /** |
||
265 | * _dealResponse |
||
266 | * 处理返回. |
||
267 | * |
||
268 | * @param array $response |
||
269 | * |
||
270 | * @return |
||
271 | */ |
||
272 | protected function dealResponse($response) |
||
288 | } |
||
289 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.