コード例 #1
0
 /**
  * Flushes the buffer by POSTing the stats in JSON format to Stat Hat.
  */
 public function postBatch()
 {
     foreach ($this->buffer as $ezKey => $stats) {
         if (!empty($stats)) {
             $params = ['ezkey' => $ezKey, 'data' => $stats];
             $isPosted = $this->client->post('/ez', $params, 'application/json');
             if ($isPosted) {
                 $this->resetBuffer($ezKey);
             }
         }
     }
 }
コード例 #2
0
 /**
  * Flushes the buffer by POSTing the stats in JSON format to Stat Hat.
  */
 public function postBatch()
 {
     if ($this->hasStats()) {
         foreach ($this->buffer['counters'] as $params) {
             $this->client->post('/c', $params);
         }
         foreach ($this->buffer['values'] as $params) {
             $this->client->post('/v', $params);
         }
         $this->resetBuffer();
     }
 }
コード例 #3
0
ファイル: Provider.php プロジェクト: skoro/pod
 /**
  * Performs http GET request.
  * @param string $url
  * @throws \LogicException when no http client attached to provider.
  * @throws \Exception when any http client exception occuried.
  * @return string
  */
 protected function httpRequest($url)
 {
     if (!($http = $this->getHttpClient())) {
         throw new \LogicException('No http client defined.');
     }
     return $this->httpClient->get($url);
 }
コード例 #4
0
ファイル: HtmlPdfApi.php プロジェクト: netgen/htmlpdfapi
 /**
  * Gets the list of available assets
  *
  * @return response
  * @throws \Exception
  */
 public function getAssetList()
 {
     $params = array();
     try {
         return $this->client->sendRequest('assets', $params, 'GET');
     } catch (\Exception $ex) {
         throw $ex;
     }
 }