當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ClientInterface::getConfig方法代碼示例

本文整理匯總了PHP中GuzzleHttp\ClientInterface::getConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP ClientInterface::getConfig方法的具體用法?PHP ClientInterface::getConfig怎麽用?PHP ClientInterface::getConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GuzzleHttp\ClientInterface的用法示例。


在下文中一共展示了ClientInterface::getConfig方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * @param GuzzleClientInterface $client
  * @param RequestBuilder        $requestBuilder
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(GuzzleClientInterface $client, RequestBuilder $requestBuilder)
 {
     if ($client->getConfig('base_url') !== $requestBuilder->getBaseUrl()) {
         throw new \InvalidArgumentException(sprintf('Expected base url of client and request build to match. Got respectively "%s" and "%s" instead.', $client->getConfig('base_url'), $requestBuilder->getBaseUrl()));
     }
     $this->client = $client;
     $this->requestBuilder = $requestBuilder;
 }
開發者ID:EllynB,項目名稱:Incipio,代碼行數:14,代碼來源:ApiClient.php

示例2: __invoke

 public function __invoke($mmId)
 {
     $config = $this->httpClient->getConfig();
     $baseUri = $config['base_uri'];
     $auth = $config['auth'];
     $url = $baseUri->withQueryValue($baseUri, 'mm_id', $mmId);
     $response = $this->httpClient->request('GET', $url, ['auth' => $auth]);
     $responseData = json_decode($response->getBody()->getContents(), true);
     if (!isset($responseData['data']) || empty($responseData['data'])) {
         return;
     }
     return $responseData['data'][0];
 }
開發者ID:eellak,項目名稱:gredu_labs,代碼行數:13,代碼來源:FetchUnitByMmId.php

示例3: createRequest

 /**
  * @param  string           $method
  * @param  array            $options
  *
  * @return RequestInterface
  */
 protected function createRequest($method, $options)
 {
     $uri = $this->httpClient->getConfig('base_uri');
     $defaults = $this->httpClient->getConfig('defaults');
     $headers = isset($defaults['headers']) ? $defaults['headers'] : [];
     return $this->messageFactory->createRequest($method, $uri, $headers, $options);
 }
開發者ID:yashb,項目名稱:generator,代碼行數:13,代碼來源:Client.php

示例4: __construct

 /**
  * @param ClientInterface $client
  */
 public function __construct(ClientInterface $client, TimelineToken $token)
 {
     $this->baseUri = $client->getConfig('base_uri');
     if ($this->baseUri === null) {
         $this->baseUri = 'https://timeline-api.getpebble.com';
     }
     $this->token = $token;
     $this->client = $client;
 }
開發者ID:link0,項目名稱:phpebble,代碼行數:12,代碼來源:GuzzleTimeline.php

示例5: authenticate

 /**
  * @inheritDoc
  */
 public function authenticate(ClientInterface $httpClient)
 {
     if (!$httpClient->getConfig('cookies') instanceof CookieJarInterface) {
         throw new UnsupportedClientException('This HTTP client does not have cookies configured');
     }
     $homePageDom = $this->requestHomePageDom($httpClient);
     if (!$this->isLoggedIn($homePageDom)) {
         if ($homePageDom->query('#_login-form')->count() < 1) {
             throw new LoginFormNotFoundException();
         }
         $csrfToken = $homePageDom->query('#_login-form [name=fs_csrf]')->val();
         $newHomePageDom = $this->doLogin($httpClient, $csrfToken);
         if (!$this->isLoggedIn($newHomePageDom)) {
             throw new FailedLoggingInException('User was not logged in');
         }
     }
 }
開發者ID:ndthuan,項目名稱:fshare-lib,代碼行數:20,代碼來源:CookieBasedAuthenticator.php

示例6: get

 /**
  * {@inheritdoc}
  */
 public function get($url, array $args = [])
 {
     $options = [];
     // Add additional arguments to the defaults:
     //   Guzzle 6 does no longer merge the default query params with the
     //   additional params given here!
     if (!empty($args)) {
         if ($this->guzzleVersion > 5) {
             $options['query'] = array_merge($this->client->getConfig('query'), $args);
         } else {
             $options['query'] = $args;
         }
     }
     try {
         $this->response = $this->client->get($url, $options);
     } catch (RequestException $e) {
         $this->response = $e->getResponse();
         return $this->handleError();
     }
     // $response->json() is not compatible with Guzzle 6.
     return json_decode($this->response->getBody(), true);
 }
開發者ID:malc0mn,項目名稱:vultr-api-client,代碼行數:25,代碼來源:GuzzleHttpAdapter.php

示例7: getUrl

 /**
  * Get the URL.
  *
  * @return \GuzzleHttp\Psr7\Uri
  */
 public function getUrl()
 {
     return $this->client->getConfig('base_uri');
 }
開發者ID:sebdesign,項目名稱:laravel-viva-payments,代碼行數:9,代碼來源:Client.php

示例8: createAuthHttp

 private function createAuthHttp(ClientInterface $http)
 {
     return new Client(['base_uri' => $http->getConfig('base_uri'), 'exceptions' => true, 'verify' => $http->getConfig('verify'), 'proxy' => $http->getConfig('proxy')]);
 }
開發者ID:knedle,項目名稱:twitter-nette-skeleton,代碼行數:4,代碼來源:Guzzle6AuthHandler.php

示例9: getRequestKey

 /**
  * @param string $url
  * @param array  $options
  *
  * @return string
  */
 protected function getRequestKey($url, array $options)
 {
     $options = array_replace_recursive(['headers' => $this->client->getConfig('headers'), 'query' => $this->client->getConfig('query')], $options);
     return hash_hmac('md5', $url, serialize($options));
 }
開發者ID:pwnraid,項目名稱:bnet,代碼行數:11,代碼來源:AbstractClient.php

示例10: getHttpBaseUrl

 /**
  * @return \GuzzleHttp\Psr7\Uri
  */
 protected function getHttpBaseUrl()
 {
     return $this->client->getConfig('base_uri');
 }
開發者ID:karnajani,項目名稱:openstack,代碼行數:7,代碼來源:Operator.php

示例11: createRequest

 private function createRequest($uri)
 {
     $baseUri = \GuzzleHttp\Psr7\uri_for($this->client->getConfig('base_uri'));
     $uri = Uri::resolve($baseUri, $uri);
     return new Request('GET', $uri);
 }
開發者ID:vierbergenlars,項目名稱:authserver-client,代碼行數:6,代碼來源:AbstractPaginatedResultSet.php

示例12: getFinalPath

 /**
  * @param string $path
  *
  * @return string
  */
 protected function getFinalPath($path)
 {
     return $this->client->getConfig('base_uri')->getPath() . '/' . $path;
 }
開發者ID:worldia,項目名稱:textmaster-api,代碼行數:9,代碼來源:HttpClient.php

示例13: getTokenEndpoint

 /**
  * @return string
  */
 private function getTokenEndpoint()
 {
     return vsprintf('%s%s', [$this->httpClient->getConfig('base_uri'), $this->serverConfig->getParams()['token_endpoint']]);
 }
開發者ID:easybiblabs,項目名稱:oauth2-client-php,代碼行數:7,代碼來源:TokenRequest.php

示例14: createBaseUri

 /**
  * Creates the uri with the unit query parameter
  *
  * @param mixed $unit
  * @return UriInterface
  */
 private function createBaseUri($unit)
 {
     $config = $this->httpClient->getConfig();
     $baseUri = $config['base_uri'];
     return $baseUri->withQueryValue($baseUri, 'unit', $unit);
 }
開發者ID:eellak,項目名稱:gredu_labs,代碼行數:12,代碼來源:GuzzleHttpService.php

示例15: getBaseUri

 /**
  * @return UriInterface
  */
 public function getBaseUri()
 {
     return new Uri($this->client->getConfig('token_pool')->getPublicUrl());
 }
開發者ID:treehouselabs,項目名稱:swift-client,代碼行數:7,代碼來源:SwiftDriver.php


注:本文中的GuzzleHttp\ClientInterface::getConfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。