1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-13 03:45:22 +01:00

Updating vendors

This commit is contained in:
Michael Dowling 2011-03-27 17:20:00 -05:00
parent 8d266bb314
commit 118a67a2c6
7 changed files with 72 additions and 29 deletions

View File

@ -166,22 +166,16 @@ class Inspector
preg_match_all('/' . self::GUZZLE_ANNOTATION . '\s+([A-Za-z0-9_\-\.]+)\s*([A-Za-z0-9]+=".+")*/', $doc, $matches);
if (isset($matches[1])) {
foreach ($matches[1] as $index => $match) {
// Add the matched argument to the array keys
$params[$match] = array();
if (isset($matches[2])) {
// Break up the argument attributes by closing quote
foreach (explode('" ', $matches[2][$index]) as $part) {
$attrs = array();
// Find the attribute and attribute value
preg_match('/([A-Za-z0-9]+)="(.+)"*/', $part, $attrs);
if (isset($attrs[1]) && isset($attrs[0])) {
// Sanitize the strings
if ($attrs[2][strlen($attrs[2]) - 1] == '"') {
$attrs[2] = substr($attrs[2], 0, strlen($attrs[2]) - 1);

View File

@ -22,7 +22,8 @@ namespace Doctrine\Common\Cache;
/**
* Base class for cache driver implementations.
*
* @since 2.0
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
@ -67,8 +68,7 @@ abstract class AbstractCache implements Cache
*/
public function save($id, $data, $lifeTime = 0)
{
$id = $this->_getNamespacedId($id);
return $this->_doSave($id, $data, $lifeTime);
return $this->_doSave($this->_getNamespacedId($id), $data, $lifeTime);
}
/**
@ -93,9 +93,11 @@ abstract class AbstractCache implements Cache
public function deleteAll()
{
$ids = $this->getIds();
foreach ($ids as $id) {
$this->delete($id);
}
return $ids;
}
@ -108,13 +110,16 @@ abstract class AbstractCache implements Cache
public function deleteByRegex($regex)
{
$deleted = array();
$ids = $this->getIds();
foreach ($ids as $id) {
if (preg_match($regex, $id)) {
$this->delete($id);
$deleted[] = $id;
}
}
return $deleted;
}
@ -127,13 +132,17 @@ abstract class AbstractCache implements Cache
public function deleteByPrefix($prefix)
{
$deleted = array();
$prefix = $this->_getNamespacedId($prefix);
$ids = $this->getIds();
foreach ($ids as $id) {
if (strpos($id, $prefix) === 0) {
$this->delete($id);
$deleted[] = $id;
}
}
return $deleted;
}
@ -146,13 +155,16 @@ abstract class AbstractCache implements Cache
public function deleteBySuffix($suffix)
{
$deleted = array();
$ids = $this->getIds();
foreach ($ids as $id) {
if (substr($id, -1 * strlen($suffix)) === $suffix) {
$this->delete($id);
$deleted[] = $id;
}
}
return $deleted;
}

View File

@ -46,8 +46,9 @@ class ApcCache extends AbstractCache
$keys = array();
foreach ($ci['cache_list'] as $entry) {
$keys[] = $entry['info'];
$keys[] = $entry['info'];
}
return $keys;
}
@ -65,7 +66,9 @@ class ApcCache extends AbstractCache
protected function _doContains($id)
{
$found = false;
apc_fetch($id, $found);
return $found;
}

View File

@ -57,6 +57,7 @@ class ArrayCache extends AbstractCache
if (isset($this->data[$id])) {
return $this->data[$id];
}
return false;
}
@ -74,6 +75,7 @@ class ArrayCache extends AbstractCache
protected function _doSave($id, $data, $lifeTime = 0)
{
$this->data[$id] = $data;
return true;
}
@ -83,6 +85,7 @@ class ArrayCache extends AbstractCache
protected function _doDelete($id)
{
unset($this->data[$id]);
return true;
}
}

View File

@ -37,7 +37,7 @@ interface Cache
{
/**
* Fetches an entry from the cache.
*
*
* @param string $id cache id The id of the cache entry to fetch.
* @return string The cached data or FALSE, if no cache entry exists for the given id.
*/
@ -63,7 +63,7 @@ interface Cache
/**
* Deletes a cache entry.
*
*
* @param string $id cache id
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
*/

View File

@ -43,14 +43,17 @@ class XcacheCache extends AbstractCache
{
$this->_checkAuth();
$keys = array();
for ($i = 0, $count = xcache_count(XC_TYPE_VAR); $i < $count; $i++) {
$entries = xcache_list(XC_TYPE_VAR, $i);
if (is_array($entries['cache_list'])) {
foreach ($entries['cache_list'] as $entry) {
$keys[] = $entry['name'];
}
}
}
return $keys;
}
@ -59,7 +62,7 @@ class XcacheCache extends AbstractCache
*/
protected function _doFetch($id)
{
return $this->_doContains($id) ? unserialize( xcache_get($id) ) : false;
return $this->_doContains($id) ? unserialize(xcache_get($id)) : false;
}
/**

View File

@ -3,7 +3,7 @@
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@ -50,14 +50,16 @@ namespace Symfony\Component\ClassLoader;
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class UniversalClassLoader
{
protected $namespaces = array();
protected $prefixes = array();
protected $namespaceFallback = array();
protected $prefixFallback = array();
private $namespaces = array();
private $prefixes = array();
private $namespaceFallback = array();
private $prefixFallback = array();
/**
* Gets the configured namespaces.
@ -103,6 +105,8 @@ class UniversalClassLoader
* Registers the directory to use as a fallback for namespaces.
*
* @param string|array $dirs A directory path or an array of directories
*
* @api
*/
public function registerNamespaceFallback($dirs)
{
@ -113,6 +117,8 @@ class UniversalClassLoader
* Registers the directory to use as a fallback for class prefixes.
*
* @param string|array $dirs A directory path or an array of directories
*
* @api
*/
public function registerPrefixFallback($dirs)
{
@ -123,6 +129,8 @@ class UniversalClassLoader
* Registers an array of namespaces
*
* @param array $namespaces An array of namespaces (namespaces as keys and locations as values)
*
* @api
*/
public function registerNamespaces(array $namespaces)
{
@ -136,6 +144,8 @@ class UniversalClassLoader
*
* @param string $namespace The namespace
* @param array|string $paths The location(s) of the namespace
*
* @api
*/
public function registerNamespace($namespace, $paths)
{
@ -146,6 +156,8 @@ class UniversalClassLoader
* Registers an array of classes using the PEAR naming convention.
*
* @param array $classes An array of classes (prefixes as keys and locations as values)
*
* @api
*/
public function registerPrefixes(array $classes)
{
@ -159,6 +171,8 @@ class UniversalClassLoader
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*
* @api
*/
public function registerPrefix($prefix, $paths)
{
@ -169,6 +183,8 @@ class UniversalClassLoader
* Registers this instance as an autoloader.
*
* @param Boolean $prepend Whether to prepend the autoloader or not
*
* @api
*/
public function register($prepend = false)
{
@ -182,9 +198,25 @@ class UniversalClassLoader
*/
public function loadClass($class)
{
$class = ltrim($class, '\\');
if ($file = $this->findFile($class)) {
require $file;
}
}
if (false !== ($pos = strrpos($class, '\\'))) {
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|null The path, if found
*/
protected function findFile($class)
{
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$namespace = substr($class, 0, $pos);
foreach ($this->namespaces as $ns => $dirs) {
@ -193,8 +225,7 @@ class UniversalClassLoader
$className = substr($class, $pos + 1);
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
if (file_exists($file)) {
require $file;
return;
return $file;
}
}
}
@ -203,8 +234,7 @@ class UniversalClassLoader
foreach ($this->namespaceFallback as $dir) {
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file)) {
require $file;
return;
return $file;
}
}
} else {
@ -214,8 +244,7 @@ class UniversalClassLoader
if (0 === strpos($class, $prefix)) {
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file)) {
require $file;
return;
return $file;
}
}
}
@ -224,8 +253,7 @@ class UniversalClassLoader
foreach ($this->prefixFallback as $dir) {
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file)) {
require $file;
return;
return $file;
}
}
}