Inheritance: extends r\Datum\Datum
Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 public function testObjectDatumString()
 {
     $ob = new ObjectDatum(array(4 => new StringDatum('a')));
     $this->assertEquals(array('4' => 'a'), (array) $ob->run($this->conn));
 }
Exemplo n.º 3
0
 public static function decodedJSONToDatum($json)
 {
     if (is_null($json)) {
         return NullDatum::decodeServerResponse($json);
     }
     if (is_bool($json)) {
         return BoolDatum::decodeServerResponse($json);
     }
     if (is_int($json) || is_float($json)) {
         return NumberDatum::decodeServerResponse($json);
     }
     if (is_string($json)) {
         return StringDatum::decodeServerResponse($json);
     }
     if (is_array($json)) {
         return ArrayDatum::decodeServerResponse($json);
     }
     if (is_object($json)) {
         return ObjectDatum::decodeServerResponse($json);
     }
     throw new RqlDriverError("Unhandled type " . get_class($json));
 }