Gets the ratelimit bucket for the specific endpoint.
@param string $endpoint
@return \CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface
544919
protected function getRatelimitBucket(string $endpoint) {
        if(empty($this->ratelimits[$endpoint])) {
            $bucket = $this->bucketName;
            $this->ratelimits[$endpoint] = new $bucket($this, $endpoint);
        }
        
        return $this->ratelimits[$endpoint];
    }
964036
protected function configureAuthenticationEndpoint(EndpointInterface $Endpoint)
    {
        $data = $this->credentials;
        $data['grant_type'] = static::$_DEFAULT_GRANT_TYPE;
        return $Endpoint->setData($data);
    }
339050
private function validateEndpoint($endpoint)
    {
        $isValid = filter_var($endpoint, FILTER_VALIDATE_URL);

        if ($isValid) {
            $scheme = strtolower(parse_url($endpoint, PHP_URL_SCHEME));
            if (in_array($scheme, ['http', 'https'], true)) {
                return;
            }
        }

        throw new Exception(self::ERR_INVALID_ENDPOINT);
    }
606873
public function getEndpoint($endpointType)
	{
		// Check if the endpoint type is valid
		if (self::ENDPOINT_TYPE_GATEWAY !== $endpointType && self::ENDPOINT_TYPE_FEEDBACK !== $endpointType ) {
			throw new \InvalidArgumentException($endpointType . ' is not a valid endpoint type.');
		}

		return self::$endpoints[$this->endpointEnv][$endpointType];
	}
1260821
public function getKey(string $endpoint = null)
    {
        if ('sandboxnew/pay/getsignkey' === $endpoint) {
            return $this['config']->key;
        }

        $key = $this->inSandbox() ? $this['sandbox']->getKey() : $this['config']->key;

        if (empty($key)) {
            throw new InvalidArgumentException("config key connot be empty.");
        }

        if (32 !== strlen($key)) {
            throw new InvalidArgumentException(sprintf("'%s' should be 32 chars length.", $key));
        }

        return $key;
    }
222564
public function requestGet($endpoint, $params = array(), $headers = array())
    {
        return $this->getClient()->get($endpoint, $params, $headers);
    }
211695
public function setServiceEndpoint(string $endpoint): AbstractClientBuilder
    {
        if (!filter_var($endpoint, FILTER_VALIDATE_URL) || parse_url($endpoint, PHP_URL_SCHEME) !== 'https') {
            throw new \InvalidArgumentException('Incorrect endpoint given');
        }

        $this->endpoint = $endpoint;

        return $this;
    }
966280
private function get(string $endpoint): array
    {
        return \GuzzleHttp\json_decode(
            $this->client
                ->get(
                    self::API_BASE_URI.$endpoint,
                    [
                        'query' => [
                            'client_id' => $this->apiKey,
                        ],
                    ]
                )
                ->getBody()
                ->getContents(),
            true
        );
    }
103090
public function addEndpoint(Endpoint $endpoint): Route
	{
		$this->endpoints[get_class($endpoint)] = $endpoint;
		return $this;
	}
382325
private static function makeEndpoints($endpoints)
    {
        if (is_string($endpoints)) {
            return self::makeEndpointsFromString($endpoints, self::ROUTE_METHODS);
        }

        return $endpoints;
    }
813745
private function applyOffsetLimit($endPointUrl)
    {
        $endPointUrlArray = parse_url($endPointUrl);

        if (!isset($endPointUrlArray['query'])) {
            $endPointUrlArray['query'] = null;
        }

        parse_str($endPointUrlArray['query'], $queryStringArray);

        $queryStringArray['offset'] = $this->offset;
        $queryStringArray['limit'] = min(max(1, $this->limit), 500);

        $endPointUrlArray['query'] = http_build_query($queryStringArray, null, '&');

        $endPointUrl = (isset($endPointUrlArray['scheme'])) ? "{$endPointUrlArray['scheme']}://" : '';
        $endPointUrl.= (isset($endPointUrlArray['host'])) ? "{$endPointUrlArray['host']}" : '';
        $endPointUrl.= (isset($endPointUrlArray['port'])) ? ":{$endPointUrlArray['port']}" : '';
        $endPointUrl.= (isset($endPointUrlArray['path'])) ? "{$endPointUrlArray['path']}" : '';
        $endPointUrl.= (isset($endPointUrlArray['query'])) ? "?{$endPointUrlArray['query']}" : '';

        return $endPointUrl;
    }
186333
protected function get() {
        return $this->cache->get('yasmin-ratelimiter-'.$this->endpoint, null, true)->then(null, function () {
            return array('limit' => 0, 'remaining' => 0, 'resetTime' => null);
        });
    }
467074
public function getAPIEndpoint($uri = false)
    {
        $endpoint = $this->getBase() . '/' . $this->getVersion() . '/';

        if ($uri) {
            $endpoint .= $uri;
        }

        return $endpoint;
    }
1354644
protected function getOrigin($endPoint)
    {
        $url = parse_url($endPoint);
        $origin = $url['scheme'].'://'.$url['host'];
        if (isset($url['port'])) {
            $origin = $origin.':'.$url['port'];
        }

        return $origin;
    }
536366
public function getRateLimiter()
    {
        return \call_user_func($this->limiter ?: function ($container, $request) {
            return $request->getClientIp();
        }, $this->container, $this->request);
    }
259473
public function get(string $endPoint)
    {
        $parsedEndPoint = self::parseEndPoint($endPoint);
        return $this->sendRequest($parsedEndPoint, "GET");
    }
227985
protected function getEndpoint($method)
    {
        $endpoint = "trunks";
        $trunkId = $this->getArgument("id");
        if (!is_null($trunkId)) {
            $endpoint .= "/$trunkId";
            $this->delArgument("id");
        }
        return $endpoint;
    }