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


PHP Common\Version類代碼示例

本文整理匯總了PHP中Guzzle\Common\Version的典型用法代碼示例。如果您正苦於以下問題:PHP Version類的具體用法?PHP Version怎麽用?PHP Version使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: factory

 public static function factory($config = array())
 {
     Version::warn(__METHOD__ . ' is deprecated');
     if (!is_array($config)) {
         throw new InvalidArgumentException('$config must be an array');
     }
     if (!isset($config['cache.adapter']) && !isset($config['cache.provider'])) {
         $config['cache.adapter'] = 'Guzzle\\Cache\\NullCacheAdapter';
         $config['cache.provider'] = null;
     } else {
         foreach (array('cache.adapter', 'cache.provider') as $required) {
             if (!isset($config[$required])) {
                 throw new InvalidArgumentException("{$required} is a required CacheAdapterFactory option");
             }
             if (is_string($config[$required])) {
                 $config[$required] = str_replace('.', '\\', $config[$required]);
                 if (!class_exists($config[$required])) {
                     throw new InvalidArgumentException("{$config[$required]} is not a valid class for {$required}");
                 }
             }
         }
         if (is_string($config['cache.provider'])) {
             $args = isset($config['cache.provider.args']) ? $config['cache.provider.args'] : null;
             $config['cache.provider'] = self::createObject($config['cache.provider'], $args);
         }
     }
     if (is_string($config['cache.adapter'])) {
         $args = isset($config['cache.adapter.args']) ? $config['cache.adapter.args'] : array();
         array_unshift($args, $config['cache.provider']);
         $config['cache.adapter'] = self::createObject($config['cache.adapter'], $args);
     }
     return $config['cache.adapter'];
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:33,代碼來源:CacheAdapterFactory.php

示例2: __construct

 public function __construct($username, $password, $scheme = CURLAUTH_BASIC)
 {
     Version::warn(__CLASS__ . " is deprecated. Use \$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');");
     $this->username = $username;
     $this->password = $password;
     $this->scheme = $scheme;
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:7,代碼來源:CurlAuthPlugin.php

示例3: setUp

 protected function setUp()
 {
     if (!version_compare(Version::VERSION, '3.6', '>=')) {
         $this->markTestSkipped('the emitWarning property was added in Guzzle 3.6');
     }
     $this->container = new ContainerBuilder();
     $this->extension = new MisdGuzzleExtension();
     // reset the emit warnings options before each test
     Version::$emitWarnings = false;
 }
開發者ID:aciliainternet,項目名稱:guzzle-bundle,代碼行數:10,代碼來源:MisdGuzzleExtensionTest.php

示例4: testAddsDigestAuthentication

 public function testAddsDigestAuthentication()
 {
     Version::$emitWarnings = false;
     $plugin = new CurlAuthPlugin('julian', 'test', CURLAUTH_DIGEST);
     $client = new Client('http://www.test.com/');
     $client->getEventDispatcher()->addSubscriber($plugin);
     $request = $client->get('/');
     $this->assertEquals('julian', $request->getUsername());
     $this->assertEquals('test', $request->getPassword());
     $this->assertEquals('julian:test', $request->getCurlOptions()->get(CURLOPT_USERPWD));
     $this->assertEquals(CURLAUTH_DIGEST, $request->getCurlOptions()->get(CURLOPT_HTTPAUTH));
     Version::$emitWarnings = true;
 }
開發者ID:alvarobfdev,項目名稱:applog,代碼行數:13,代碼來源:CurlAuthPluginTest.php

示例5: parseUrl

 public function parseUrl($url)
 {
     Version::warn(__CLASS__ . ' is deprecated. Just use parse_url()');
     static $defaults = array('scheme' => null, 'host' => null, 'path' => null, 'port' => null, 'query' => null, 'user' => null, 'pass' => null, 'fragment' => null);
     $parts = parse_url($url);
     if ($this->utf8 && isset($parts['query'])) {
         $queryPos = strpos($url, '?');
         if (isset($parts['fragment'])) {
             $parts['query'] = substr($url, $queryPos + 1, strpos($url, '#') - $queryPos - 1);
         } else {
             $parts['query'] = substr($url, $queryPos + 1);
         }
     }
     return $parts + $defaults;
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:15,代碼來源:UrlParser.php

示例6: testCanGetScannedCount

 public function testCanGetScannedCount()
 {
     $emitWarnings = Version::$emitWarnings;
     Version::$emitWarnings = false;
     $command = $this->getMock('Guzzle\\Service\\Command\\CommandInterface');
     $iterator = new ScanIterator($command, array('result_key' => 'Items'));
     $model = new Model(array('Items' => array(1, 2, 3), 'ScannedCount' => 4));
     $class = new \ReflectionObject($iterator);
     $method = $class->getMethod('handleResults');
     $method->setAccessible(true);
     $items = $method->invoke($iterator, $model);
     $this->assertEquals(4, $iterator->getScannedCount());
     $this->assertCount(3, $items);
     Version::$emitWarnings = $emitWarnings;
 }
開發者ID:njbhatt18,項目名稱:Amazon_API,代碼行數:15,代碼來源:ScanIteratorTest.php

示例7: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('plugin.xml');
     $loader->load('log.xml');
     if ($config['serializer']) {
         $loader->load('serializer.xml');
     }
     if (interface_exists('Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\ParamConverterInterface')) {
         // choose a ParamConverterInterface implementation that is compatible
         // with the version of SensioFrameworkExtraBundle being used
         $parameter = new \ReflectionParameter(array('Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\ParamConverterInterface', 'supports'), 'configuration');
         if ('Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ParamConverter' == $parameter->getClass()->getName()) {
             $container->setParameter('misd_guzzle.param_converter.class', 'Misd\\GuzzleBundle\\Request\\ParamConverter\\GuzzleParamConverter3x');
         } else {
             $container->setParameter('misd_guzzle.param_converter.class', 'Misd\\GuzzleBundle\\Request\\ParamConverter\\GuzzleParamConverter2x');
         }
         $loader->load('param_converter.xml');
     }
     if ($config['service_builder']['enabled']) {
         $loader->load('service_builder.xml');
         $container->setParameter('guzzle.service_builder.class', $config['service_builder']['class']);
         $container->setParameter('guzzle.service_builder.configuration_file', $config['service_builder']['configuration_file']);
     }
     if ($config['filesystem_cache']['enabled']) {
         $loader->load('cache.xml');
         $container->setParameter('misd_guzzle.cache.filesystem.path', $config['filesystem_cache']['path']);
     }
     $logFormat = $config['log']['format'];
     if (in_array($logFormat, array('default', 'debug', 'short'))) {
         $logFormat = constant(sprintf('Guzzle\\Log\\MessageFormatter::%s_FORMAT', strtoupper($logFormat)));
     }
     $container->setParameter('misd_guzzle.log.format', $logFormat);
     $container->setParameter('misd_guzzle.log.enabled', $config['log']['enabled']);
     if (version_compare(Version::VERSION, '3.6', '>=') && $container->hasParameter('kernel.debug')) {
         Version::$emitWarnings = $container->getParameter('kernel.debug');
     }
 }
開發者ID:aciliainternet,項目名稱:guzzle-bundle,代碼行數:44,代碼來源:MisdGuzzleExtension.php

示例8: calculateMd5

 public static function calculateMd5(EntityBodyInterface $body, $rawOutput = false, $base64Encode = false)
 {
     Version::warn(__CLASS__ . ' is deprecated. Use getContentMd5()');
     return $body->getContentMd5($rawOutput, $base64Encode);
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:5,代碼來源:EntityBody.php

示例9: removeCacheControlDirective

 /**
  * @deprecated
  * @codeCoverageIgnore
  */
 public function removeCacheControlDirective($directive)
 {
     Version::warn(__METHOD__ . ' is deprecated. Use $message->getHeader(\'Cache-Control\')->removeDirective()');
     if ($header = $this->getHeader('Cache-Control')) {
         $header->removeDirective($directive);
     }
     return $this;
 }
開發者ID:diandianxiyu,項目名稱:Yii2Api,代碼行數:12,代碼來源:AbstractMessage.php

示例10: getScannedCount

 /**
  * Get the total number of scanned items
  *
  * @return int
  */
 public function getScannedCount()
 {
     Version::warn('This method is deprecated and will be removed in a future version of the SDK. Getting the ' . 'scanned count is possible using event listeners.');
     return $this->scannedCount;
 }
開發者ID:risyasin,項目名稱:webpagetest,代碼行數:10,代碼來源:ScanIterator.php

示例11: __construct

 /**
  * @param \Zend_Cache_Backend $cache Cache object to wrap
  */
 public function __construct(\Zend_Cache_Backend $cache)
 {
     Version::warn(__CLASS__ . ' is deprecated. Upgrade to ZF2 or use PsrCacheAdapter');
     $this->cache = $cache;
 }
開發者ID:jorjoh,項目名稱:Varden,代碼行數:8,代碼來源:Zf1CacheAdapter.php

示例12: __construct

 public function __construct(\Zend_Log $logObject)
 {
     $this->log = $logObject;
     Version::warn(__CLASS__ . ' is deprecated');
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:5,代碼來源:Zf1LogAdapter.php

示例13: __construct

 /**
  * @param ResourceIteratorInterface $iterator Resource iterator to apply a callback to
  * @param array|callable            $callback Callback method accepting the resource iterator
  *                                            and an array of the iterator's current resources
  */
 public function __construct(ResourceIteratorInterface $iterator, $callback)
 {
     $this->iterator = $iterator;
     $this->callback = $callback;
     Version::warn(__CLASS__ . ' is deprecated');
 }
開發者ID:Trideon,項目名稱:gigolo,代碼行數:11,代碼來源:ResourceIteratorApplyBatched.php

示例14: getRequest

 /**
  * @deprecated
  * @codeCoverageIgnore
  */
 public function getRequest()
 {
     Version::warn(__METHOD__ . ' is deprecated');
     return null;
 }
開發者ID:launchdarkly,項目名稱:guzzle3,代碼行數:9,代碼來源:Response.php

示例15: getCacheKey

<?php

namespace Guzzle\Plugin\Cache;

use Guzzle\Http\Message\RequestInterface;
\Guzzle\Common\Version::warn('Guzzle\\Plugin\\Cache\\DefaultCacheKeyProvider is no longer used');
class DefaultCacheKeyProvider implements CacheKeyProviderInterface
{
    public function getCacheKey(RequestInterface $request)
    {
        $key = $request->getParams()->get(self::CACHE_KEY);
        if (!$key) {
            $cloned = clone $request;
            $cloned->removeHeader('Cache-Control');
            foreach (explode(';', $request->getParams()->get(self::CACHE_KEY_FILTER)) as $part) {
                $pieces = array_map('trim', explode('=', $part));
                if (isset($pieces[1])) {
                    foreach (array_map('trim', explode(',', $pieces[1])) as $remove) {
                        if ($pieces[0] == 'header') {
                            $cloned->removeHeader($remove);
                        } elseif ($pieces[0] == 'query') {
                            $cloned->getQuery()->remove($remove);
                        }
                    }
                }
            }
            $raw = (string) $cloned;
            $key = 'GZ' . md5($raw);
            $request->getParams()->set(self::CACHE_KEY, $key)->set(self::CACHE_KEY_RAW, $raw);
        }
        return $key;
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:31,代碼來源:DefaultCacheKeyProvider.php


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