Inheritance: extends r\Datum\Datum
Example #1
0
 public function __construct($args, Query $top)
 {
     if (!is_array($args)) {
         throw new RqlDriverError("Arguments must be an array.");
     }
     foreach ($args as &$arg) {
         if (!is_a($arg, 'r\\ValuedQuery\\RVar')) {
             throw new RqlDriverError("Arguments must be RVar variables.");
         }
         $arg = new NumberDatum($arg->getId());
         unset($arg);
     }
     $this->setPositionalArg(0, new ArrayDatum($args));
     $this->setPositionalArg(1, $top);
 }
Example #2
0
 public static function decodeServerResponse($json)
 {
     $result = new NumberDatum();
     $result->setValue((double) $json);
     return $result;
 }
Example #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));
 }