Advertisement
bagnz0r

Untitled

Oct 27th, 2011
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. /**
  4. *
  5. * RPC Object Module for Kohana 3.2
  6. * JSON RPC Object that allows us to serialize and deserialize JSON data
  7. *
  8. * @author bagnz0r (http://bagnohax.pl)
  9. * @package RpcObject
  10. *
  11. */
  12.  
  13. class RpcJson implements RpcObject {
  14.    
  15.     /**
  16.      * A variable to hold our object (all the data and deserialized data)
  17.      * @var object
  18.      */
  19.     public $data;
  20.    
  21.     /**
  22.      * (non-PHPdoc)
  23.      * @see RpcObject::getSerialized()
  24.      */
  25.     public function getSerialized()
  26.     {
  27.         return json_encode($data);
  28.     }
  29.    
  30.     /**
  31.      * (non-PHPdoc)
  32.      * @see RpcObject::deserializeString()
  33.      */
  34.     public function deserializeString($string)
  35.     {
  36.         $this->data = (object)json_decode($string, true);
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement