/** * Dynamically access the object attributes. * * @param string $key key name of want get attribute * @return mixed */ public function __get($key) { if (in_array($key, static::$jsonType) === true) { return json_dec($this->meta->{$key}, true); } return $this->meta->{$key}; }
/** * Issued the captcha key * * @return string * @throws WrongResponseException */ public function issue() { $client = $this->createClient(); $response = $client->request('get', 'nkey?' . http_build_query(['code' => 0]), ['headers' => ['X-Naver-Client-Id' => $this->clientId, 'X-Naver-Client-Secret' => $this->clientSecret]]); if (!($key = array_get(json_dec($response->getBody()->getContents(), true), 'key'))) { throw new WrongResponseException(); } return $key; }