parseJSON() 보호된 메소드

Parses the server response from the API
protected parseJSON ( $json ) : array
리턴 array structured JSON
예제 #1
0
 protected function parseJSON($json)
 {
     $rootJSON = parent::parseJSON($json);
     //set factual ID
     if ($rootJSON['response']['included_rows'] == 1) {
         $this->factualID = $rootJSON['response']['data'][0]['factual_id'];
     }
     return $rootJSON;
 }
예제 #2
0
 /**
  * Parses JSON as array and assigns object values
  * @param string json JSON returned from API
  * @return array structured JSON
  */
 protected function parseJSON($json)
 {
     $rootJSON = parent::parseJSON($json);
     $this->title = $rootJSON['response']['view']['title'];
     $this->description = $rootJSON['response']['view']['description'];
     $this->makeColumnSchemas($rootJSON['response']['view']['fields']);
     $this->searchEnabled = (bool) $rootJSON['response']['view']['search_enabled'];
     $this->geoEnabled = (bool) $rootJSON['response']['view']['geo_enabled'];
     return $rootJSON;
 }
예제 #3
0
 /**
  * Parses JSON as array and assigns object values
  * @param string json JSON returned from API
  * @return array structured JSON
  */
 protected function parseJSON($json)
 {
     $rootJSON = parent::parseJSON($json);
     $this->commitID = $rootJSON['response']['commit_id'];
     if (isset($this->newEntity)) {
         $this->newEntity = (bool) $rootJSON['response']['new_entity'];
     }
     if (isset($rootJSON['response']['factual_id'])) {
         $this->factualID = $rootJSON['response']['factual_id'];
     }
     return $rootJSON;
 }
예제 #4
0
 /**
  * Parses JSON as array and assigns object values
  * @param string json JSON returned from API
  * @return array structured JSON
  */
 protected function parseJSON($json)
 {
     $rootJSON = parent::parseJSON($json);
     //assign total row count
     if (isset($rootJSON['response']['total_row_count'])) {
         $this->totalRowCount = $rootJSON['response']['total_row_count'];
     }
     if (isset($rootJSON['response']['included_rows'])) {
         $this->includedRows = $rootJSON['response']['included_rows'];
     }
     //assign data
     $this->assignData($rootJSON['response']['data']);
     return $rootJSON;
 }
예제 #5
0
 protected function parseJSON($json)
 {
     $rootJSON = parent::parseJSON($json);
     //Check against rowcount and resolve flag
     if ($rootJSON['response']['included_rows'] == 1 || $rootJSON['response']['included_rows'] > 1) {
         if ($rootJSON['response']['data'][0]['resolved']) {
             $this->resolved = $rootJSON['response']['data'][0];
             unset($this->resolved['resolved']);
             //remove old flag
         }
     }
     $this->data = $rootJSON['response']['data'];
     return $rootJSON;
 }
예제 #6
0
 /**
  * Parses JSON as array and assigns object values
  * @param string json JSON returned from API
  * @return array structured JSON
  */
 protected function parseJSON($json)
 {
     $rootJSON = parent::parseJSON($json);
     //in some instances writes to the system will be delayed, and we cannot provide a committ ID
     if (array_key_exists('error_type', $rootJSON) && $rootJSON['error_type'] == "DelayedResponse") {
         //throw new Exception($rootJSON['message']);
         $this->isDelayed = true;
     } else {
         $this->commitID = $rootJSON['response']['commit_id'];
         if (isset($this->newEntity)) {
             $this->newEntity = (bool) $rootJSON['response']['new_entity'];
         }
         if (isset($rootJSON['response']['factual_id'])) {
             $this->factualID = $rootJSON['response']['factual_id'];
         }
     }
     return $rootJSON;
 }