/** * @param BaseRequest $request * @return array * @throws \cdcchen\wechat\base\RequestException * @throws \cdcchen\wechat\base\ResponseException */ private static function fetch(BaseRequest $request) { $client = new DefaultClient(); return $client->sendRequest($request, function (HttpResponse $response) { return $response->getData(); }); }
/** * @param $ticket * @return array * @throws \cdcchen\wechat\base\RequestException * @throws \cdcchen\wechat\base\ResponseException */ public function getInfo($ticket) { $client = new DefaultClient(); $request = (new ShakeInfoRequest())->setTicket($ticket); return $client->sendRequest($request, function (HttpResponse $response) { $data = $response->getData(); return $data['data']; }); }