@@ -35,37 +35,37 @@ class API extends AbstractAPI
3535 public function __construct(Signature $signature, $classify, $filter)
3636 {
3737 $this->signature = $signature;
38- $this->classify = $classify;
39- $this->filter = $filter;
38+ $this->classify = $classify;
39+ $this->filter = $filter;
4040 }
4141
4242 /**
4343 * 请求API.
4444 *
4545 * @param string $method
46- * @param array $params
47- * @param array $files
46+ * @param array $params
47+ * @param array $files
4848 *
49- * @return array
5049 * @throws NotFoundException
51- *
5250 * @throws IllegalParameterException
51+ *
52+ * @return array
5353 */
5454 public function request($method, $params = [], $files = [])
5555 {
5656 $url = sprintf('%s/%s/%s_%s', self::BASE_API, $this->classify, $this->classify, strtolower($method));
5757 if (!array_key_exists(strtolower($method), $this->filter)) {
5858 throw new NotFoundException(sprintf('the url %s can not found!please reaffirm', $url));
5959 }
60- $factory = new ValidatorFactory(new Translator());
60+ $factory = new ValidatorFactory(new Translator());
6161 $validator = $factory->make($params, $this->filter[$method]);
6262 if (!$validator->passes()) {
6363 throw new IllegalParameterException(sprintf('参数错误:[%s]', json_encode($validator->errors(), JSON_UNESCAPED_UNICODE)));
6464 }
65- $http = $this->getHttp();
66- $params = $this->processParams($this->signature, $params);
65+ $http = $this->getHttp();
66+ $params = $this->processParams($this->signature, $params);
6767 $response = $files ? $http->upload($url, $params, $files) : $http->post($url, $params);
68- $result = json_decode(strval($response->getBody()), true);
68+ $result = json_decode(strval($response->getBody()), true);
6969 if (isset($result['ret'])) {
7070 return $result;
7171 }
0 commit comments