presscodes/maera

View on GitHub
includes/utils.php

Summary

Maintainability
C
1 day
Test Coverage

Function array_column has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    function array_column($input = null, $columnKey = null, $indexKey = null)
    {
        // Using func_get_args() in order to check for proper number of
        // parameters and trigger errors exactly as the built-in array_column()
        // does in PHP 5.5.
Severity: Minor
Found in includes/utils.php - About 5 hrs to fix

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 array_column has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function array_column($input = null, $columnKey = null, $indexKey = null)
    {
        // Using func_get_args() in order to check for proper number of
        // parameters and trigger errors exactly as the built-in array_column()
        // does in PHP 5.5.
Severity: Major
Found in includes/utils.php - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

            if (isset($params[2])
                && !is_int($params[2])
                && !is_float($params[2])
                && !is_string($params[2])
                && !(is_object($params[2]) && method_exists($params[2], '__toString'))
    Severity: Major
    Found in includes/utils.php - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if (!is_int($params[1])
                  && !is_float($params[1])
                  && !is_string($params[1])
                  && $params[1] !== null
                  && !(is_object($params[1]) && method_exists($params[1], '__toString'))
      Severity: Major
      Found in includes/utils.php - About 40 mins to fix

        Avoid too many return statements within this method.
        Open

                return $resultArray;
        Severity: Major
        Found in includes/utils.php - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status