Showing 67 of 67 total issues
Method getInstance
has 38 lines of code (exceeds 25 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 {
Method driverWrite
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function driverWrite(ExtendedCacheItemInterface $item): bool
{
try {
$cacheData = $this->encode($this->driverPreWrap($item));
Function driverConnect
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function driverConnect(): bool
{
$this->instance = new MemcachedSoftware();
$optPrefix = $this->getConfig()->getOptPrefix();
$this->instance->setOption(MemcachedSoftware::OPT_BINARY_PROTOCOL, 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"
Further reading
Method driverConnect
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function driverConnect(): bool
{
/**
* In case of a user-provided
* Predis client just return here
Method getPhpfastcacheVersion
has 32 lines of code (exceeds 25 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
Method getStats
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStats(): DriverStatistic
{
$stats = new DriverStatistic();
$stats->setInfo(
sprintf(
Function driverConnect
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function driverConnect(): bool
{
$this->instance = new MemcacheSoftware();
foreach ($this->getConfig()->getServers() as $server) {
- 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 getItemsByTags
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getItemsByTags(array $tagNames, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): array
{
$items = [];
foreach (\array_unique($tagNames) as $tagName) {
$items[] = $this->fetchItemsByTagFromBackend($tagName);
- 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 getDriverList
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getDriverList(bool $fqcnAsKey = false): array
{
static $driverList;
if (self::getDefaultNamespacePath() === self::getNamespacePath()) {
- 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 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getItem(string $key): ExtendedCacheItemInterface
{
/** @var ExtendedCacheItemPoolInterface[] $poolsToResync */
$poolsToResync = [];
/** @var ?ExtendedCacheItemInterface $item */
Method __construct
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(#[\SensitiveParameter] ConfigurationOptionInterface $config, string $instanceId, EventManagerInterface $em)
{
$this->setEventManager($em->getScopedEventManager($this));
$this->setConfig($config);
$this->instanceId = $instanceId;
Method driverWriteTags
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function driverWriteTags(ExtendedCacheItemInterface $item): bool
{
/**
* Do not attempt to write tags
* on tags item, it can lead
Method driverConnect
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function driverConnect(): bool
{
$this->instance = new MemcacheSoftware();
foreach ($this->getConfig()->getServers() as $server) {
Method driverConnect
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function driverConnect(): bool
{
$this->instance = new MemcachedSoftware();
$optPrefix = $this->getConfig()->getOptPrefix();
$this->instance->setOption(MemcachedSoftware::OPT_BINARY_PROTOCOL, true);
Method deleteItems
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteItems(array $keys): bool
{
if (count($keys) > 1) {
$return = true;
try {
Method rrmdir
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function rrmdir(string $source, bool $removeOnlyChildren = false): bool
{
if (empty($source) || file_exists($source) === false) {
return false;
}
Method save
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save(CacheItemInterface $item): bool
{
$this->assertCacheItemType($item, self::getItemClass());
/**
* @var ExtendedCacheItemInterface $item
Function __call
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function __call(string $name, array $arguments): void
{
if (\str_starts_with($name, 'on')) {
$name = \substr($name, 2);
if (\is_callable($arguments[0])) {
- 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 driverRead
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function driverRead(ExtendedCacheItemInterface $item): ?array
{
try {
$stm = $this->getDb($item->getEncodedKey())
->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1");
Method addCoreDriverOverride
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addCoreDriverOverride(string $driverName, string $className): void
{
$driverName = self::normalizeDriverName($driverName);
if (empty($driverName)) {