From 6247d20f95f801e822050e0d6a136c4e4fe856f0 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Tue, 18 Sep 2012 10:41:38 +0000 Subject: [PATCH] Object's methods callbacks replaced by functions --- .../webim/libs/classes/request_processor.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/messenger/webim/libs/classes/request_processor.php b/src/messenger/webim/libs/classes/request_processor.php index 52adbf58..495fe58d 100644 --- a/src/messenger/webim/libs/classes/request_processor.php +++ b/src/messenger/webim/libs/classes/request_processor.php @@ -133,10 +133,11 @@ abstract class RequestProcessor { if ($need_result) { // There is callback function - // TODO: Think about callback functions nature - $object = $callback['object']; - $method = $callback['method']; - $object->$method($arguments); + $function = $callback['function']; + $arguments += empty($callback['arguments']) + ? array() + : unserialize($callback['arguments']); + call_user_func_array($function, $arguments); } else { // There is no callback function $this->responses[] = $this->mibewAPI->buildResult( @@ -197,11 +198,10 @@ abstract class RequestProcessor { ); if ($async) { - // TODO: Think about callbacks - // TODO: May be add exception if $callback = null - // Store callback - $this->saveCallback($token, $callback); + if (! is_null($callback)) { + $this->saveCallback($token, $callback); + } // Send asynchronous request $this->sendAsyncRequest($request);