예제 #1
0
 /**
  * Handles most common method call
  * @param $method
  * @param $args
  * @param bool $passToken
  * @param bool $passPropertyId
  * @param bool $tryAcquireNewToken
  *
  * @return mixed
  * @throws WubookException
  */
 public function defaultRequestHandler($method, $args, $passToken = true, $passPropertyId = true, $tryAcquireNewToken = true)
 {
     $response = $this->client->request($method, $args, $passToken, $passPropertyId, $tryAcquireNewToken);
     $parsedResponse = ResponseDecoder::decodeResponse($response);
     if ($parsedResponse[0] != 0) {
         throw new WubookException($parsedResponse[1], $parsedResponse[0]);
     }
     return $parsedResponse[1];
 }
예제 #2
0
 /**
  * @return bool true if token was sucessfully released
  */
 public function releaseCurrentToken()
 {
     $response = $this->client->request('release_token', [], true, false, false);
     $parsedResponse = ResponseDecoder::decodeResponse($response);
     $isTokenReleased = $parsedResponse[0] == 0;
     if ($isTokenReleased) {
         $this->client->tokenProvider->removeCurrentSavedToken();
     }
     return $isTokenReleased;
 }