squirrelphp/entities

View on GitHub
src/MultiRepositoryReadOnly.php

Summary

Maintainability
F
1 wk
Test Coverage
A
100%

File MultiRepositoryReadOnly.php has 819 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Squirrel\Entities;

use Squirrel\Debug\Debug;
Severity: Major
Found in src/MultiRepositoryReadOnly.php - About 1 day to fix

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

        private function buildFieldSelection(
            array $selectOptions,
            array $objectToTableFields,
            array $objectTypes,
            array $objectTypesNullable,
    Severity: Minor
    Found in src/MultiRepositoryReadOnly.php - About 1 day 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 processOptions has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function processOptions(array $validOptions, array $options, bool $writing = false): array
        {
            // Reset DB class - needs to be set by the current options
            $dbInstance = null;
    
    
    Severity: Minor
    Found in src/MultiRepositoryReadOnly.php - About 1 day 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 processOptions has 186 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function processOptions(array $validOptions, array $options, bool $writing = false): array
        {
            // Reset DB class - needs to be set by the current options
            $dbInstance = null;
    
    
    Severity: Major
    Found in src/MultiRepositoryReadOnly.php - About 7 hrs to fix

      Function preprocessWhere has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function preprocessWhere(array $whereOptions, array $objectToTableFields): array
          {
              // List of finished WHERE expressions, to be imploded with ANDs
              $whereProcessed = [];
      
      
      Severity: Minor
      Found in src/MultiRepositoryReadOnly.php - About 4 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 buildFieldSelection has 103 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function buildFieldSelection(
              array $selectOptions,
              array $objectToTableFields,
              array $objectTypes,
              array $objectTypesNullable,
      Severity: Major
      Found in src/MultiRepositoryReadOnly.php - About 4 hrs to fix

        Function preprocessJoins has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function preprocessJoins(array $tables, array $tableNames, array $objectToTableFields): array
            {
                // List of table selection, needs to be imploded with a comma for SQL query
                $tablesProcessed = [];
        
        
        Severity: Minor
        Found in src/MultiRepositoryReadOnly.php - About 4 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 preprocessOrder has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function preprocessOrder(array $orderOptions, array $objectToTableFields): array
            {
                // List of finished WHERE expressions, to be imploded with ANDs
                $orderProcessed = [];
        
        
        Severity: Minor
        Found in src/MultiRepositoryReadOnly.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 preprocessGroup has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            private function preprocessGroup(array $groupByOptions, array $objectToTableFields): array
            {
                // List of finished WHERE expressions, to be imploded with ANDs
                $groupByProcessed = [];
        
        
        Severity: Minor
        Found in src/MultiRepositoryReadOnly.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 processSelectResult has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            private function processSelectResult(
                array $entry,
                array $selectTypes,
                array $selectTypesNullable,
            ): array {
        Severity: Minor
        Found in src/MultiRepositoryReadOnly.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 preprocessJoins has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function preprocessJoins(array $tables, array $tableNames, array $objectToTableFields): array
            {
                // List of table selection, needs to be imploded with a comma for SQL query
                $tablesProcessed = [];
        
        
        Severity: Major
        Found in src/MultiRepositoryReadOnly.php - About 2 hrs to fix

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

              protected function preprocessWhere(array $whereOptions, array $objectToTableFields): array
              {
                  // List of finished WHERE expressions, to be imploded with ANDs
                  $whereProcessed = [];
          
          
          Severity: Major
          Found in src/MultiRepositoryReadOnly.php - About 2 hrs to fix

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

                private function buildSelectQueryStructured(array $query): array
                {
                    // Process options and make sure all values are valid
                    [
                        $sanitizedOptions,
            Severity: Minor
            Found in src/MultiRepositoryReadOnly.php - About 1 hr to fix

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

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

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

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

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

                      private function processSelectResult(
                          array $entry,
                          array $selectTypes,
                          array $selectTypesNullable,
                      ): array {
                  Severity: Minor
                  Found in src/MultiRepositoryReadOnly.php - About 1 hr to fix

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

                        private function buildSelectQueryFreeform(array $options): array
                        {
                            // Process options and make sure all values are valid
                            [
                                $sanitizedOptions,
                    Severity: Minor
                    Found in src/MultiRepositoryReadOnly.php - About 1 hr to fix

                      Function buildSelectQueryStructured has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function buildSelectQueryStructured(array $query): array
                          {
                              // Process options and make sure all values are valid
                              [
                                  $sanitizedOptions,
                      Severity: Minor
                      Found in src/MultiRepositoryReadOnly.php - About 45 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

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

                              array $selectOptions,
                              array $objectToTableFields,
                              array $objectTypes,
                              array $objectTypesNullable,
                              bool $generateSql = false,
                      Severity: Minor
                      Found in src/MultiRepositoryReadOnly.php - About 35 mins to fix

                        There are no issues that match your filters.

                        Category
                        Status