Пример #1
0
 /**
  * Get the metadata of a dataset
  *
  * @see    SodaClient::enableAssociativeArrays()
  * @see    SodaClient::disableAssociativeArrays()
  *
  * @since  0.1.0
  *
  * @return array The metadata as a PHP array. The array will contain associative arrays or stdClass objects from
  *               the decoded JSON received from the data set.
  */
 public function getMetadata()
 {
     $metadataUrlQuery = new UrlQuery($this->buildViewUrl(), $this->sodaClient->getToken(), $this->sodaClient->getEmail(), $this->sodaClient->getPassword());
     return $metadataUrlQuery->sendGet("", $this->sodaClient->associativeArrayEnabled());
 }
Пример #2
0
 /**
  * Send the appropriate request header based on the method that's required
  *
  * @param UrlQuery $urlQuery          The object for the API endpoint
  * @param string   $method            Either `get` or `delete`
  * @param bool     $associativeArrays Whether or not to return the information as an associative array
  * @param array    $headers           An array with the cURL headers received
  *
  * @return mixed
  */
 private function sendIndividualRequest($urlQuery, $method, $associativeArrays, &$headers)
 {
     if ($method === "get") {
         return $urlQuery->sendGet("", $associativeArrays, $headers);
     } else {
         if ($method === "delete") {
             return $urlQuery->sendDelete($associativeArrays, $headers);
         }
     }
     throw new \InvalidArgumentException("Invalid request method");
 }