Example #1
0
 /**
  * @param $method
  * @param array $params
  * @return mixed
  * @throws RandomOrgException
  */
 protected function query($method, $params = [])
 {
     // All other methods require an API key except verifySignature
     // this method seems to work without it
     if ($method != 'verifySignature') {
         $params = array_merge($params, ['apiKey' => $this->apiKey]);
     }
     $req = $this->client->prepareRequest($method, $params);
     $res = $this->client->makeRequest($req);
     if (isset($res['error'])) {
         throw new RandomOrgException('Random.org exception (' . $res['error']['code'] . '): ' . $res['error']['message']);
     }
     return $res;
 }