mirror of
https://github.com/friendica/friendica
synced 2024-12-22 23:20:16 +00:00
Rename NAME to constant
This commit is contained in:
parent
bbfec06a3d
commit
9ff89a970a
9 changed files with 11 additions and 11 deletions
|
@ -69,7 +69,7 @@ class Cache
|
||||||
*/
|
*/
|
||||||
public function createDistributed(string $type = null): ICanCache
|
public function createDistributed(string $type = null): ICanCache
|
||||||
{
|
{
|
||||||
if ($type === Type\APCuCache::$NAME) {
|
if ($type === Type\APCuCache::NAME) {
|
||||||
throw new InvalidCacheDriverException('apcu doesn\'t support distributed caching.');
|
throw new InvalidCacheDriverException('apcu doesn\'t support distributed caching.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ use Friendica\Core\Cache\Exception\InvalidCacheDriverException;
|
||||||
*/
|
*/
|
||||||
class APCuCache extends AbstractCache implements ICanCacheInMemory
|
class APCuCache extends AbstractCache implements ICanCacheInMemory
|
||||||
{
|
{
|
||||||
public static $NAME = 'apcu';
|
const NAME = 'apcu';
|
||||||
|
|
||||||
use CompareSetTrait;
|
use CompareSetTrait;
|
||||||
use CompareDeleteTrait;
|
use CompareDeleteTrait;
|
||||||
|
|
|
@ -28,7 +28,7 @@ use Friendica\Core\Cache\Capability\ICanCache;
|
||||||
*/
|
*/
|
||||||
abstract class AbstractCache implements ICanCache
|
abstract class AbstractCache implements ICanCache
|
||||||
{
|
{
|
||||||
public static $NAME = '';
|
const NAME = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string The hostname
|
* @var string The hostname
|
||||||
|
@ -111,6 +111,6 @@ abstract class AbstractCache implements ICanCache
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return static::$NAME;
|
return static::NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ use Friendica\Core\Cache\Enum;
|
||||||
*/
|
*/
|
||||||
class ArrayCache extends AbstractCache implements ICanCacheInMemory
|
class ArrayCache extends AbstractCache implements ICanCacheInMemory
|
||||||
{
|
{
|
||||||
public static $NAME = 'array';
|
const NAME = 'array';
|
||||||
|
|
||||||
use CompareDeleteTrait;
|
use CompareDeleteTrait;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Util\DateTimeFormat;
|
||||||
*/
|
*/
|
||||||
class DatabaseCache extends AbstractCache implements ICanCache
|
class DatabaseCache extends AbstractCache implements ICanCache
|
||||||
{
|
{
|
||||||
public static $NAME = 'database';
|
const NAME = 'database';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Database
|
* @var Database
|
||||||
|
|
|
@ -33,7 +33,7 @@ use Memcache;
|
||||||
*/
|
*/
|
||||||
class MemcacheCache extends AbstractCache implements ICanCacheInMemory
|
class MemcacheCache extends AbstractCache implements ICanCacheInMemory
|
||||||
{
|
{
|
||||||
static $NAME = 'memcached';
|
const NAME = 'memcached';
|
||||||
|
|
||||||
use CompareSetTrait;
|
use CompareSetTrait;
|
||||||
use CompareDeleteTrait;
|
use CompareDeleteTrait;
|
||||||
|
|
|
@ -34,7 +34,7 @@ use Psr\Log\LoggerInterface;
|
||||||
*/
|
*/
|
||||||
class MemcachedCache extends AbstractCache implements ICanCacheInMemory
|
class MemcachedCache extends AbstractCache implements ICanCacheInMemory
|
||||||
{
|
{
|
||||||
static $NAME = 'memcached';
|
const NAME = 'memcached';
|
||||||
|
|
||||||
use CompareSetTrait;
|
use CompareSetTrait;
|
||||||
use CompareDeleteTrait;
|
use CompareDeleteTrait;
|
||||||
|
|
|
@ -33,7 +33,7 @@ use Redis;
|
||||||
*/
|
*/
|
||||||
class RedisCache extends AbstractCache implements ICanCacheInMemory
|
class RedisCache extends AbstractCache implements ICanCacheInMemory
|
||||||
{
|
{
|
||||||
public static $NAME = 'redis';
|
const NAME = 'redis';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Redis
|
* @var Redis
|
||||||
|
|
|
@ -250,8 +250,8 @@ abstract class CacheTest extends MockedTest
|
||||||
|
|
||||||
public function testGetName()
|
public function testGetName()
|
||||||
{
|
{
|
||||||
if (property_exists($this->instance, '$NAME')) {
|
if (defined(get_class($this->instance) . '::NAME')) {
|
||||||
self::assertEquals($this->instance::$NAME, $this->instance->getName());
|
self::assertEquals($this->instance::NAME, $this->instance->getName());
|
||||||
} else {
|
} else {
|
||||||
self::expectNotToPerformAssertions();
|
self::expectNotToPerformAssertions();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue