Exemplo n.º 1
0
 /**
  * Make the actual request.
  *
  * @param bool $static
  * @param string $uri
  * @param array $params
  * @return \LeagueWrap\Response
  * @throws LimitReachedException
  */
 protected function clientRequest($static, $uri, $params)
 {
     // check if we have hit the limit
     if (!$static && !$this->collection->hitLimits($this->region->getRegion())) {
         throw new LimitReachedException('You have hit the request limit in your collection.');
     }
     $response = $this->client->request($uri, $params);
     ++$this->requests;
     // check if it's a valid response object
     if ($response instanceof Response) {
         $this->checkResponseErrors($response);
     }
     return $response;
 }
 public function testGetLimits()
 {
     $limit1 = new Limit();
     $limit1->setRate(25, 10, 'na');
     $limit2 = new Limit();
     $limit2->setRate(2, 5, 'na');
     $collection = new Collection();
     $collection->addLimit($limit1);
     $collection->addLimit($limit2);
     $limits = $collection->getLimits();
     $this->assertEquals(2, sizeof($limits));
 }