コード例 #1
0
 /**
  * @param bool $auth
  * @param int $limit
  * @param bool $fetch
  * @return array
  * @throws \Exception
  */
 public function listProviders($auth = false, $limit = 0, $fetch = false)
 {
     if ($auth) {
         $uri = $this->client->getUri() . "providers";
         $keys = $this->client->getFullAuth();
     } else {
         $uri = $this->client->getUri() . "providers/true";
         $keys = "";
     }
     if (is_numeric($limit) && $limit > 0) {
         $uri .= "?order_total={$limit}";
     }
     if (is_bool($fetch) && $fetch) {
         if (is_numeric($limit) && $limit > 0) {
             $uri .= "&fetch=true";
         } else {
             $uri .= "?fetch=true";
         }
     }
     $response = Rest::get($uri, $keys, $this->headers);
     $providers = Factory::arrayProviders($response);
     return $providers;
 }