Function fromPostgresArrayWithBraces
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
public static function fromPostgresArrayWithBraces(
?string $s,
int $start = 0,
?int &$end = null,
array $braces = [
- 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 Arr.php
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Php\Support\Helpers;
Function dataToArray
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function dataToArray(mixed $items): mixed
{
if (is_object($items)) {
if ($items instanceof JsonSerializable) {
return static::dataToArray($items->jsonSerialize());
- 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
Arr
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Arr
{
/**
* Collapse an array of arrays into a single array.
*
Method fromPostgresArrayWithBraces
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromPostgresArrayWithBraces(
?string $s,
int $start = 0,
?int &$end = null,
array $braces = [
Function remove
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function remove(array|ArrayObject &$array, array|string $keys): void
{
$original = &$array;
$keys = (array)$keys;
- 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 merge
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function merge(array $res, array $b, bool $replaceArray = true): array
{
foreach ($b as $key => $val) {
if (is_int($key)) {
if (isset($res[$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 has
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function has(ArrayAccess|array $array, string|array $keys, string $separator = '.'): bool
{
$keys = (array)$keys;
if (!$array || $keys === []) {
- 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 dataToArray
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function dataToArray(mixed $items): mixed
{
if (is_object($items)) {
if ($items instanceof JsonSerializable) {
return static::dataToArray($items->jsonSerialize());
Function get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function get(mixed $array, string|int|null $key, mixed $default = null, string $separator = '.'): mixed
{
if (!static::accessible($array)) {
return value($default);
}
- 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 random
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function random(array $array, ?int $number = null, bool $preserveKeys = false): mixed
{
$requested = $number ?? 1;
$count = count($array);
- 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 $array;
Avoid too many return
statements within this method. Open
return (array)$items->jsonSerialize();
Avoid too many return
statements within this method. Open
return value($default);
Avoid too many return
statements within this method. Open
return (array)$items;