Showing 10 of 10 total issues
File PHPCache.php
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Bnomei;
Function benchmark
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function benchmark(int $count = 10)
{
$prefix = "elephant-benchmark-";
$php = $this;
$file = kirby()->cache('bnomei.php-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
PHPCache
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
final class PHPCache extends FileCache
{
private $shutdownCallbacks = [];
/** @var array $database */
Method benchmark
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function benchmark(int $count = 10)
{
$prefix = "elephant-benchmark-";
$php = $this;
$file = kirby()->cache('bnomei.php-cachedriver'); // neat, right? ;-)
Method setOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function setOptions(array $options)
{
$root = null;
$cache = kirby()->cache('bnomei.php-cachedriver');
if (is_a($cache, FileCache::class)) {
Function setOptions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function setOptions(array $options)
{
$root = null;
$cache = kirby()->cache('bnomei.php-cachedriver');
if (is_a($cache, FileCache::class)) {
- 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 load
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function load()
{
$this->database = [];
$monoFile = $this->file(static::DB_FILENAME);
- 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 removeAndSet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function removeAndSet(string $key, $value, int $minutes = 0): bool
{
$this->remove($key);
$key = $this->key($key);
- 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 garbagecollect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function garbagecollect(): bool
{
$count = 0;
foreach (array_keys($this->database) as $key) {
$expires = null;
- 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 serialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function serialize($value)
{
if (! $value) {
return null;
}
- 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"