当前位置: 首页>>代码示例>>PHP>>正文


PHP static::client方法代码示例

本文整理汇总了PHP中static::client方法的典型用法代码示例。如果您正苦于以下问题:PHP static::client方法的具体用法?PHP static::client怎么用?PHP static::client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在static的用法示例。


在下文中一共展示了static::client方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createGuzzleClient

 /**
  * @param $tempDir
  * @param array $guzzleConfig
  * @return \GuzzleHttp\Client
  * @throws \Matyx\Guzzlette\GuzzletteException
  */
 public static function createGuzzleClient($tempDir, $guzzleConfig = [])
 {
     if (isset(static::$client)) {
         return static::$client;
     }
     if (Tracy\Debugger::isEnabled()) {
         $handler = NULL;
         if (isset($guzzleConfig['handler'])) {
             $handler = $guzzleConfig['handler'];
             if (!$handler instanceof GuzzleHttp\HandlerStack) {
                 throw new GuzzletteException("Handler must be instance of " . GuzzleHttp\HandlerStack::class);
             }
         } else {
             $handler = GuzzleHttp\HandlerStack::create();
         }
         $requestStack = new RequestStack();
         Tracy\Debugger::getBar()->addPanel(new TracyPanel($tempDir, $requestStack));
         $handler->push(function (callable $handler) use($requestStack) {
             return function ($request, array $options) use($handler, $requestStack) {
                 Tracy\Debugger::timer();
                 $guzzletteRequest = new Request();
                 $guzzletteRequest->request = $request;
                 return $handler($request, $options)->then(function ($response) use($requestStack, $guzzletteRequest) {
                     $guzzletteRequest->time = Tracy\Debugger::timer();
                     $guzzletteRequest->response = $response;
                     $requestStack->addRequest($guzzletteRequest);
                     return $response;
                 });
             };
         });
         $guzzleConfig['handler'] = $handler;
     }
     static::$client = new GuzzleHttp\Client($guzzleConfig);
     return static::$client;
 }
开发者ID:matyx,项目名称:guzzlette,代码行数:41,代码来源:Guzzlette.php

示例2: getClient

 /**
  * Get the Algolia client associated with this instance.
  *
  * @return \AlgoliaSearch\Client
  */
 protected function getClient()
 {
     if (!static::$client) {
         static::$client = new \AlgoliaSearch\Client(Config::get('search.connections.algolia.config.application_id'), Config::get('search.connections.algolia.config.admin_api_key'));
     }
     return static::$client;
 }
开发者ID:parthrk,项目名称:laravel-search,代码行数:12,代码来源:Algolia.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $fs = new Filesystem();
     $fs->remove(__DIR__ . static::$TEMP_PATH);
     static::$client = static::createClient(['config' => static::$CONFIG_FILE]);
     static::$router = static::$kernel->getContainer()->get('router');
 }
开发者ID:harmbandstra,项目名称:TwigExcelBundle,代码行数:10,代码来源:AbstractControllerTest.php

示例4: getStaticClient

 /**
  * Get the static HTTP client
  *
  * @param array|Traversable $options
  * @return Client
  */
 protected static function getStaticClient($options = null)
 {
     if (!isset(static::$client) || $options !== null) {
         static::$client = new Client(null, $options);
     }
     return static::$client;
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:13,代码来源:ClientStatic.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     static::$client = static::createClient();
     static::$router = self::$client->getContainer()->get('router');
     static::$em = self::$client->getContainer()->get('doctrine.orm.entity_manager');
     static::$container = self::getContainer();
 }
开发者ID:bzis,项目名称:zomba,代码行数:7,代码来源:TestCase.php

示例6: getClient

 /**
  * Singleton object getter.
  *
  * @param string $wsdl
  * @return SoapClient instance.
  */
 public static function getClient($wsdl)
 {
     if (!static::$client) {
         static::$client = new static($wsdl);
     }
     return static::$client;
 }
开发者ID:32i,项目名称:TheCalculator,代码行数:13,代码来源:SoapClientBase.php

示例7: getClient

 /**
  * Get the Elasticsearch client associated with this instance.
  *
  * @return \Elasticsearch\Client
  */
 protected function getClient()
 {
     if (!static::$client) {
         static::$client = new \Elasticsearch\Client(Config::get('search.connections.elasticsearch.config', array()));
     }
     return static::$client;
 }
开发者ID:avbrugen,项目名称:uace-laravel,代码行数:12,代码来源:Elasticsearch.php

示例8: client

 /**
  * Get api client for consuming api
  *
  * @return Client
  * @throws Exception
  */
 public function client()
 {
     if (!static::$client) {
         static::$client = new Client(array('base_uri' => $this->apiUrl, 'cookies' => $this->jar));
     }
     return static::$client;
 }
开发者ID:deboorn,项目名称:rockrmsapi,代码行数:13,代码来源:Api.php

示例9: _init

 /**
  * Initialize
  */
 public static function _init()
 {
     $config = \Config::load('sentry', true);
     static::$config = $config[\Fuel::$env];
     // create instance for PHP
     static::$client = new \Raven_Client(static::$config['php']['dsn']);
 }
开发者ID:core-tech,项目名称:fuel-packages-sentry,代码行数:10,代码来源:sentry.php

示例10: getClient

 /**
  * Get the Guzzle client for requests
  *
  * @return Client
  */
 protected static function getClient()
 {
     if (!static::$client) {
         static::$client = new Client('https://graph.facebook.com');
     }
     return static::$client;
 }
开发者ID:rinatio,项目名称:facebook,代码行数:12,代码来源:User.php

示例11: getClient

 protected static function getClient()
 {
     if (null === static::$client) {
         static::$client = new \SoapClient(static::$baseUrl . "?wsdl", array('location' => static::$baseUrl, 'cache_wsdl' => WSDL_CACHE_NONE));
     }
     return static::$client;
 }
开发者ID:avangate,项目名称:avangate-php-soap-code-samples,代码行数:7,代码来源:AvangateSoapClient.php

示例12: getBitBucketClient

 /**
  * @param array $options
  *
  * @return BitBucketClient
  */
 protected static function getBitBucketClient(array $options = [])
 {
     if (null === static::$client || static::$client->getOptions() !== $options) {
         static::$client = new BitBucketClient($options);
     }
     return static::$client;
 }
开发者ID:marktopper,项目名称:gush,代码行数:12,代码来源:BitbucketFactory.php

示例13: getStaticClient

 /**
  * Get the static HTTP client
  *
  * @return Client
  */
 protected static function getStaticClient()
 {
     if (!isset(static::$client)) {
         static::$client = new Client();
     }
     return static::$client;
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:12,代码来源:ClientStatic.php

示例14: auth

 public static function auth()
 {
     $news = new Zend_Gdata_Photos();
     $svc = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
     static::$client = Zend_Gdata_ClientLogin::getHttpClient(static::$gUser, static::$gPass, $svc);
     static::$service = new Zend_Gdata_Photos(static::$client, "ANO");
 }
开发者ID:Gouken,项目名称:WebMuApp,代码行数:7,代码来源:Picasa.php

示例15: getGitlabClient

 /**
  * @param string $url
  *
  * @return Client
  */
 protected static function getGitlabClient($url)
 {
     if (null === static::$client || static::$client->getBaseUrl() !== $url) {
         static::$client = new Client(trim($url, '/') . '/');
     }
     return static::$client;
 }
开发者ID:mistymagich,项目名称:gush,代码行数:12,代码来源:GitLabFactory.php


注:本文中的static::client方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。