1
0
Fork 0

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;
}