Ejemplo n.º 1
0
 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'];
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 public static function calculateMd5(EntityBodyInterface $body, $rawOutput = false, $base64Encode = false)
 {
     Version::warn(__CLASS__ . ' is deprecated. Use getContentMd5()');
     return $body->getContentMd5($rawOutput, $base64Encode);
 }
Ejemplo n.º 5
0
 /**
  * @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;
 }
Ejemplo n.º 6
0
 /**
  * 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;
 }
Ejemplo n.º 7
0
 /**
  * @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;
 }
Ejemplo n.º 8
0
 public function __construct(\Zend_Log $logObject)
 {
     $this->log = $logObject;
     Version::warn(__CLASS__ . ' is deprecated');
 }
Ejemplo n.º 9
0
 /**
  * Inject configuration settings into an input string
  *
  * @param string $input Input to inject
  *
  * @return string
  * @deprecated
  */
 public function inject($input)
 {
     Version::warn(__METHOD__ . ' is deprecated');
     $replace = array();
     foreach ($this->data as $key => $val) {
         $replace['{' . $key . '}'] = $val;
     }
     return strtr($input, $replace);
 }
Ejemplo n.º 10
0
 /**
  * @deprecated
  * @codeCoverageIgnore
  */
 public function getRequest()
 {
     Version::warn(__METHOD__ . ' is deprecated');
     return null;
 }
 /**
  * @deprecated Use the history plugin
  * @codeCoverageIgnore
  */
 public function isRedirect()
 {
     Version::warn(__METHOD__ . ' is deprecated. Use the HistoryPlugin to track this.');
     return $this->isRedirect;
 }
Ejemplo n.º 12
0
 /**
  * @deprecated
  * @codeCoverageIgnore
  */
 public function enableMagicMethods($isEnabled)
 {
     Version::warn(__METHOD__ . ' is deprecated');
 }
Ejemplo n.º 13
0
 public function testCanSilenceWarnings()
 {
     Version::$emitWarnings = false;
     Version::warn('testing!');
     Version::$emitWarnings = true;
 }
Ejemplo n.º 14
0
 /**
  * @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');
 }
Ejemplo n.º 15
0
<?php

namespace Guzzle\Plugin\Cache;

\Guzzle\Common\Version::warn('Guzzle\\Plugin\\Cache\\CacheKeyProviderInterface is no longer used');
interface CacheKeyProviderInterface
{
}
Ejemplo n.º 16
0
 /**
  * @deprecated
  */
 public function setDefaultHeaders($headers)
 {
     Version::warn(__METHOD__ . ' is deprecated. Use the request.options array to specify default request options');
     if ($headers instanceof Collection) {
         $this->defaultHeaders = $headers;
     } elseif (is_array($headers)) {
         $this->defaultHeaders = new Collection($headers);
     } else {
         throw new InvalidArgumentException('Headers must be an array or Collection');
     }
     return $this;
 }
Ejemplo n.º 17
0
 /**
  * @deprecated
  * @codeCoverageIgnore
  */
 public function raw()
 {
     Version::warn(__METHOD__ . ' is deprecated. Use toArray()');
     return $this->toArray();
 }
Ejemplo n.º 18
0
 public function getCurlString()
 {
     Version::warn(__METHOD__ . ' is deprecated. Use getCurlValue()');
     return $this->getCurlValue();
 }
Ejemplo n.º 19
0
<?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;