Showing 8 of 72 total issues
Function __construct
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(array|string $pool = '127.0.0.1', string $prefix = '')
{
parent::__construct($prefix);
if (is_string($pool)) {
- 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 clean
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function clean(): void
{
$a = $this->acquire();
foreach ($this->data['keys'] as $key => $id) {
if (!shm_has_var($this->memory, $id)) {
- 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 clean
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function clean(): void
{
$a = $this->acquire();
foreach ($this->data['keys'] as $key => $id) {
if (!shm_has_var($this->memory, $id)) {
Method _read
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _read(): mixed
{
switch (fgetc($this->socket)) {
case '+':
return trim(fgets($this->socket) ?: '', "\r\n");
Function getSet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getSet(string $key, callable $value, string|int|DateInterval|DateTime $expires = 0): mixed
{
$cnt = 0;
do {
$temp = $this->get($key, chr(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
Avoid too many return
statements within this method. Open
return $return;
Function keyID
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function keyID(string $key, bool $create = false): int
{
if (!isset($this->data['keys'][$key])) {
$this->readMaster();
}
- 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 getExpiresTimestamp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getExpiresTimestamp(int|string|DateInterval|DateTime $expires): int
{
if ($expires instanceof DateInterval) {
$expires = (new \DateTime())->add($expires)->getTimestamp();
}
- 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"