laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

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 handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle()
    {
        $relative = $this->option('relative');

        foreach ($this->links() as $link => $target) {
Severity: Minor
Found in src/Illuminate/Foundation/Console/StorageLinkCommand.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 __unserialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function __unserialize(array $values)
    {
        $properties = (new ReflectionClass($this))->getProperties();

        $class = get_class($this);
Severity: Minor
Found in src/Illuminate/Queue/SerializesModels.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 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 register has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function register($provider, $force = false)
    {
        if (($registered = $this->getProvider($provider)) && ! $force) {
            return $registered;
        }
Severity: Minor
Found in src/Illuminate/Foundation/Application.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 handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle()
    {
        if (parent::handle() === false && ! $this->option('force')) {
            return false;
        }
Severity: Minor
Found in src/Illuminate/Foundation/Console/ModelMakeCommand.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 sendNow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendNow($notifiables, $notification, ?array $channels = null)
    {
        if (! $notifiables instanceof Collection && ! is_array($notifiables)) {
            $notifiables = [$notifiables];
        }
Severity: Minor
Found in src/Illuminate/Support/Testing/Fakes/NotificationFake.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 handle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle()
    {
        if ($this->isProhibited() ||
            ! $this->confirmToProceed()) {
            return 1;
Severity: Minor
Found in src/Illuminate/Database/Console/Migrations/RefreshCommand.php - About 1 hr to fix

    Method assertStructure has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function assertStructure(?array $structure = null, $responseData = null, bool $exact = false)
        {
            if (is_null($structure)) {
                return $this->assertSimilar($this->decoded);
            }
    Severity: Minor
    Found in src/Illuminate/Testing/AssertableJsonString.php - About 1 hr to fix

      Method compileString has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function compileString($value)
          {
              [$this->footer, $result] = [[], ''];
      
              foreach ($this->prepareStringsForCompilationUsing as $callback) {
      Severity: Minor
      Found in src/Illuminate/View/Compilers/BladeCompiler.php - About 1 hr to fix

        Method upsert has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function upsert(array $values, $uniqueBy, $update = null)
            {
                if (empty($values)) {
                    return 0;
                } elseif ($update === []) {
        Severity: Minor
        Found in src/Illuminate/Database/Query/Builder.php - About 1 hr to fix

          Method hasMorph has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', ?Closure $callback = null)
              {
                  if (is_string($relation)) {
                      $relation = $this->getRelationWithoutConstraints($relation);
                  }
          Severity: Minor
          Found in src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php - About 1 hr to fix

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

                public function has($callback)
                {
                    if (is_string($callback)) {
                        $callback = fn () => $this->localRelationship->getRelated()->{$callback}();
                    }
            Severity: Minor
            Found in src/Illuminate/Database/Eloquent/PendingHasThroughRelationship.php - About 1 hr to fix

              Method prepareNestedWithRelationships has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function prepareNestedWithRelationships($relations, $prefix = '')
                  {
                      $preparedRelationships = [];
              
                      if ($prefix !== '') {
              Severity: Minor
              Found in src/Illuminate/Database/Eloquent/Builder.php - About 1 hr to fix

                Method find has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function find(string $batchId)
                    {
                        if ($batchId === '') {
                            return null;
                        }
                Severity: Minor
                Found in src/Illuminate/Bus/DynamoBatchRepository.php - About 1 hr to fix

                  Method take has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function take($limit)
                      {
                          if ($limit < 0) {
                              return new static(function () use ($limit) {
                                  $limit = abs($limit);
                  Severity: Minor
                  Found in src/Illuminate/Collections/LazyCollection.php - About 1 hr to fix

                    Method decrypt has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function decrypt($payload, $unserialize = true)
                        {
                            $payload = $this->getJsonPayload($payload);
                    
                            $iv = base64_decode($payload['iv']);
                    Severity: Minor
                    Found in src/Illuminate/Encryption/Encrypter.php - About 1 hr to fix

                      Method render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function render($description, $task = null, $verbosity = OutputInterface::VERBOSITY_NORMAL)
                          {
                              $description = $this->mutate($description, [
                                  Mutators\EnsureDynamicContentIsHighlighted::class,
                                  Mutators\EnsureNoPunctuation::class,
                      Severity: Minor
                      Found in src/Illuminate/Console/View/Components/Task.php - About 1 hr to fix

                        Method writeOutputForCli has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function writeOutputForCli(Job $job, $status)
                            {
                                $this->output->write(sprintf(
                                    '  <fg=gray>%s</> %s%s',
                                    $this->now()->format('Y-m-d H:i:s'),
                        Severity: Minor
                        Found in src/Illuminate/Queue/Console/WorkCommand.php - About 1 hr to fix

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

                              public function handle(Dispatcher $events)
                              {
                                  $models = $this->models();
                          
                                  if ($models->isEmpty()) {
                          Severity: Minor
                          Found in src/Illuminate/Database/Console/PruneCommand.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language