Facotory method to call the handler methods
@param  string $method
@param  array $args
@return mixed
5622
protected static function runCallback($method, $args)
	{
		$instance = static::resolveFacadeInstance();

		if(empty($args))
		{
			throw new InvalidArgumentException("Please provide an argument to this method");
			
		}

		switch (count($args))
		{
			case 0:
				return $instance->$method();

			case 1:
				return $instance->$method($args[0]);

			case 2:
				return $instance->$method($args[0], $args[1]);

			case 3:
				return $instance->$method($args[0], $args[1], $args[2]);

			case 4:
				return $instance->$method($args[0], $args[1], $args[2], $args[3]);

			default:
				return call_user_func_array(array($instance, $method), $args);
		}
	}
388444
public function singleCall($method, $args = [], $cb = null)
    {
        return Daemon::$process->IPCManager->sendSingleCall(
            '\\' . get_class($this) . ($this->name !== '' ? ':' . $this->name : ''),
            $method,
            $args,
            $cb
        );
    }
250275
protected function invockeAction($method, $arguments)
    {
        try {
            $result = call_user_func_array([$this, $method], $arguments);
        } catch (\Exception $e) {
            $result = $this->createResponse(
                sprintf('%s::%s - %s:%s', get_class($this), $method, get_class($e), $e->getMessage()),
                500
            );
        }
        return $result;
    }
20586
public function handle(Message $message, array $args)
    {
        $subCommand = array_shift($args);

        if (array_key_exists($subCommand, $this->subCommands)) {
            return $this->subCommands[$subCommand]->handle($message, $args);
        } elseif (array_key_exists($subCommand, $this->subCommandAliases)) {
            return $this->subCommands[$this->subCommandAliases[$subCommand]]->handle($message, $args);
        }

        if (! is_null($subCommand)) {
            array_unshift($args, $subCommand);
        }

        return call_user_func_array($this->callable, [$message, $args]);
    }
735938
protected function transform($method, $args, $prefix = 'transform')
    {
        $method = $prefix . CommonUtils::snakeCaseToCamelCase($method);

        if (method_exists($this, $method)) {
            $result = call_user_func_array([$this, $method], $args);

            if ($result) {
                return $result;
            }
        }

        return reset($args);
    }
979779
public function handle(string $method, array $arguments)
    {
        $upMethod = strtoupper($method);
        $context  = array_shift($arguments);

        if (in_array($upMethod, self::$asynCommand)) {
            $sql = '';
            if ($upMethod == 'GO') {
                if (!empty($arguments[1])) {
                    $sql = trim($arguments[1]);
                } else {
                    $sql = $this->getDBQueryBuilder($context)->getStatement(false);
                }
            }

            if (!empty($sql) && empty($arguments[0]) && !empty($this->slaves)) {
                if (stripos($sql, 'SELECT') === 0 || stripos($sql, 'SHOW') === 0) {
                    $rand     = array_rand($this->slaves);
                    $poolName = $this->slaves[$rand];
                } else {
                    $poolName = $this->master;
                }
            } else {
                $poolName = $this->master;
            }

            $pool = getInstance()->getAsynPool($poolName);
            if ($pool == null) {
                throw new Exception("mysql pool $poolName not register!");
            }
            $this->getDBQueryBuilder($context)->mysqlPool = $pool;
            if (method_exists($this->getDBQueryBuilder(), $method)) {
                return $this->getDBQueryBuilder($context)->{$method}(...$arguments);
            } else {
                array_push($arguments, $context);
                return $this->getDBQueryBuilder($context)->mysqlPool->{$method}(...$arguments);
            }
        }

        $this->getDBQueryBuilder($context)->{$method}(...$arguments);

        return $this->__wrapper;
    }
1141061
protected function tryMethod($method, array $arguments = array())
    {
        try {
            call_user_func_array(array($this, $method), $arguments);

            return true;
        } catch (\Exception $e) {
            return false;
        }
    }
881260
public function invoke($object, $method, array $arguments = [])
    {
        $reflection = new \ReflectionClass($object);
        $method = $reflection->getMethod($method);
        $args = $this->resolveArguments($method, $arguments);

        return $method->invokeArgs($object, $args);
    }
567728
protected function callOnceAfterMethodHooks($classInstance, $method, array $args = [])
    {
        $method = self::getCalledMethod($method);

        $onceAfterMethodName = 'onceAfter'.ucfirst($method);
        if ( ! isset($this->instanceOnceCalledMethods['after'][$onceAfterMethodName])) {
            if (isset($this->hooks[$onceAfterMethodName])) {
                $this->instanceOnceCalledMethods['after'][$onceAfterMethodName] = true;

                foreach ($this->hooks[$onceAfterMethodName] as $callable) {
                    try {
                        $return = $this->callCallable($classInstance, $callable, $args, $method, false);
                    } catch (CancelPropagationException $e) {
                        break;
                    }

                    if ($return !== null) {
                        return $return;
                    }
                }
            }
        }

        $return = $this->callGlobalOnceAfterMethodHooks($classInstance, $method, $onceAfterMethodName);

        if ($return !== null) {
            return $return;
        }
    }
574676
protected function callHandler($handler_id, $method, array $arguments)
    {
        try {
            $handlers = $this->getHandlers();
            return Handler::call($handlers, $handler_id, $method, $arguments);
        } catch (Exception $ex) {
            return $ex->getMessage();
        }
    }
1213052
public function remoteHttpCall($method, array $args)
    {
        $reqParams = [
            'version'   => static::$version,
            'args'      => array_values($args),
            'time'      => microtime(true),
            'handler'   => $this->handler,
            'construct' => $this->construct,
            'method'    => $method
        ];
        $sendData = [
            'data' => getInstance()->pack->pack($reqParams),
        ];
        $headers = [
            'X-RPC' => 1,
        ];

        /**
         * @var Client $client
         */
        $client = yield $this->getObject(Client::class)->goDnsLookup($this->host, $this->timeout, $headers);
        if (!$client) {
            throw new Exception($this->host . ' dns query failed');
        }

        $urlPath = '/' .$this->urlPath . '/' . $this->service . '/' . $this->handler . '/' . $this->method;
        if ($this->verb == 'POST') {
            $response = yield $client->goPost($urlPath, $sendData, $this->timeout);
        } else {
            $response = yield $client->goGet($urlPath, $sendData, $this->timeout);
        }

        if ($response && !empty($response['body']) && ($jsonRes = json_decode($response['body'], true))) {
            if ($response['statusCode'] !== 200) {
                $this->getContext()->getLog()->warning(dump($response, false, true));
                return false;
            } else {
                return $jsonRes;
            }
        } else {
            $this->getContext()->getLog()->warning(dump($response, false, true));
            return false;
        }
    }
902057
public function send($method,$arg1="",$arg2="") {

        // if we have a string, send it as well
        if($arg1 != "" && $arg2 != "")
        {
            $command = "$method \"$arg1\" \"$arg2\"";
        }
        elseif($arg1 != "") {
            $command = "$method \"$arg1\"";
        }
        else {
            $command = $method;
        }


        fputs($this->fp,"$command\n"); //Do desired action!
        $c = 0;
        while(!feof($this->fp)) {
            $got =  fgets($this->fp,1024);
            if(strncmp("OK",$got,strlen("OK"))==0)
                break;
            if(strncmp("ACK",$got,strlen("ACK"))==0)
                break;

            $ret[$c]=$got;
            $c++;
        }

        $sentResponse = array(
            "response" => $this->response,
            "got" => $got,
            "ret" => $ret
        );
        return $sentResponse;

    }
63989
protected function payloadExec($method, $args = []) {
        $this->getPayloadInstance();
        if (method_exists($this->instance, $method)) {
            return $this->di->call([$this->instance, $method], $args);
        }
        return null;
    }
485528
public function callHandler($handler_id, $method = 'data', array $arguments = array())
    {
        $handlers = $this->getHandlers();
        return Handler::call($handlers, $handler_id, $method, $arguments);
    }
736897
public static function callProtectedMethod($object, $method, ...$args)
    {
        $refObject = new \ReflectionObject($object);
        $refProp   = $refObject->getMethod($method);
        $refProp->setAccessible(true);

        return $refProp->invokeArgs($object, $args);
    }
1086946
public function notify(string $method, $args): \Generator
    {
        $notification = new Notification();
        $notification->method = $method;
        $notification->params = $args;

        $serializedNotification = Json::encode($this->mapper->dump($notification));
        yield Recoil::execute($this->transport->send($serializedNotification));
    }
1106966
public function callMethod($class, $method, array $args = array())
    {
        $method = $this->findMethod($class, $method);
        $method->setAccessible(true);

        return $method->invokeArgs(
            is_object($class) ? $class : null,
            $args
        );
    }