squirrelphp/queries

View on GitHub

Showing 38 of 38 total issues

File DBConvertStructuredQueryToSQL.php has 405 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Squirrel\Queries\Doctrine;

use Squirrel\Debug\Debug;
Severity: Minor
Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 5 hrs to fix

    File DBAbstractImplementation.php has 326 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Squirrel\Queries\Doctrine;
    
    use Doctrine\DBAL\Connection;
    Severity: Minor
    Found in src/Doctrine/DBAbstractImplementation.php - About 3 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if (
                      \str_contains($expression, ' ')
                      || \str_contains($expression, '=')
                      || \str_contains($expression, '<')
                      || \str_contains($expression, '>')
      Severity: Critical
      Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 3 hrs to fix

        Function buildChanges has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public function buildChanges(array $changes, array $queryValues): array
            {
                // List of finished change expressions, to be imploded with ,
                $changesList = [];
        
        
        Severity: Minor
        Found in src/Doctrine/DBConvertStructuredQueryToSQL.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 verifyAndProcessOptions has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function verifyAndProcessOptions(array $validOptions, array $options): array
            {
                // Convert "table" to "tables"
                if (
                    isset($options['table'])
        Severity: Major
        Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 3 hrs to fix

          Function verifyAndProcessOptions has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              public function verifyAndProcessOptions(array $validOptions, array $options): array
              {
                  // Convert "table" to "tables"
                  if (
                      isset($options['table'])
          Severity: Minor
          Found in src/Doctrine/DBConvertStructuredQueryToSQL.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

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

              public function buildWhere(array $whereOptions, array $queryValues = []): array
              {
                  // If no WHERE restrictions are defined, we just do "WHERE 1"
                  if (\count($whereOptions) === 0) {
                      return ['1', $queryValues];
          Severity: Minor
          Found in src/Doctrine/DBConvertStructuredQueryToSQL.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

          DBAbstractImplementation has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          abstract class DBAbstractImplementation implements DBRawInterface
          {
              protected DBConvertStructuredQueryToSQL $structuredQueryConverter;
          
              /**
          Severity: Minor
          Found in src/Doctrine/DBAbstractImplementation.php - About 2 hrs to fix

            Function buildFieldSelection has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public function buildFieldSelection(array $fields): string
                {
                    // No fields mean we select all fields!
                    if (\count($fields) === 0) {
                        return '*';
            Severity: Minor
            Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 2 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 transactionExecute has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function transactionExecute(
                    callable $func,
                    array $arguments,
                    array $connectionRetries,
                    array $lockRetries,
            Severity: Major
            Found in src/Doctrine/DBErrorHandler.php - About 2 hrs to fix

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

                  public function buildChanges(array $changes, array $queryValues): array
                  {
                      // List of finished change expressions, to be imploded with ,
                      $changesList = [];
              
              
              Severity: Major
              Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 2 hrs to fix

                Function transactionExecute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function transactionExecute(
                        callable $func,
                        array $arguments,
                        array $connectionRetries,
                        array $lockRetries,
                Severity: Minor
                Found in src/Doctrine/DBErrorHandler.php - About 2 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

                Function buildOrderBy has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function buildOrderBy(array $orderOptions): string
                    {
                        // List of finished WHERE expressions, to be imploded with ANDs
                        $orderProcessed = [];
                
                
                Severity: Minor
                Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 2 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 buildWhere has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function buildWhere(array $whereOptions, array $queryValues = []): array
                    {
                        // If no WHERE restrictions are defined, we just do "WHERE 1"
                        if (\count($whereOptions) === 0) {
                            return ['1', $queryValues];
                Severity: Major
                Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 2 hrs to fix

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

                      public function buildFieldSelection(array $fields): string
                      {
                          // No fields mean we select all fields!
                          if (\count($fields) === 0) {
                              return '*';
                  Severity: Minor
                  Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 1 hr to fix

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

                        public function buildGroupBy(array $groupByOptions): string
                        {
                            // List of finished WHERE expressions, to be imploded with ANDs
                            $groupByProcessed = [];
                    
                    
                    Severity: Minor
                    Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 1 hr to fix

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

                          public function buildOrderBy(array $orderOptions): string
                          {
                              // List of finished WHERE expressions, to be imploded with ANDs
                              $orderProcessed = [];
                      
                      
                      Severity: Minor
                      Found in src/Doctrine/DBConvertStructuredQueryToSQL.php - About 1 hr to fix

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

                            protected function internalCall(
                                string $name,
                                array $arguments,
                                array $connectionRetries,
                                array $lockRetries,
                        Severity: Minor
                        Found in src/Doctrine/DBErrorHandler.php - About 1 hr to fix

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

                              protected function convertStructuredSelectToQuery(array $select): array
                              {
                                  // Make sure all options are correctly defined
                                  $select = $this->structuredQueryConverter->verifyAndProcessOptions([
                                      'fields' => [],
                          Severity: Minor
                          Found in src/Doctrine/DBAbstractImplementation.php - About 1 hr to fix

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

                                public function buildGroupBy(array $groupByOptions): string
                                {
                                    // List of finished WHERE expressions, to be imploded with ANDs
                                    $groupByProcessed = [];
                            
                            
                            Severity: Minor
                            Found in src/Doctrine/DBConvertStructuredQueryToSQL.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

                            Severity
                            Category
                            Status
                            Source
                            Language