From de2f60bfdc7a1d02a154575058d846a55575e7d8 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Tue, 18 Sep 2012 10:18:32 +0000 Subject: [PATCH] Add some warnings to RequestProcessor class Request/response methods not abstract any more. To prevent direct call(without overloading) add error with E_USER_WARNING level into this methods. --- .../webim/libs/classes/request_processor.php | 68 +++++++++++-------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/src/messenger/webim/libs/classes/request_processor.php b/src/messenger/webim/libs/classes/request_processor.php index 5f160031..52adbf58 100644 --- a/src/messenger/webim/libs/classes/request_processor.php +++ b/src/messenger/webim/libs/classes/request_processor.php @@ -379,6 +379,44 @@ abstract class RequestProcessor { return empty($results['errorCode']); } + /** + * Sends synchronous request + * + * @param array $request The 'request' array. See Mibew API for details + * @return mixed response array or boolean false on failure + */ + protected function sendSyncRequest($request) { + trigger_error('Method sendSyncRequest does not implement!', E_USER_WARNING); + } + + /** + * Sends asynchronous request + * + * @param array $request The 'request' array. See Mibew API for details + * @return boolean true on success or false on failure + */ + protected function sendAsyncRequest($request) { + trigger_error('Method sendAsyncRequest does not implement!', E_USER_WARNING); + } + + /** + * Sends synchronous responses + * + * @param array $responses An array of the 'Request' arrays. See Mibew API for details + */ + protected function sendSyncResponses($responses) { + trigger_error('Method sendSyncResponses does not implement!', E_USER_WARNING); + } + + /** + * Sends asynchronous responses + * + * @param array $responses An array of the 'Request' arrays. See Mibew API for details + */ + protected function sendAsyncResponses($responses) { + trigger_error('Method sendAsyncResponses does not implement!', E_USER_WARNING); + } + /** * Creates and returns an instance of the MibewAPI class. * @@ -411,36 +449,6 @@ abstract class RequestProcessor { * @see RequestProcessor::registerEvents() */ protected abstract function processorCall(&$func); - - /** - * Sends synchronous request - * - * @param array $request The 'request' array. See Mibew API for details - * @return mixed response array or boolean false on failure - */ - protected abstract function sendSyncRequest($request); - - /** - * Sends asynchronous request - * - * @param array $request The 'request' array. See Mibew API for details - * @return boolean true on success or false on failure - */ - protected abstract function sendAsyncRequest($request); - - /** - * Sends synchronous responses - * - * @param array $responses An array of the 'Request' arrays. See Mibew API for details - */ - protected abstract function sendSyncResponses($responses); - - /** - * Sends asynchronous responses - * - * @param array $responses An array of the 'Request' arrays. See Mibew API for details - */ - protected abstract function sendAsyncResponses($responses); } class RequestProcessorException extends Exception {