当前位置: 首页>>代码示例>>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;未经允许,请勿转载。