callMethod
@param  string $method [@todo description]
@param  object $req [@todo description]
@param  object $upstream [@todo description]
@return object
333834
public function callMethod($method, $req, $upstream)
    {
        $method = strtr(ucwords(strtr($method, ['_' => ' '])), [' ' => '']);
        if (strtolower($method) === 'generic') {
            $method = 'NotFound';
        }
        $class = __NAMESPACE__ . '\\Methods\\' . $method;
        if (!class_exists($class)) {
            $class = __NAMESPACE__ . '\\Methods\\NotFound';
        }
        return new $class($this, $upstream, $req);
    }
724400
protected function makeCall( string $overrideRegion = null, string $method = self::METHOD_GET ): PromiseInterface
	{
		if ($overrideRegion)
			$this->setTemporaryRegion($overrideRegion);

		$this->used_method = $method;
		$this->used_key    = self::SET_KEY;

		$requestHeaders = [];
		$requestPromise = null;
		$url = $this->_getCallUrl($requestHeaders);
		$requestHash = md5($url);

		if (!$requestPromise && $this->getSetting(self::SET_USE_DUMMY_DATA, false))
		{
			// DummyData are supposed to be used
			try
			{
				// try loading the data
				$this->_loadDummyData($responseHeaders, $responseBody, $responseCode);
				$this->processCallResult($responseHeaders, $responseBody, $responseCode);
				$requestPromise = new FulfilledPromise($this->getResult());
			}
			catch (RequestException $ex)
			{
				// loading failed, check whether an actual request should be made
				if ($this->getSetting(self::SET_SAVE_DUMMY_DATA, false) == false)
					// saving is not allowed, dummydata does not exist
					throw $ex;
			}
		}

		if (!$requestPromise && $this->getSetting(self::SET_CACHE_CALLS) && $this->ccc && $this->ccc->isCallCached($requestHash))
		{
			// calls are cached and this request is saved in cache
			$this->processCallResult([], $this->ccc->loadCallData($requestHash), 200);
			$requestPromise = new FulfilledPromise($this->getResult());
		}

		if (!$requestPromise)
		{
			// calls are not cached or this request is not cached
			// perform call to Riot API
			$guzzle = $this->guzzle;
			if ($this->next_async_request)
				$guzzle = $this->next_async_request->client;

			$this->_beforeCall($url, $requestHash);

			$options[RequestOptions::VERIFY] = $this->getSetting(self::SET_VERIFY_SSL);
			$options[RequestOptions::HEADERS] = $requestHeaders;
			if ($this->post_data)
				$options[RequestOptions::BODY] = $this->post_data;

			// Create HTTP request
			$requestPromise = $guzzle->requestAsync(
				$method,
				$url,
				$options
			);

			$dummyData_file = $this->_getDummyDataFileName();
			$requestPromise = $requestPromise->then(function(ResponseInterface $response) use ($url, $requestHash, $dummyData_file) {
				$this->processCallResult($response->getHeaders(), $response->getBody(), $response->getStatusCode());
				$this->_afterCall($url, $requestHash, $dummyData_file);
				return $this->getResult();
			});
		}

		// If request fails, try to process it and raise exceptions
		$requestPromise = $requestPromise->otherwise(function($ex) {
			/** @var \Exception $ex */

			if ($ex instanceof GuzzleHttpExceptions\RequestException)
			{
				$responseHeaders = [];
				$responseBody    = null;
				$responseCode    = $ex->getCode();

				if ($response = $ex->getResponse())
				{
					$responseHeaders = $response->getHeaders();
					$responseBody    = $response->getBody();
				}

				$this->processCallResult($responseHeaders, $responseBody, $responseCode);
				throw new RequestException("LeagueAPI: Request error occured - {$ex->getMessage()}", $ex->getCode(), $ex);
			}
			elseif ($ex instanceof GuzzleHttpExceptions\ServerException)
			{
				throw new ServerException("LeagueAPI: Server error occured {$ex->getMessage()}", $ex->getCode(), $ex);
			}

			throw new RequestException("LeagueAPI: Request could not be sent - {$ex->getMessage()}", $ex->getCode(), $ex);
		});

		if ($this->next_async_request)
			return $requestPromise;

		if ($overrideRegion)
			$this->unsetTemporaryRegion();

		$this->query_data = [];
		$this->post_data  = null;

		return $requestPromise;
	}
602437
public function callAction($method, $parameters)
    {
        $route = app('router')->current();
        $request = app('request');
        $this->assignAfter($route, $request, $method);
        $response = $this->before($route, $request, $method);

        if (is_null($response)) {
            $response = call_user_func_array([$this, $method], $parameters);
        }

        return $response;
    }
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;
    }
488799
public function call(string $method)
    {
        $args = $this->getArgs($method);

        $return = call_user_func_array([$this, $method], $args);

        $out = $this->renderer->render($this->statusCode, $this->headers, $return);

        self::response()->addHeader('Content-Type', $this->renderer->getContentType());
        if ($this->renderer->sendHeader()) {
            foreach ($this->headers as $name => $value) {
                self::response()->addHeader('x-' . ucfirst($name), $value);
            }

            self::response()->setStatus($this->statusCode);
        }

        return $out;
    }
22578
private function executeAuthMethod($method)
    {
        foreach ($this->auths as $auth) {
            if (is_callable([$auth, $method], true)) {
                if ($data = $auth->{$method}()) return $data;
            }
        }

        return false;
    }
1230363
protected function callWithinStack( $instance, $route, $request, $method )
	{
		$middleware = HttpFactory::i()->isMiddlewareDisabled() ? [] : $this->getMiddleware( $instance, $method );

		// Here we will make a stack onion instance to execute this request in, which gives
		// us the ability to define middlewares on controllers. We will return the given
		// response back out so that "after" filters can be run after the middlewares.
		return ( new Pipeline() )->send( $request )->through( $middleware )->then( function ( $request ) use ( $instance, $route, $method )
		{
			return $this->router->prepareResponse( $request, $this->call( $instance, $route, $method ) );
		} );
	}
319189
public function handleRequest($parent, $upstream)
    {
        $req = $this->beginRequest($parent, $upstream);
        return $req ?: $parent;
    }
1270570
private function executeMethod($method, $args = [])
    {
        if (method_exists($this, $method)) {
            return call_user_func_array([$this, $method], $args);
        }
    }
807340
public function call( $method, $parameters ){
		$params	= array();
		foreach( $parameters as $parameter )
			$params[]	= '<param>'.self::encodeXmlParameter( $parameter ).'</param>';
		$method	= '<methodName>'.$method.'</methodName>';
		$params	= '<params>'.join( $params ).'</params>';
		$call	= '<methodCall>'.$method.$params.'</methodCall>';
		return self::parseResponse( Net_HTTP_Post::sendData( $this->url, $call ) );
	}
182931
protected static function apiCall($provider, $method, $uri, $params = [])
    {
        $methodName = $method . 'ApiCall';
        if (method_exists($provider, $methodName)) {
            return $provider->{$methodName}($uri, $params);
        }
        throw new InvalidRequestException();
    }
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;
        }
    }
831071
public function call(string $method, $payload, int $flags = 0)
    {
        $this->relay->send(
            $method . pack("P", $this->seq),
            Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_RAW
        );

        if ($flags & Relay::PAYLOAD_RAW) {
            $this->relay->send($payload, $flags);
        } else {
            $body = json_encode($payload);
            if ($body === false) {
                throw new Exceptions\ServiceException(sprintf(
                    "json encode: %s",
                    json_last_error_msg()
                ));
            }

            $this->relay->send($body);
        }

        $body = $this->relay->receiveSync($flags);

        if (!($flags & Relay::PAYLOAD_CONTROL)) {
            throw new Exceptions\TransportException("rpc response header is missing");
        }

        $rpc = unpack("Ps", substr($body, -8));
        $rpc['m'] = substr($body, 0, -8);

        if ($rpc["m"] != $method || $rpc["s"] != $this->seq) {
            throw new Exceptions\TransportException("rpc method call mismatch");
        }

        // request id++
        $this->seq++;

        // wait for the response
        $body = $this->relay->receiveSync($flags);

        return $this->handleBody($body, $flags);
    }
343925
public function call(string $method, $args): \Generator
    {
        $request = new Request();
        $request->id = $this->idSequence->current();
        $this->idSequence->next();
        $request->method = $method;
        $request->params = $args;

        $serializedRequest = Json::encode($this->mapper->dump($request));
        $this->pendingRequests[$request->id] = yield Recoil::strand();
        yield Recoil::execute($this->transport->send($serializedRequest));

        /** @var ResultResponse|ErrorResponse $response */
        $response = yield Recoil::suspend();

        if ($response instanceof ErrorResponse) {
            throw $response->error;
        }

        return $response->result;
    }
1088483
public function createSubscription($channels, Closure $callback, $method = 'subscribe')
    {
        $loop = $this->pubSubLoop();

        call_user_func_array([$loop, $method], (array) $channels);

        foreach ($loop as $message) {
            if ($message->kind === 'message' || $message->kind === 'pmessage') {
                call_user_func($callback, $message->payload, $message->channel);
            }
        }

        unset($loop);
    }
1160144
public function send($method, $callback)
    {
        $payload = $method->toPayloadString();

        if (!$this->isBatch) {
            $proxy = function ($err, $res) use ($method, $callback) {
                if ($err !== null) {
                    return call_user_func($callback, $err, null);
                }
                if (!is_array($res)) {
                    $res = $method->transform([$res], $method->outputFormatters);
                    return call_user_func($callback, null, $res[0]);
                }
                $res = $method->transform($res, $method->outputFormatters);

                return call_user_func($callback, null, $res);
            };
            $this->requestManager->sendPayload($payload, $proxy);
        } else {
            $this->methods[] = $method;
            $this->batch[] = $payload;
        }
    }
851954
public function call(string $method, array $parameters)
    {
        if ($this->isSingleRequest) {
            $this->units = [];
        }

        $this->units[] = new Invoke($this->generatorId->get(), $method, $parameters);

        if ($this->isSingleRequest) {
            $resultSpecifier = $this->execute(new InvokeSpec($this->units, true));

            if (!$resultSpecifier->isSingleResult()) {
                throw new InvalidResponseException();
            }

            list($result) = $resultSpecifier->getResults();

            if ($result instanceof Result) {
                /** @var Result $result */
                return $result->getResult();
            } elseif ($result instanceof Error) {
                /** @var Error $result */
                if ($this->serverErrorMode === self::ERRMODE_EXCEPTION) {
                    throw $result->getBaseException();
                }
            }

            return null;
        }

        return $this;
    }