Perform the actual call to Communibase

@param string $method
@param array $arguments

@return \Psr\Http\Message\ResponseInterface

@throws Exception
194256
private function call($method, array $arguments)
    {
        try {

            /**
             * Due to GuzzleHttp not passing a default host header given to the client to _every_ request made by the
             * client we manually check to see if we need to add a hostheader to requests.
             * When the issue is resolved the foreach can be removed (as the function might even?)
             *
             * @see https://github.com/guzzle/guzzle/issues/1297
             */
            if (isset($this->extraHeaders['host'])) {
                $arguments[1]['headers']['Host'] = $this->extraHeaders['host'];
            }

            if ($this->logger) {
                $this->logger->startQuery($method . ' ' . reset($arguments), $arguments);
            }

            $response = call_user_func_array([$this->getClient(), $method], $arguments);

            if ($this->logger) {
                $this->logger->stopQuery();
            }

            return $response;

            // try to catch the Guzzle client exception (404's, validation errors etc) and wrap them into a CB exception
        } catch (ClientException $e) {

            $response = $e->getResponse();
            $response = json_decode($response === null ? '' : $response->getBody(), true);

            throw new Exception(
                $response['message'],
                $response['code'],
                $e,
                (($_ =& $response['errors']) ?: [])
            );

        } catch (ConnectException $e) {

            throw new Exception('Can not connect', 500, $e, []);

        }
    }
464413
public function addCall(string $method, array $arguments = []): Service
    {
        $this->calls[$method] = $arguments;

        return $this;
    }
1157443
protected function callTraitMethod($method, array $args=[])
    {
        if (method_exists($this, $method)) {
            return call_user_func([$this, $method], ...$args);
        }
        return null;
    }
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);
		}
	}
117307
public function evaluate($method, $arguments)
    {
        $this->validate($method, $arguments);
        return $this->evaluator->evaluate($method, $arguments);
    }
837916
private function execute(array $arguments = []): ResponseInterface
    {
        ob_start();
        $level = ob_get_level();

        try {
            $return = call_user_func_array($this->callable, $arguments);

            if ($return instanceof ResponseInterface) {
                $response = $return;
                $return = '';
            } elseif (is_null($return)
                 || is_scalar($return)
                 || (is_object($return) && method_exists($return, '__toString'))
            ) {
                $responseFactory = $this->responseFactory ?: Factory::getResponseFactory();
                $response = $responseFactory->createResponse();
            } else {
                throw new UnexpectedValueException(
                    'The value returned must be scalar or an object with __toString method'
                );
            }

            while (ob_get_level() >= $level) {
                $return = ob_get_clean().$return;
            }

            $body = $response->getBody();

            if ($return !== '' && $body->isWritable()) {
                $body->write($return);
            }

            return $response;
        } catch (Exception $exception) {
            while (ob_get_level() >= $level) {
                ob_end_clean();
            }

            throw $exception;
        }
    }
1013009
public function execute($method, array $options = [], array $arguments = []) {
        $params = [];

        if (count($options) > 0) {
            $params['options'] = $options;
        }

        if (count($arguments) > 0) {
            $params['arguments'] = $arguments;
        }

        $result = $this->api->request(
            $method,
            $params
        );

        if (!array_key_exists('success', $result)) {
            throw new RuntimeException('Missing success status');
        }

        if (!is_bool($result['success']) || $result['success'] === false) {
            throw new RuntimeException('Command failed');
        }

        if (!array_key_exists('output', $result)) {
            throw new RuntimeException('Missing output');
        }

        if (!is_array($result['output'])) {
            throw new RuntimeException('Invalid output');
        }

        return $result['output'];
    }
1367621
private function call($method, array $args)
    {
        $request = $this->rpcProtocol->encodeRequest($method, $args);

        $response = $this->transport->request($request);

        $response = $this->rpcProtocol->decodeValue($response);

        if ($response instanceof \Exception) {
            throw $response;
        }

        return $response;
    }
1016309
protected function checkRetry($method, $arguments = array())
    {
        Tools::log("Run {$method} Faild. {$this->errMsg}[{$this->errCode}]", "ERR - {$this->appid}");
        if (!$this->_retry && in_array($this->errCode, array('40014', '40001', '41001', '42001'))) {
            ($this->_retry = true) && $this->resetAuth();
            $this->errCode = 40001;
            $this->errMsg = 'no access';
            Tools::log("Retry Run {$method} ...", "MSG - {$this->appid}");
            return call_user_func_array(array($this, $method), $arguments);
        }
        return false;
    }
1326895
public static function callMethod($object, $method, $args = null)
    {
        $args   = \func_get_args();
        $object = \array_shift($args);
        $method = \array_shift($args);

        $refl = new \ReflectionObject($object);
        $reflMethod = $refl->getMethod($method);
        $reflMethod->setAccessible(true);

        return $reflMethod->invokeArgs($object, $args);
    }
723011
public function tryCall($method, $arguments)
    {
        if ($ret = $this->hook('method-'.$method, $arguments)) {
            return $ret;
        }
        array_unshift($arguments, $this);
        if (($ret = $this->app->hook('global-method-'.$method, $arguments))) {
            return $ret;
        }
    }
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;
    }
1039345
public function call($className, $method, $arguments = null)
    {
        $callable = [$className, $method];
        if ($arguments === null) {
            return call_user_func($callable);
        } else {
            return call_user_func_array($callable, $arguments);
        }
    }
620856
public function performApiRequest(TelegramMethods $method): PromiseInterface
    {
        $this->logger->debug('Request for async API call, resetting internal values', [\get_class($method)]);
        $this->resetObjectValues();
        $option = $this->formConstructor->constructOptions($method);
        return $this->sendRequestToTelegram($method, $option)
            ->then(function (TelegramResponse $response) use ($method) {
                return $method::bindToObject($response, $this->logger);
            }, function ($error) {
                $this->logger->error($error);
                throw $error;
            });
    }
719679
public function popsCall($method, array &$arguments)
    {
        if ($this->liberatorReflector->hasMethod($method)) {
            $method = $this->liberatorReflector->getMethod($method);
            $method->setAccessible(true);

            return $this->popsProxySubValue(
                $method->invokeArgs($this->popsValue(), $arguments)
            );
        }

        return parent::popsCall($method, $arguments);
    }
1304128
protected function call($method, array $params = array())
    {
        $this->init();

        // Prepare headers
        $this->soapClient->__setSoapHeaders($this->getSessionHeader());

        $requestEvent = new Event\RequestEvent($method, $params);
        $this->dispatch(Events::REQUEST, $requestEvent);

        try {
            $result = $this->soapClient->$method($params);
        } catch (\SoapFault $soapFault) {
            $faultEvent = new Event\FaultEvent($soapFault, $requestEvent);
            $this->dispatch(Events::FAULT, $faultEvent);

            throw $soapFault;
        }

        // No result e.g. for logout, delete with empty array
        if (!isset($result->result)) {
            return array();
        }

        $this->dispatch(
            Events::RESPONSE,
            new Event\ResponseEvent($requestEvent, $result->result)
        );

        return $result->result;
    }
166598
public function setFlashMessage($method, $arguments)
    {
        $flashSession = $this->resolve('cygnite.common.session-manager.flash.flash-message');

        if ($method == 'setFlash') {
            $this->_call($flashSession, $method, $arguments);

            return $this;
        }

        return $this->_call($flashSession, $method, $arguments);
    }