public static function decodeServerResponse($json) { $jsonArray = array_values((array) $json); foreach ($jsonArray as &$val) { $val = DatumConverter::decodedJSONToDatum($val); unset($val); } $result = new ArrayDatum(); $result->setValue($jsonArray); return $result; }
public static function decodeServerResponse($json) { $jsonObject = (array) $json; foreach ($jsonObject as $key => &$val) { $val = DatumConverter::decodedJSONToDatum($val); unset($val); } $result = new ObjectDatum(); $result->setValue($jsonObject); return $result; }
private function setBatch($response) { $dc = new DatumConverter(); $this->isComplete = $response['t'] == ResponseResponseType::PB_SUCCESS_SEQUENCE; $this->currentIndex = 0; $this->currentSize = \count($response['r']); $this->currentData = array(); foreach ($response['r'] as $row) { $this->currentData[] = $datum = $dc->decodedJSONToDatum($row); } }
function binary($str) { $encodedStr = base64_encode($str); if ($encodedStr === false) { throw new RqlDriverError("Failed to Base64 encode '" . $str . "'"); } $pseudo = array('$reql_type$' => 'BINARY', 'data' => $encodedStr); $dc = new DatumConverter(); return $dc->nativeToDatum($pseudo); }