laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

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

    public function processTypes($results)
    {
        return array_map(function ($result) {
            $result = (object) $result;

Severity: Minor
Found in src/Illuminate/Database/Query/Processors/PostgresProcessor.php - About 1 hr to fix

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

        public function __construct(Blueprint $blueprint, Connection $connection, Grammar $grammar)
        {
            $this->blueprint = $blueprint;
            $this->connection = $connection;
            $this->grammar = $grammar;
    Severity: Minor
    Found in src/Illuminate/Database/Schema/BlueprintState.php - About 1 hr to fix

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

          protected function sortByMany(array $comparisons = [], int $options = SORT_REGULAR)
          {
              $items = $this->items;
      
              uasort($items, function ($a, $b) use ($comparisons, $options) {
      Severity: Minor
      Found in src/Illuminate/Collections/Collection.php - About 1 hr to fix

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

            public function handle(Schedule $schedule)
            {
                $phpBinary = Application::phpBinary();
        
                $commands = $schedule->events();
        Severity: Minor
        Found in src/Illuminate/Console/Scheduling/ScheduleTestCommand.php - About 1 hr to fix

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

              public function pack(array $values): array
              {
                  if (empty($values)) {
                      return $values;
                  }
          Severity: Minor
          Found in src/Illuminate/Redis/Connections/PacksPhpRedisValues.php - About 1 hr to fix

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

                protected function getRelations($model)
                {
                    return collect(get_class_methods($model))
                        ->map(fn ($method) => new ReflectionMethod($model, $method))
                        ->reject(
            Severity: Minor
            Found in src/Illuminate/Database/Console/ShowModelCommand.php - About 1 hr to fix

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

                  protected function handlePromiseResponse(Response|ConnectionException|TransferException $response, $method, $url, $options, $attempt)
                  {
                      if ($response instanceof Response && $response->successful()) {
                          return $response;
                      }
              Severity: Minor
              Found in src/Illuminate/Http/Client/PendingRequest.php - About 1 hr to fix

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

                    public function compileAlter(Blueprint $blueprint, Fluent $command, Connection $connection)
                    {
                        $columnNames = [];
                        $autoIncrementColumn = null;
                
                
                Severity: Minor
                Found in src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php - About 1 hr to fix

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

                      public function handle()
                      {
                          if ($this->option('passport')) {
                              $this->installPassport();
                          } else {
                  Severity: Minor
                  Found in src/Illuminate/Foundation/Console/ApiInstallCommand.php - About 1 hr to fix

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

                        public function __invoke($path, $manifestDirectory = '')
                        {
                            static $manifests = [];
                    
                            if (! str_starts_with($path, '/')) {
                    Severity: Minor
                    Found in src/Illuminate/Foundation/Mix.php - About 1 hr to fix

                      Function addSelect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function addSelect($column)
                          {
                              $columns = is_array($column) ? $column : func_get_args();
                      
                              foreach ($columns as $as => $column) {
                      Severity: Minor
                      Found in src/Illuminate/Database/Query/Builder.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 prefers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function prefers($contentTypes)
                          {
                              $accepts = $this->getAcceptableContentTypes();
                      
                              $contentTypes = (array) $contentTypes;
                      Severity: Minor
                      Found in src/Illuminate/Http/Concerns/InteractsWithContentTypes.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 handlePromiseResponse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function handlePromiseResponse(Response|ConnectionException|TransferException $response, $method, $url, $options, $attempt)
                          {
                              if ($response instanceof Response && $response->successful()) {
                                  return $response;
                              }
                      Severity: Minor
                      Found in src/Illuminate/Http/Client/PendingRequest.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 subscribe has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function subscribe($subscriber)
                          {
                              $subscriber = $this->resolveSubscriber($subscriber);
                      
                              $events = $subscriber->subscribe($this);
                      Severity: Minor
                      Found in src/Illuminate/Events/Dispatcher.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 decrypt has a Cognitive Complexity of 12 (exceeds 5 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

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

                          protected function explodeWildcardRules($results, $attribute, $rules)
                          {
                              $pattern = str_replace('\*', '[^\.]*', preg_quote($attribute, '/'));
                      
                              $data = ValidationData::initializeAndGatherData($attribute, $this->data);
                      Severity: Minor
                      Found in src/Illuminate/Validation/ValidationRuleParser.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 processColumns has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function processColumns($results, $sql = '')
                          {
                              $hasPrimaryKey = array_sum(array_column($results, 'primary')) === 1;
                      
                              return array_map(function ($result) use ($hasPrimaryKey, $sql) {
                      Severity: Minor
                      Found in src/Illuminate/Database/Query/Processors/SQLiteProcessor.php - About 1 hr to fix

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

                            protected function registerBatchServices()
                            {
                                $this->app->singleton(BatchRepository::class, function ($app) {
                                    $driver = $app->config->get('queue.batching.driver', 'database');
                        
                        
                        Severity: Minor
                        Found in src/Illuminate/Bus/BusServiceProvider.php - About 1 hr to fix

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

                              protected function installNodeDependencies()
                              {
                                  if ($this->option('without-node') || ! confirm('Would you like to install and build the Node dependencies required for broadcasting?', default: true)) {
                                      return;
                                  }
                          Severity: Minor
                          Found in src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php - About 1 hr to fix

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

                                protected function replaceModel($stub, $model)
                                {
                                    $model = str_replace('/', '\\', $model);
                            
                                    if (str_starts_with($model, '\\')) {
                            Severity: Minor
                            Found in src/Illuminate/Foundation/Console/PolicyMakeCommand.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language