for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
*/
declare(strict_types=1);
namespace Bluz\Session\Adapter;
use Bluz\Common\Exception\ConfigurationException;
use Bluz\Proxy;
* Cache session handler
* @package Bluz\Session\Adapter
class Cache extends AbstractAdapter implements \SessionHandlerInterface
{
* Check and setup Redis server
* @param array $settings
* @throws ConfigurationException
public function __construct(array $settings = [])
$settings
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function __construct(/** @scrutinizer ignore-unused */ array $settings = [])
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
if (!Proxy\Cache::getInstance()) {
throw new ConfigurationException(
'Cache configuration is missed or disabled. Please check `cache` configuration section'
);
}
* Read session data
* @param string $id
* @return string
* @throws \Psr\Cache\InvalidArgumentException
public function read($id): string
return Proxy\Cache::get($this->prepareId($id)) ?: '';
* Write session data
* @param string $data
* @return bool
public function write($id, $data): bool
return Proxy\Cache::set($this->prepareId($id), $data, $this->ttl);
* Destroy a session
* @param integer $id
public function destroy($id): bool
return Proxy\Cache::delete($this->prepareId($id));
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.