File RedisBagOStuff.php
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Object caching using Redis (http://redis.io/).
*
* This program is free software; you can redistribute it and/or modify
Function getConnectionsForKeys
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
protected function getConnectionsForKeys( array $keys ) {
$keysByServer = [];
$connByServer = [];
$success = true;
foreach ( $keys as $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 doGetMulti
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function doGetMulti( array $keys, $flags = 0 ) {
$blobsFound = [];
[ $keysByServer, $connByServer ] = $this->getConnectionsForKeys( $keys );
foreach ( $keysByServer as $server => $batchKeys ) {
- 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 doGetMulti
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doGetMulti( array $keys, $flags = 0 ) {
$blobsFound = [];
[ $keysByServer, $connByServer ] = $this->getConnectionsForKeys( $keys );
foreach ( $keysByServer as $server => $batchKeys ) {
Function doChangeTTLMulti
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function doChangeTTLMulti( array $keys, $exptime, $flags = 0 ) {
$relative = $this->isRelativeExpiration( $exptime );
$op = ( $exptime == self::TTL_INDEFINITE )
? 'persist'
: ( $relative ? 'expire' : 'expireAt' );
- 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 doSetMulti
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function doSetMulti( array $data, $exptime = 0, $flags = 0 ) {
$ttl = $this->getExpirationAsTTL( $exptime );
$op = $ttl ? 'setex' : 'set';
$keys = array_keys( $data );
- 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 getConnectionsForKeys
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getConnectionsForKeys( array $keys ) {
$keysByServer = [];
$connByServer = [];
$success = true;
foreach ( $keys as $key ) {
Method doSetMulti
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doSetMulti( array $data, $exptime = 0, $flags = 0 ) {
$ttl = $this->getExpirationAsTTL( $exptime );
$op = $ttl ? 'setex' : 'set';
$keys = array_keys( $data );
Method doChangeTTLMulti
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doChangeTTLMulti( array $keys, $exptime, $flags = 0 ) {
$relative = $this->isRelativeExpiration( $exptime );
$op = ( $exptime == self::TTL_INDEFINITE )
? 'persist'
: ( $relative ? 'expire' : 'expireAt' );
Method doIncrWithInit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doIncrWithInit( $key, $exptime, $step, $init, $flags ) {
$conn = $this->getConnection( $key );
if ( !$conn ) {
return false;
}
Method doGet
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doGet( $key, $flags = 0, &$casToken = null ) {
$getToken = ( $casToken === self::PASS_BY_REF );
$casToken = null;
$conn = $this->getConnection( $key );
Function doDeleteMulti
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function doDeleteMulti( array $keys, $flags = 0 ) {
[ $keysByServer, $connByServer, $result ] = $this->getConnectionsForKeys( $keys );
foreach ( $keysByServer as $server => $batchKeys ) {
$conn = $connByServer[$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
Method doIncrWithInit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function doIncrWithInit( $key, $exptime, $step, $init, $flags ) {
Function doGet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function doGet( $key, $flags = 0, &$casToken = null ) {
$getToken = ( $casToken === self::PASS_BY_REF );
$casToken = null;
$conn = $this->getConnection( $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"