Пример #1
0
 function toString()
 {
     if (function_exists('json_encode')) {
         return json_encode($this);
     } else {
         $json = new ServicesJSON();
         return $json->encode($this);
     }
 }
 /**
  * array-walking function for use in generating JSON-formatted name-value pairs
  *
  * @param    string  $name   name of key to use
  * @param    mixed   $value  reference to an array element to be encoded
  *
  * @return   string  JSON-formatted name-value pair, like '"name":value'
  * @access   private
  */
 function name_value($name, $value)
 {
     $encoded_value = $this->encode($value);
     if (ServicesJSON::isError($encoded_value)) {
         return $encoded_value;
     }
     return $this->encode(strval($name)) . ':' . $encoded_value;
 }