Renamed __toString() to getName()

This commit is contained in:
Philipp Holzer 2019-08-04 16:13:53 +02:00
parent d2211bd6dd
commit 3834d5e129
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
10 changed files with 37 additions and 16 deletions

View File

@ -87,7 +87,7 @@ HELP;
}
if ($this->getOption('v')) {
$this->out('Cache Driver Name: ' . (string)$this->cache);
$this->out('Cache Driver Name: ' . $this->cache->getName());
$this->out('Cache Driver Class: ' . get_class($this->cache));
}

View File

@ -153,7 +153,10 @@ class APCuCache extends Cache implements IMemoryCache
return true;
}
public function __toString()
/**
* {@inheritDoc}
*/
public function getName()
{
return self::TYPE_APCU;
}

View File

@ -91,7 +91,10 @@ class ArrayCache extends Cache implements IMemoryCache
}
}
public function __toString()
/**
* {@inheritDoc}
*/
public function getName()
{
return self::TYPE_ARRAY;
}

View File

@ -28,13 +28,6 @@ abstract class Cache implements ICache
const MINUTE = 60;
const INFINITE = 0;
/**
* Force each Cache implementation to define the ToString method
*
* @return string
*/
abstract function __toString();
/**
* @var string The hostname
*/

View File

@ -110,7 +110,10 @@ class DatabaseCache extends Cache implements ICache
}
}
public function __toString()
/**
* {@inheritDoc}
*/
public function getName()
{
return self::TYPE_DATABASE;
}

View File

@ -54,4 +54,11 @@ interface ICache
* @return bool
*/
public function clear($outdated = true);
/**
* Returns the name of the current cache
*
* @return string
*/
public function getName();
}

View File

@ -148,7 +148,10 @@ class MemcacheCache extends Cache implements IMemoryCache
return $this->memcache->add($cachekey, serialize($value), MEMCACHE_COMPRESSED, $ttl);
}
public function __toString()
/**
* {@inheritDoc}
*/
public function getName()
{
return self::TYPE_MEMCACHE;
}

View File

@ -152,7 +152,10 @@ class MemcachedCache extends Cache implements IMemoryCache
return $this->memcached->add($cachekey, $value, $ttl);
}
public function __toString()
/**
* {@inheritDoc}
*/
public function getName()
{
return self::TYPE_MEMCACHED;
}

View File

@ -152,8 +152,11 @@ class ProfilerCache implements ICache, IMemoryCache
}
}
public function __toString()
/**
* {@inheritDoc}
*/
public function GetName()
{
return (string)$this->cache . ' (with profiler)';
return $this->cache->getName() . ' (with profiler)';
}
}

View File

@ -192,7 +192,10 @@ class RedisCache extends Cache implements IMemoryCache
return false;
}
public function __toString()
/**
* {@inheritDoc}
*/
public function getName()
{
return self::TYPE_REDIS;
}