Function mergeRecursive
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function mergeRecursive($firstArr, $secondArr)
{
$args = func_get_args();
$result = array_shift($args);
while (sizeof($args) > 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
Function map
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function map(&$arr, $keyColumn, $valColumn = null)
{
$result = [];
foreach ($arr as $val) {
if (!isset($val[$keyColumn]) || ($valColumn !== null && !isset($val[$valColumn]))) {
- 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 filterValues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function filterValues(&$arr, $type = self::TYPE_INTEGER, $preserveKeys = false)
{
switch($type) {
case self::TYPE_INTEGER:
$callback = 'is_int';
- 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 prepareArguments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function prepareArguments(&$arr, &$key, &$direction = SORT_ASC, &$sortFlag = SORT_REGULAR)
{
$keys = is_array($key) ? $key : [$key];
$keysCount = sizeof($keys);
if ($keysCount < 1 || empty($arr)) {
- 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"