mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
Object's methods callbacks replaced by functions
This commit is contained in:
parent
de2f60bfdc
commit
6247d20f95
@ -133,10 +133,11 @@ abstract class RequestProcessor {
|
|||||||
|
|
||||||
if ($need_result) {
|
if ($need_result) {
|
||||||
// There is callback function
|
// There is callback function
|
||||||
// TODO: Think about callback functions nature
|
$function = $callback['function'];
|
||||||
$object = $callback['object'];
|
$arguments += empty($callback['arguments'])
|
||||||
$method = $callback['method'];
|
? array()
|
||||||
$object->$method($arguments);
|
: unserialize($callback['arguments']);
|
||||||
|
call_user_func_array($function, $arguments);
|
||||||
} else {
|
} else {
|
||||||
// There is no callback function
|
// There is no callback function
|
||||||
$this->responses[] = $this->mibewAPI->buildResult(
|
$this->responses[] = $this->mibewAPI->buildResult(
|
||||||
@ -197,11 +198,10 @@ abstract class RequestProcessor {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($async) {
|
if ($async) {
|
||||||
// TODO: Think about callbacks
|
|
||||||
// TODO: May be add exception if $callback = null
|
|
||||||
|
|
||||||
// Store callback
|
// Store callback
|
||||||
|
if (! is_null($callback)) {
|
||||||
$this->saveCallback($token, $callback);
|
$this->saveCallback($token, $callback);
|
||||||
|
}
|
||||||
|
|
||||||
// Send asynchronous request
|
// Send asynchronous request
|
||||||
$this->sendAsyncRequest($request);
|
$this->sendAsyncRequest($request);
|
||||||
|
Loading…
Reference in New Issue
Block a user