Remove trailing whitespace

This commit is contained in:
Kijin Sung 2023-01-17 20:57:44 +09:00
parent 3b0030e82b
commit a9f72a5cd2
81 changed files with 2455 additions and 2455 deletions

View file

@ -11,23 +11,23 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
* Set this flag to false to disable cache prefixes.
*/
public $prefix = true;
/**
* The singleton instance is stored here.
*/
protected static $_instance = null;
/**
* Direct invocation of the constructor is not permitted.
*/
protected function __construct()
{
}
/**
* Create a new instance of the current cache driver, using the given settings.
*
*
* @param array $config
* @return void
*/
@ -39,24 +39,24 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
}
return self::$_instance;
}
/**
* Check if the current cache driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return function_exists('apcu_exists');
}
/**
* Validate cache settings.
*
*
* This method returns true on success and false on failure.
*
*
* @param mixed $config
* @return bool
*/
@ -64,12 +64,12 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
{
return true;
}
/**
* Get the value of a key.
*
*
* This method returns null if the key was not found.
*
*
* @param string $key
* @return mixed
*/
@ -78,13 +78,13 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
$value = apcu_fetch($key);
return $value === false ? null : $value;
}
/**
* Set the value to a key.
*
*
* This method returns true on success and false on failure.
* $ttl is measured in seconds. If it is zero, the key should not expire.
*
*
* @param string $key
* @param mixed $value
* @param int $ttl
@ -95,13 +95,13 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
{
return apcu_store($key, $value, $ttl);
}
/**
* Delete a key.
*
*
* This method returns true on success and false on failure.
* If the key does not exist, it should return false.
*
*
* @param string $key
* @return bool
*/
@ -109,12 +109,12 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
{
return apcu_delete($key);
}
/**
* Check if a key exists.
*
*
* This method returns true on success and false on failure.
*
*
* @param string $key
* @return bool
*/
@ -122,13 +122,13 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
{
return apcu_exists($key);
}
/**
* Increase the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -143,13 +143,13 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
}
return $result;
}
/**
* Decrease the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -164,12 +164,12 @@ class APC implements \Rhymix\Framework\Drivers\CacheInterface
}
return $result;
}
/**
* Clear all keys from the cache.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public function clear()

View file

@ -11,32 +11,32 @@ class Dummy extends File implements \Rhymix\Framework\Drivers\CacheInterface
* Set this flag to false to disable cache prefixes.
*/
public $prefix = false;
/**
* The singleton instance is stored here.
*/
protected static $_instance = null;
/**
* Dummy data is stored here.
*/
public $data = array();
/**
* Override the isSupported() method of the file driver.
*
*
* @return bool
*/
public static function isSupported()
{
return true;
}
/**
* Get the value of a key.
*
*
* This method returns null if the key was not found.
*
*
* @param string $key
* @return mixed
*/
@ -61,13 +61,13 @@ class Dummy extends File implements \Rhymix\Framework\Drivers\CacheInterface
return null;
}
}
/**
* Set the value to a key.
*
*
* This method returns true on success and false on failure.
* $ttl is measured in seconds. If it is zero, the key should not expire.
*
*
* @param string $key
* @param mixed $value
* @param int $ttl
@ -86,13 +86,13 @@ class Dummy extends File implements \Rhymix\Framework\Drivers\CacheInterface
return true;
}
}
/**
* Delete a key.
*
*
* This method returns true on success and false on failure.
* If the key does not exist, it should return false.
*
*
* @param string $key
* @return bool
*/
@ -112,12 +112,12 @@ class Dummy extends File implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Check if a key exists.
*
*
* This method returns true on success and false on failure.
*
*
* @param string $key
* @return bool
*/
@ -125,12 +125,12 @@ class Dummy extends File implements \Rhymix\Framework\Drivers\CacheInterface
{
return parent::exists($key) || isset($this->data[$key]);
}
/**
* Clear all keys from the cache.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public function clear()

View file

@ -13,17 +13,17 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
* Set this flag to false to disable cache prefixes.
*/
public $prefix = false;
/**
* The singleton instance is stored here.
*/
protected static $_instance = null;
/**
* The cache directory.
*/
protected $_dir;
/**
* Direct invocation of the constructor is not permitted.
*/
@ -35,10 +35,10 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
Storage::createDirectory($this->_dir);
}
}
/**
* Create a new instance of the current cache driver, using the given settings.
*
*
* @param array $config
* @return void
*/
@ -50,23 +50,23 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
}
return static::$_instance;
}
/**
* Since Rhymix 2.1, This method always returns false.
* The file cache driver can only be used through the dummy driver.
*
*
* @return bool
*/
public static function isSupported()
{
return false;
}
/**
* Validate cache settings.
*
*
* This method returns true on success and false on failure.
*
*
* @param mixed $config
* @return bool
*/
@ -74,12 +74,12 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
{
return true;
}
/**
* Get the value of a key.
*
*
* This method returns null if the key was not found.
*
*
* @param string $key
* @return mixed
*/
@ -87,7 +87,7 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
{
$filename = $this->_getFilename($key);
$data = Storage::readPHPData($filename);
if ($data === false)
{
return null;
@ -102,13 +102,13 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
return $data[1];
}
}
/**
* Set the value to a key.
*
*
* This method returns true on success and false on failure.
* $ttl is measured in seconds. If it is zero, the key should not expire.
*
*
* @param string $key
* @param mixed $value
* @param int $ttl
@ -119,13 +119,13 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
{
return Storage::writePHPData($this->_getFilename($key), array($ttl ? (time() + $ttl) : 0, $value), $key);
}
/**
* Delete a key.
*
*
* This method returns true on success and false on failure.
* If the key does not exist, it should return false.
*
*
* @param string $key
* @return bool
*/
@ -133,12 +133,12 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
{
return Storage::delete($this->_getFilename($key));
}
/**
* Check if a key exists.
*
*
* This method returns true on success and false on failure.
*
*
* @param string $key
* @return bool
*/
@ -146,13 +146,13 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
{
return $this->get($key) !== null;
}
/**
* Increase the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -163,13 +163,13 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
$success = $this->set($key, $value + $amount, 0, true);
return $success ? ($value + $amount) : false;
}
/**
* Decrease the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -178,22 +178,22 @@ class File implements \Rhymix\Framework\Drivers\CacheInterface
{
return $this->incr($key, 0 - $amount);
}
/**
* Clear all keys from the cache.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public function clear()
{
return Storage::deleteDirectory($this->_dir) ? true : false;
}
/**
* Get the filename to store a key.
*
*
* @param string $key
* @return string
*/

View file

@ -11,18 +11,18 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
* Set this flag to false to disable cache prefixes.
*/
public $prefix = true;
/**
* The singleton instance is stored here.
*/
protected static $_instance = null;
/**
* The Memcached connection is stored here.
*/
protected $_conn = null;
protected $_ext = null;
/**
* Direct invocation of the constructor is not permitted.
*/
@ -42,7 +42,7 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
{
return;
}
foreach ($config as $url)
{
if (starts_with('/', $url))
@ -59,10 +59,10 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
}
}
}
/**
* Create a new instance of the current cache driver, using the given settings.
*
*
* @param array $config
* @return void
*/
@ -74,24 +74,24 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
}
return self::$_instance;
}
/**
* Check if the current cache driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return class_exists('\\Memcached', false) || class_exists('\\Memcache', false);
}
/**
* Validate cache settings.
*
*
* This method returns true on success and false on failure.
*
*
* @param mixed $config
* @return bool
*/
@ -111,7 +111,7 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
{
return false;
}
foreach ($config as $url)
{
if (starts_with('/', $url))
@ -127,7 +127,7 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
}
}
}
for ($i = 0; $i < 5; $i++)
{
$key = 'rhymix:test:' . md5($i);
@ -136,12 +136,12 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
}
return true;
}
/**
* Get the value of a key.
*
*
* This method returns null if the key was not found.
*
*
* @param string $key
* @return mixed
*/
@ -157,13 +157,13 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
return $value;
}
}
/**
* Set the value to a key.
*
*
* This method returns true on success and false on failure.
* $ttl is measured in seconds. If it is zero, the key should not expire.
*
*
* @param string $key
* @param mixed $value
* @param int $ttl
@ -181,13 +181,13 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
return $this->_conn->set($key, $value, MEMCACHE_COMPRESSED, $ttl);
}
}
/**
* Delete a key.
*
*
* This method returns true on success and false on failure.
* If the key does not exist, it should return false.
*
*
* @param string $key
* @return bool
*/
@ -195,12 +195,12 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
{
return $this->_conn->delete($key);
}
/**
* Check if a key exists.
*
*
* This method returns true on success and false on failure.
*
*
* @param string $key
* @return bool
*/
@ -208,13 +208,13 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
{
return $this->_conn->get($key) !== false;
}
/**
* Increase the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -229,13 +229,13 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
}
return $result;
}
/**
* Decrease the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -250,12 +250,12 @@ class Memcached implements \Rhymix\Framework\Drivers\CacheInterface
}
return $result;
}
/**
* Clear all keys from the cache.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public function clear()

View file

@ -11,17 +11,17 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
* Set this flag to false to disable cache prefixes.
*/
public $prefix = true;
/**
* The singleton instance is stored here.
*/
protected static $_instance = null;
/**
* The Redis connection is stored here.
*/
protected $_conn = null;
/**
* Direct invocation of the constructor is not permitted.
*/
@ -71,10 +71,10 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
$this->_conn = null;
}
}
/**
* Create a new instance of the current cache driver, using the given settings.
*
*
* @param array $config
* @return void
*/
@ -86,24 +86,24 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
}
return self::$_instance;
}
/**
* Check if the current cache driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return class_exists('\\Redis', false);
}
/**
* Validate cache settings.
*
*
* This method returns true on success and false on failure.
*
*
* @param mixed $config
* @return bool
*/
@ -150,12 +150,12 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Get the value of a key.
*
*
* This method returns null if the key was not found.
*
*
* @param string $key
* @return mixed
*/
@ -169,7 +169,7 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
{
return null;
}
if ($value === false)
{
return null;
@ -178,7 +178,7 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
{
return $value;
}
$value = unserialize($value);
if ($value === false)
{
@ -186,13 +186,13 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
}
return $value;
}
/**
* Set the value to a key.
*
*
* This method returns true on success and false on failure.
* $ttl is measured in seconds. If it is zero, the key should not expire.
*
*
* @param string $key
* @param mixed $value
* @param int $ttl
@ -211,13 +211,13 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Delete a key.
*
*
* This method returns true on success and false on failure.
* If the key does not exist, it should return false.
*
*
* @param string $key
* @return bool
*/
@ -232,12 +232,12 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Check if a key exists.
*
*
* This method returns true on success and false on failure.
*
*
* @param string $key
* @return bool
*/
@ -252,13 +252,13 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Increase the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -274,13 +274,13 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Decrease the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -296,12 +296,12 @@ class Redis implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Clear all keys from the cache.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public function clear()

View file

@ -13,18 +13,18 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
* Set this flag to false to disable cache prefixes.
*/
public $prefix = false;
/**
* The singleton instance is stored here.
*/
protected static $_instance = null;
/**
* The database handle and prepared statements are stored here.
*/
protected $_dbh = null;
protected $_ps = array();
/**
* Direct invocation of the constructor is not permitted.
*/
@ -35,7 +35,7 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
Storage::createDirectory($dir);
}
$key = substr(hash_hmac('sha256', $dir, config('crypto.authentication_key')), 0, 32);
$filename = "$dir/$key.db";
if (Storage::exists($filename))
@ -51,10 +51,10 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
}
}
}
/**
* Connect to an SQLite3 database.
*
*
* @param string $filename
* @return void
*/
@ -65,10 +65,10 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
$this->_dbh->exec('PRAGMA journal_mode = MEMORY');
$this->_dbh->exec('PRAGMA synchronous = OFF');
}
/**
* Create a new instance of the current cache driver, using the given settings.
*
*
* @param array $config
* @return void
*/
@ -80,24 +80,24 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
}
return self::$_instance;
}
/**
* Check if the current cache driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return class_exists('\\SQLite3', false) && config('crypto.authentication_key') !== null && stripos(\PHP_SAPI, 'win') === false;
}
/**
* Validate cache settings.
*
*
* This method returns true on success and false on failure.
*
*
* @param mixed $config
* @return bool
*/
@ -105,12 +105,12 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
return true;
}
/**
* Get the value of a key.
*
*
* This method returns null if the key was not found.
*
*
* @param string $key
* @return mixed
*/
@ -122,14 +122,14 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
return null;
}
$stmt->bindValue(':key', $key, \SQLITE3_TEXT);
$result = $stmt->execute();
if (!$result)
{
return null;
}
$row = $result->fetchArray(\SQLITE3_NUM);
if ($row)
{
@ -148,13 +148,13 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
return null;
}
}
/**
* Set the value to a key.
*
*
* This method returns true on success and false on failure.
* $ttl is measured in seconds. If it is zero, the key should not expire.
*
*
* @param string $key
* @param mixed $value
* @param int $ttl
@ -169,19 +169,19 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
return false;
}
$stmt->bindValue(':key', $key, \SQLITE3_TEXT);
$stmt->bindValue(':val', serialize($value), \SQLITE3_TEXT);
$stmt->bindValue(':exp', $ttl ? (time() + $ttl) : 0, \SQLITE3_INTEGER);
return $stmt->execute() ? true : false;
}
/**
* Delete a key.
*
*
* This method returns true on success and false on failure.
* If the key does not exist, it should return false.
*
*
* @param string $key
* @return bool
*/
@ -193,16 +193,16 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
return false;
}
$stmt->bindValue(':key', $key, \SQLITE3_TEXT);
return $stmt->execute() ? true : false;
}
/**
* Check if a key exists.
*
*
* This method returns true on success and false on failure.
*
*
* @param string $key
* @return bool
*/
@ -214,7 +214,7 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
return false;
}
$stmt->bindValue(':key', $key, \SQLITE3_TEXT);
$stmt->bindValue(':exp', time(), \SQLITE3_INTEGER);
$result = $stmt->execute();
@ -222,7 +222,7 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
return false;
}
$row = $result->fetchArray(\SQLITE3_NUM);
if ($row)
{
@ -233,13 +233,13 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Increase the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -260,13 +260,13 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
return false;
}
}
/**
* Decrease the value of a key by $amount.
*
*
* If the key does not exist, this method assumes that the current value is zero.
* This method returns the new value.
*
*
* @param string $key
* @param int $amount
* @return int
@ -275,12 +275,12 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
return $this->incr($key, 0 - $amount);
}
/**
* Clear all keys from the cache.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public function clear()
@ -289,12 +289,12 @@ class SQLite implements \Rhymix\Framework\Drivers\CacheInterface
{
$this->_dbh->exec('DROP TABLE cache_' . $i);
}
for ($i = 0; $i < 32; $i++)
{
$this->_dbh->exec('CREATE TABLE cache_' . $i . ' (k TEXT PRIMARY KEY, v TEXT, exp INT)');
}
return true;
}
}