laravel/framework

View on GitHub
src/Illuminate/Foundation/Exceptions/Handler.php

Summary

Maintainability
D
2 days
Test Coverage

File Handler.php has 526 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Illuminate\Foundation\Exceptions;

use Closure;
Severity: Major
Found in src/Illuminate/Foundation/Exceptions/Handler.php - About 1 day to fix

    Handler has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Handler implements ExceptionHandlerContract
    {
        use ReflectsClosures;
    
        /**
    Severity: Minor
    Found in src/Illuminate/Foundation/Exceptions/Handler.php - About 6 hrs to fix

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

          protected function renderViaCallbacks($request, Throwable $e)
          {
              foreach ($this->renderCallbacks as $renderCallback) {
                  foreach ($this->firstClosureParameterTypes($renderCallback) as $type) {
                      if (is_a($e, $type)) {
      Severity: Minor
      Found in src/Illuminate/Foundation/Exceptions/Handler.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 throttle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function throttle(Throwable $e)
          {
              foreach ($this->throttleCallbacks as $throttleCallback) {
                  foreach ($this->firstClosureParameterTypes($throttleCallback) as $type) {
                      if (is_a($e, $type)) {
      Severity: Minor
      Found in src/Illuminate/Foundation/Exceptions/Handler.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 reportThrowable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function reportThrowable(Throwable $e): void
          {
              $this->reportedExceptionMap[$e] = true;
      
              if (Reflector::isCallable($reportCallable = [$e, 'report']) &&
      Severity: Minor
      Found in src/Illuminate/Foundation/Exceptions/Handler.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

      There are no issues that match your filters.

      Category
      Status