File Redis.php
has 284 lines of code (exceeds 250 allowed). Consider refactoring.
<?php
declare(strict_types=1);
namespace Bnomei;
Function benchmark
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
public function benchmark(int $count = 10): void
{
$prefix = 'redis-benchmark-';
$redis = $this;
$file = kirby()->cache('bnomei.redis-cachedriver');
Function preload
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
private function preload(): void
{
$this->preload = [];
$expire = $this->options['preload'];
if ($expire === false) {
Method preload
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
private function preload(): void
{
$this->preload = [];
$expire = $this->options['preload'];
if ($expire === false) {
Method benchmark
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
public function benchmark(int $count = 10): void
{
$prefix = 'redis-benchmark-';
$redis = $this;
$file = kirby()->cache('bnomei.redis-cachedriver');
Method __construct
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
public function __construct(array $options = [], array $optionsClient = [])
{
$this->options = array_merge([
'debug' => \option('debug'),
'store' => \option('bnomei.redis-cachedriver.store'),
Method set
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
public function set(string $key, mixed $value, int $minutes = 0): bool
{
/* SHOULD SET EVEN IN DEBUG
if ($this->options['debug')) {
return true;
Function __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
public function __construct(array $options = [], array $optionsClient = [])
{
$this->options = array_merge([
'debug' => \option('debug'),
'store' => \option('bnomei.redis-cachedriver.store'),
Function __destruct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
public function __destruct()
{
foreach ($this->shutdownCallbacks as $callback) {
if (! is_string($callback) && is_callable($callback)) {
$callback();
Function set
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
public function set(string $key, mixed $value, int $minutes = 0): bool
{
/* SHOULD SET EVEN IN DEBUG
if ($this->options['debug')) {
return true;