- Timestamp:
- 03/18/08 17:08:25 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcWriter.php
r1361 r1434 1 1 <?php 2 2 /** 3 * Class for a json-rpc response to a request.3 * Utility class for creates json data. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 7 7 * @subpackage service_jsonrpc 8 8 */ 9 stubClassLoader::load('net::stubbles::ipo::response::stubDecoratedResponse', 10 'net::stubbles::php::string::stubRecursiveStringEncoder', 9 stubClassLoader::load('net::stubbles::php::string::stubRecursiveStringEncoder', 11 10 'net::stubbles::php::string::stubUTF8Encoder' 12 11 ); 13 12 /** 14 * Class for a json-rpc response to a request. 15 * 16 * Decorator around another stubResponse instance. 13 * Utility class for creates json data. 17 14 * 18 15 * @package stubbles 19 16 * @subpackage service_jsonrpc 20 17 * @link http://json-rpc.org/wiki/specification 18 * @static 21 19 */ 22 class stubJsonRpc Response extends stubDecoratedResponse20 class stubJsonRpcWriter extends stubBaseObject 23 21 { 24 22 /** … … 45 43 * @param string $message fault message 46 44 */ 47 public function writeFault($reqId, $message)45 public static function writeFault($reqId, $message) 48 46 { 49 47 $fault = array('id' => $reqId, … … 51 49 'error' => self::$encoder->encode($message) 52 50 ); 53 $this->response->write(json_encode($fault));51 return json_encode($fault); 54 52 } 55 53 … … 60 58 * @param string $result 61 59 */ 62 public function writeResponse($reqId, $result)60 public static function writeResponse($reqId, $result) 63 61 { 64 62 $response = array('id' => $reqId, … … 66 64 'error' => null 67 65 ); 68 $this->response->write(json_encode($response));66 return json_encode($response); 69 67 } 70 68 }
