bkdotcom/ErrorHandler

View on GitHub

Showing 8 of 8 total issues

File Error.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * @package   bdk\ErrorHandler
 * @author    Brad Kent <bkfake-github@yahoo.com>
Severity: Minor
Found in src/Error.php - About 3 hrs to fix

    File ErrorHandler.php has 277 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * @package   bdk\ErrorHandler
     * @author    Brad Kent <bkfake-github@yahoo.com>
    Severity: Minor
    Found in src/ErrorHandler.php - About 2 hrs to fix

      Function toStringCheck has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function toStringCheck(Error $error)
          {
              if (PHP_VERSION_ID >= 70400) {
                  return;
              }
      Severity: Minor
      Found in src/AbstractErrorHandler.php - About 55 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

      Method errorFactory has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function errorFactory(self $handler, $errType, $errMsg, $file, $line, $vars = array())
      Severity: Minor
      Found in src/ErrorHandler.php - About 45 mins to fix

        Method handleError has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function handleError($errType, $errMsg, $file, $line, $vars = array())
        Severity: Minor
        Found in src/ErrorHandler.php - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

                    return $continueToNormal;
            Severity: Major
            Found in src/Error.php - About 30 mins to fix

              Function getCfg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getCfg($path = null)
                  {
                      $path = \is_array($path)
                          ? $path
                          : \array_filter(\preg_split('#[\./]#', (string) $path), 'strlen');
              Severity: Minor
              Found in src/AbstractComponent.php - About 25 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

              Severity
              Category
              Status
              Source
              Language