Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('SYSPATH') or die('No direct script access.');
- /**
- * RPC Serializer for Kohana 3.2
- * @author bagnz0r (http://bagnohax.pl)
- */
- class RpcSerializer {
- private $builder;
- protected $data;
- /**
- * Constructor will construct data object
- *
- * @param array $data
- * @throws Kohana_Exception
- */
- public function __construct($data, $builder)
- {
- if (!is_array($data))
- throw new Kohana_Exception('$data is not an array');
- $this->data = $data;
- // Load up builder
- $class = 'rpcbuilder' . strtolower($builder);
- $this->builder = new $class;
- }
- /**
- * This function returns serialized string of $this->data
- *
- * @return serialized_string
- */
- public function get()
- {
- return $this->builder->get($this->data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement