Get.

@param string       $host
@param string       $method
@param RequestParts $requestParts

@return array

@throws ConnectionException
542185
public function getByRequestParts(
        string $host,
        string $method,
        RequestParts $requestParts
    ): array {
        $json = json_encode($requestParts->getParameters()['json']);
        $formattedUrl = rtrim($host, '/').'/'.ltrim($requestParts->getUrl(), '/');
        $method = strtoupper($method);
        $headers = [];
        foreach ($requestParts->getParameters()['headers'] ?? [] as $header => $value) {
            $headers[] = "$header: $value";
        }

        $c = curl_init();
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($c, CURLOPT_URL, $formattedUrl);
        curl_setopt($c, CURLOPT_HEADER, false);
        curl_setopt($c, CURLOPT_CUSTOMREQUEST, $method);
        curl_setopt($c, CURLOPT_ENCODING, 'gzip, deflate');

        if (!in_array($method, ['GET', 'HEAD'])) {
            curl_setopt($c, CURLOPT_POSTFIELDS, $json);
            $headers[] = 'Content-Type: application/json';
            $headers[] = 'Content-Length: '.strlen($json);
        }

        curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
        $content = curl_exec($c);
        $responseCode = curl_getinfo($c, CURLINFO_HTTP_CODE);
        curl_close($c);

        if (
            'HEAD' !== $method &&
            false === $content
        ) {
            throw ConnectionException::buildConnectExceptionByUrl($requestParts->getUrl());
        }

        return [
            'code' => (int) $responseCode,
            'body' => empty($content)
                ? []
                : json_decode($content, true),
        ];
    }
1035183
public static function getInstance($host = '127.0.0.1', $port = 11211)
    {
        $driver = static::getLibrary();

        try {
            $instance = new $driver($host, $port);
        } catch (\Exception $e) {
            throw new CacheException($e->getMessage());
        }

        if (!self::isInstanceOf($instance, CacheStorageInterface::class)) {
            throw new CacheException(CacheException::MSG_INVALID_ARG, ['driver', CacheStorageInterface::class]);
        }

        return $instance;
    }
1273481
public function getPart($partId)
    {
        if (!isset($this->_batchParts[$partId])) {
            throw new ClientException('Request batch part does not exist.');
        }

        return $this->_batchParts[$partId];
    }
338033
public function makeRequest($url, $method = 'GET')
    {
        try {
            [$url, $parameters] = $this->getRequestUrlAndParameters($url, $method === 'GET');
            return $this->response = $this->client->request($method, $url, $parameters);
        } catch (RequestException $e) {
            $this->printErrorMessage(Psr7\str($e->getRequest()), false);
            if ($e->hasResponse()) {
                $this->response = $e->getResponse();
                $this->printErrorMessage(Psr7\str($e->getResponse()), false);
            }
        }
        return false;
    }
129105
public function getHost(string $host)
	{
		$host = Host::filter($host);
		return $this->offsetExists($host) ? $this->hosts[$host] : null;
	}
956742
public function findRoute(string $method, string $url, string $host = null): bool
    {
        $this->method = $method;
        $this->url = $this->removeQueryFromUrl($url);
        $this->host = $host;

        return $this->find();
    }
800246
public function send(string $method, string $url, array $options): HttpResponse
    {
        try {
            return new HttpResponse($this->buildClient()->request($method, $url, $this->mergeOptions([
                'query' => $this->parseQueryParams($url),
            ], $options)));
        } catch (\GuzzleHttp\Exception\ConnectException $e) {
            throw new Exceptions\ConnectionException($e->getMessage(), 0, $e);
        }
    }
285786
private function getRoutesFromIndex (&$routes, &$routesIndex, &$requestMethod, &$requestPathParts, $requestPathIndex = 0) {
        if (!empty($requestPathParts[$requestPathIndex])) {
            $requestPathPart = $requestPathParts[$requestPathIndex];
            if (array_key_exists($requestPathPart, $routesIndex)) {
                $this->getRoutesFromIndex($routes,$routesIndex[$requestPathPart], $requestMethod, $requestPathParts, $requestPathIndex + 1);
            }
            if (array_key_exists(self::ROUTE_PARAMETER_WILDCARD, $routesIndex)) {
                $this->getRoutesFromIndex($routes,$routesIndex[self::ROUTE_PARAMETER_WILDCARD], $requestMethod, $requestPathParts, $requestPathIndex + 1);
            }
        }
        else if (array_key_exists(self::ROUTE_ACTIONS_KEY, $routesIndex)) {
            $testRoutes = &$routesIndex[self::ROUTE_ACTIONS_KEY];
            if (array_key_exists($requestMethod, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[$requestMethod], $requestMethod,$requestPathParts);
            }
            if (array_key_exists(self::ROUTE_GENERIC_METHOD, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[self::ROUTE_GENERIC_METHOD], $requestMethod, $requestPathParts);
            }
        }

        if (array_key_exists(self::ROUTE_GENERIC_ACTIONS_KEY, $routesIndex)) {
            $testRoutes = &$routesIndex[self::ROUTE_GENERIC_ACTIONS_KEY];
            if (array_key_exists($requestMethod, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[$requestMethod], $requestMethod, $requestPathParts);
            }
            if (array_key_exists(self::ROUTE_GENERIC_METHOD, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[self::ROUTE_GENERIC_METHOD], $requestMethod, $requestPathParts);
            }
        }
    }
841701
protected function getEndpoint($method)
    {
        $number = $this->getArgument("number");
        $this->delArgument("number");
        $endpoint = "contacts";
        if (!is_null($number)) {
            $endpoint .= "/$number/variables";
        }
        $name = $this->getArgument("name");
        if (!is_null($name)) {
            $endpoint .= "/$name";
            $this->delArgument("name");
        }
        $queryString = array();
        $withContactLists = $this->getArgument("with_contact_lists");
        if (!is_null($withContactLists)) {
            $queryString['with_contact_lists'] = "true";
            $this->delArgument("with_contact_lists");
        }
        $page = $this->getArgument("page");
        if (!is_null($page)) {
            $queryString['page'] = $page;
            $this->delArgument("page");
        }
        if (!empty($queryString)) {
            $queryString = http_build_query($queryString);
            return "$endpoint?$queryString";
        }
        return $endpoint;
    }
187316
public function extractParts($hostname)
    {
        $suffix = $this->extractSuffix($hostname);

        if ($suffix === $hostname) {
            return [null, $hostname, null];
        }

        if (null !== $suffix) {
            $hostname = Str::substr($hostname, 0, -Str::length($suffix) - 1);
        }

        $lastDot = Str::strrpos($hostname, '.');

        if (false === $lastDot) {
            return [null, $hostname, $suffix];
        }

        $subDomain = Str::substr($hostname, 0, $lastDot);
        $host = Str::substr($hostname, $lastDot + 1);

        return [
            $subDomain,
            $host,
            $suffix
        ];
    }
352716
public function match(string $path, ?string $method, ?string $host): ?RouteInterface{
        if("/" !== mb_substr($path, 0, 1)){
            $path   = "/" . $path;
        }

        $stack      = new \SplStack();

        foreach(array_reverse(explode("/", $path)) as $segment){
            $stack->push($segment);
        }

        return $this->recursionMatch($this->rootNode, $stack, $method, $host);
    }
88997
public function get($method, $data = array())
    {
        //set cURL transfer option for get request
        // and get ouput
        return $this->createEndPoint($method, $data)
                    ->setOpt(CURLOPT_CUSTOMREQUEST, 'GET')
                    ->setopt(CURLOPT_HTTPGET, true)
                    ->exec();
    }
578144
public function get ($method, $options = array ()) {
		$req = $this->site . $this->element_name_plural;
        if (isset ($this->_data['id']) && $this->_data['id']) { 
          $req .= '/' . $this->_data['id'];
        }
        $req .= '/' . $method . '.xml';
		if (count ($options) > 0) {
			$req .= '?' . http_build_query ($options);
		}
		return $this->_send_and_receive ($req, 'GET');
	}
869455
public function dynamicWhere($method, $parameters)
    {
        $finder = substr($method, 5);

        $segments = preg_split('/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE);

        // The connector variable will determine which connector will be used for the
        // query condition. We will change it as we come across new boolean values
        // in the dynamic method strings, which could contain a number of these.
        $connector = 'and';

        $index = 0;

        foreach ($segments as $segment) {
            // If the segment is not a boolean connector, we can assume it is a column's name
            // and we will add it to the query as a new constraint as a where clause, then
            // we can keep iterating through the dynamic method string's segments again.
            if ($segment != 'And' && $segment != 'Or') {
                $this->addDynamic($segment, $connector, $parameters, $index);

                $index++;
            }

            // Otherwise, we will store the connector so we know how the next where clause we
            // find in the query should be connected to the previous ones, meaning we will
            // have the proper boolean connector to connect the next where clause found.
            else {
                $connector = $segment;
            }
        }

        return $this;
    }
692117
private function getRequestExceptionParts(RequestException $requestException)
    {
        $response = $requestException->getResponse();
        $parts = [];
        $parts['reason'] = $response ? $response->getReasonPhrase() : $requestException->getMessage();
        $parts['code'] = $response ? $response->getStatusCode() : $requestException->getCode();
        $parts['body'] = $response ? $response->getBody() : null;

        return $parts;
    }
1094671
protected function getUri($module, $method, $responseFormat, array $requestParameters = array())
    {
        if (!$this->hasMethod($method)) {
            throw new \InvalidArgumentException(sprintf('The method %s is not registered', $method));
        }

        if (!$this->hasResponseFormat($responseFormat)) {
            throw new \InvalidArgumentException(sprintf('The response format %s is not registered', $responseFormat));
        }

        if (!isset($requestParameters['scope'])) {
            $requestParameters['scope'] = self::API_DEFAULT_SCOPE;
        }

        if (!isset($requestParameters['version'])) {
            $requestParameters['version'] = self::API_DEFAULT_VERSION;
        }

        $uri = sprintf(
            self::API_BASE_URL,
            $responseFormat,
            $module,
            $method,
            $this->getAuthToken()
        );

        return $uri . $this->generateQueryStringByRequestParams($requestParameters);
    }
18040
protected function getConnectionAndTable($parameters)
    {
        $parts = explode('.', $this->getParameter($parameters, 0));

        $connection = isset($parts[1])
            ? $parts[0]
            : Config::get('database.default');

        $table = $parts[1] ?? $parts[0];

        return [$connection, $table];
    }