thephpleague/booboo

View on GitHub

Showing 6 of 8 total issues

Function getFrames has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFrames()
    {
        if ($this->frames === null) {
            $frames = $this->exception->getTrace();

Severity: Minor
Found in src/Util/Inspector.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 determineSeverityTextValue has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function determineSeverityTextValue($severity)
    {
        switch ($severity) {
            case E_ERROR:
            case E_USER_ERROR:
Severity: Minor
Found in src/Formatter/AbstractFormatter.php - About 1 hr to fix

    Method handleErrorException has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function handleErrorException(\ErrorException $e)
        {
            switch ($e->getSeverity()) {
    
                case E_ERROR:
    Severity: Minor
    Found in src/Handler/LogHandler.php - About 1 hr to fix

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

          public function getFileLines($start = 0, $length = null)
          {
              $contents = $this->getFileContents();
      
              if (isset($contents)) {
      Severity: Minor
      Found in src/Util/Frame.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

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

          protected function determineSeverityTextValue($severity)
          {
              switch ($severity) {
                  case E_ERROR:
                  case E_USER_ERROR:
      Severity: Minor
      Found in src/Formatter/AbstractFormatter.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

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

          public function errorHandler($errno, $errstr, $errfile, $errline)
          {
              // Only handle errors that match the error reporting level.
              if (!($errno & error_reporting())) { // bitwise operation
                  if ($errno & $this->fatalErrors) {
      Severity: Minor
      Found in src/BooBoo.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