Showing 67 of 67 total issues
Function getItems
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function getItems(array $keys = []): iterable
{
$items = [];
/**
- 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
File CacheItemPoolTrait.php
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
*
* This file is part of Phpfastcache.
Function setServers
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function setServers(array $servers): static
{
foreach ($servers as $server) {
if ($diff = array_diff(array_keys($server), ['host', 'port', 'saslUser', 'saslPassword', 'path'])) {
throw new PhpfastcacheInvalidConfigurationException('Unknown keys for memcached server: ' . implode(', ', $diff));
- 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 setServers
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function setServers(array $servers): static
{
foreach ($servers as $server) {
if (\array_key_exists('saslUser', $server) || array_key_exists('saslPassword', $server)) {
throw new PhpfastcacheInvalidConfigurationException('Unlike Memcached, Memcache does not support SASL authentication');
- 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 getItem
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function getItem(string $key): ExtendedCacheItemInterface
{
/**
* Replace array_key_exists by isset
* due to performance issue on huge
- 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 getItem
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function getItem(string $key): ExtendedCacheItemInterface
{
/** @var ExtendedCacheItemPoolInterface[] $poolsToResync */
$poolsToResync = [];
/** @var ?ExtendedCacheItemInterface $item */
- 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
ConfigurationOption
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class ConfigurationOption extends AbstractConfigurationOption implements ConfigurationOptionInterface
{
protected bool $itemDetailedDate = false;
protected bool $autoTmpFallback = false;
Function getInstance
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function getInstance(string $driver, ?ConfigurationOptionInterface $config = null, ?string $instanceId = null): ExtendedCacheItemPoolInterface
{
if (\class_exists($driver) && \str_starts_with($driver, 'Phpfastcache')) {
$driverClass = $driver;
} else {
- 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 rrmdir
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function rrmdir(string $source, bool $removeOnlyChildren = false): bool
{
if (empty($source) || file_exists($source) === false) {
return 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
Function buildTokenClasses
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected static function buildTokenClasses(string $namespace, string $class, array $classes, int $index, array $tokens): array
{
// Skip usage of ::class constant
$isClassConstant = false;
for ($j = $index - 1; $j > 0; --$j) {
- 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 mkdir
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function mkdir(string $fullPath, string $fullPathTmp): void
{
$fullPathHash = $this->getConfig()->getDefaultFileNameHashFunction()($fullPath);
if (!isset($this->tmp[$fullPathHash]) || (!@\file_exists($fullPath) || !@\is_writable($fullPath))) {
- 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 getItems
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getItems(array $keys = []): iterable
{
$items = [];
/**
File CacheManager.php
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
*
* This file is part of Phpfastcache.
Function deleteItems
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function deleteItems(array $keys): bool
{
if (count($keys) > 1) {
$return = true;
try {
- 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 getDbIndex
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDbIndex(string $keyword)
{
if (!isset($this->indexing)) {
$tableCreated = false;
if (!file_exists($this->sqliteDir . '/indexing')) {
Function getPhpfastcacheVersion
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function getPhpfastcacheVersion(bool $fallbackOnChangelog = true, bool $cacheable = true): string
{
/**
* Cache the version statically to improve
* performances on multiple calls
- 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 driverConnect
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function driverConnect(): bool
{
$clientConfig = $this->getConfig();
$clusterBuilder = Cassandra::cluster()
Function getDbIndex
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getDbIndex(string $keyword)
{
if (!isset($this->indexing)) {
$tableCreated = false;
if (!file_exists($this->sqliteDir . '/indexing')) {
- 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 buildTokenNamespace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected static function buildTokenNamespace(int $index, array $tokens): string
{
$namespace = '';
// If there is a namespace, extract it (PHP 8 test)
- 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 getItem
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getItem(string $key): ExtendedCacheItemInterface
{
/**
* Replace array_key_exists by isset
* due to performance issue on huge