Showing 9 of 9 total issues
File Redis.php
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Bnomei;
Function benchmark
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function benchmark(int $count = 10)
{
$prefix = "redis-benchmark-";
$redis = $this;
$file = kirby()->cache('bnomei.redis-cachedriver'); // neat, right? ;-)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function preload
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function preload()
{
$this->preload = [];
$expire = $this->option('preload');
if ($expire === false) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method preload
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function preload()
{
$this->preload = [];
$expire = $this->option('preload');
if ($expire === false) {
Method benchmark
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function benchmark(int $count = 10)
{
$prefix = "redis-benchmark-";
$redis = $this;
$file = kirby()->cache('bnomei.redis-cachedriver'); // neat, right? ;-)
Method __construct
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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. Open
public function set(string $key, $value, int $minutes = 0): bool
{
/* SHOULD SET EVEN IN DEBUG
if ($this->option('debug')) {
return true;
Function __destruct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __destruct()
{
foreach ($this->shutdownCallbacks as $callback) {
if (!is_string($callback) && is_callable($callback)) {
$callback();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function set
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function set(string $key, $value, int $minutes = 0): bool
{
/* SHOULD SET EVEN IN DEBUG
if ($this->option('debug')) {
return true;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"