strata-mvc/strata

View on GitHub
src/Logger/Debugger.php

Summary

Maintainability
D
1 day
Test Coverage

Method exportObject has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected static function exportObject($var, $depth = 1, $indent = 0)
    {
        $out = '';
        $props = [];
        $className = get_class($var);
Severity: Minor
Found in src/Logger/Debugger.php - About 1 hr to fix

    Function exportObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function exportObject($var, $depth = 1, $indent = 0)
        {
            $out = '';
            $props = [];
            $className = get_class($var);
    Severity: Minor
    Found in src/Logger/Debugger.php - About 1 hr 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 trace has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function trace($backtrace = null, $options = array())
        {
            if (is_null($backtrace)) {
                $backtrace = debug_backtrace();
            }
    Severity: Minor
    Found in src/Logger/Debugger.php - About 1 hr to fix

      Function trace has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function trace($backtrace = null, $options = array())
          {
              if (is_null($backtrace)) {
                  $backtrace = debug_backtrace();
              }
      Severity: Minor
      Found in src/Logger/Debugger.php - About 1 hr 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

      Function exportArray has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function exportArray(array $var, $depth = 1, $indent = 0)
          {
              $out = "[";
              $break = $end = null;
              if (!empty($var)) {
      Severity: Minor
      Found in src/Logger/Debugger.php - About 1 hr 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

      Function getType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getType($var)
          {
              if (is_object($var)) {
                  return get_class($var);
              }
      Severity: Minor
      Found in src/Logger/Debugger.php - About 45 mins 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

      Avoid too many return statements within this method.
      Open

                      return strtolower(gettype($var));
      Severity: Major
      Found in src/Logger/Debugger.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return 'boolean';
        Severity: Major
        Found in src/Logger/Debugger.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return 'float';
          Severity: Major
          Found in src/Logger/Debugger.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return 'integer';
            Severity: Major
            Found in src/Logger/Debugger.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return "'" . $var . "'";
              Severity: Major
              Found in src/Logger/Debugger.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return static::exportObject($var, $depth - 1, $indent + 1);
                Severity: Major
                Found in src/Logger/Debugger.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return static::exportArray($var, $depth - 1, $indent + 1);
                  Severity: Major
                  Found in src/Logger/Debugger.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return 'null';
                    Severity: Major
                    Found in src/Logger/Debugger.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return 'unknown';
                      Severity: Major
                      Found in src/Logger/Debugger.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return 'unknown';
                        Severity: Major
                        Found in src/Logger/Debugger.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return 'resource';
                          Severity: Major
                          Found in src/Logger/Debugger.php - About 30 mins to fix

                            There are no issues that match your filters.

                            Category
                            Status