laravel/framework

View on GitHub
src/Illuminate/Queue/Worker.php

Summary

Maintainability
D
2 days
Test Coverage

File Worker.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Illuminate\Queue;

use Illuminate\Contracts\Cache\Repository as CacheContract;
Severity: Minor
Found in src/Illuminate/Queue/Worker.php - About 5 hrs to fix

    Worker has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Worker
    {
        use DetectsLostConnections;
    
        const EXIT_SUCCESS = 0;
    Severity: Minor
    Found in src/Illuminate/Queue/Worker.php - About 5 hrs to fix

      Function daemon has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function daemon($connectionName, $queue, WorkerOptions $options)
          {
              if ($supportsAsyncSignals = $this->supportsAsyncSignals()) {
                  $this->listenForSignals();
              }
      Severity: Minor
      Found in src/Illuminate/Queue/Worker.php - About 3 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 daemon has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function daemon($connectionName, $queue, WorkerOptions $options)
          {
              if ($supportsAsyncSignals = $this->supportsAsyncSignals()) {
                  $this->listenForSignals();
              }
      Severity: Minor
      Found in src/Illuminate/Queue/Worker.php - About 1 hr to fix

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

            protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startTime = 0, $jobsProcessed = 0, $job = null)
        Severity: Minor
        Found in src/Illuminate/Queue/Worker.php - About 35 mins to fix

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

              public function __construct(QueueManager $manager,
                                          Dispatcher $events,
                                          ExceptionHandler $exceptions,
                                          callable $isDownForMaintenance,
                                          ?callable $resetScope = null)
          Severity: Minor
          Found in src/Illuminate/Queue/Worker.php - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status