squirrelphp/entities

View on GitHub

Showing 59 of 59 total issues

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

    File RepositoryReadOnly.php has 504 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Squirrel\Entities;
    
    use Squirrel\Debug\Debug;
    Severity: Major
    Found in src/RepositoryReadOnly.php - About 1 day to fix

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

            public function __invoke(string $fileContents): array
            {
                // List of classes, each entry has the namespace as first element and the
                // class name as the second element
                $classes = [];
        Severity: Minor
        Found in src/Generate/FindClassesWithAttribute.php - About 7 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 __invoke has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __invoke(): array
            {
                /** @var list<string> $logRepositories */
                $logRepositories = [];
                /** @var list<string> $logConflicts */
        Severity: Minor
        Found in src/Generate/RepositoriesGenerateCommand.php - About 5 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 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 process has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function process(object|string $class): ?RepositoryConfigInterface
              {
                  // Get class reflection data
                  $reflectionClass = new \ReflectionClass($class);
          
          
          Severity: Minor
          Found in src/Attribute/EntityProcessor.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 castOneTableVariable has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function castOneTableVariable(mixed $value, ?string $fieldName = null, bool $isChange = false): int|float|string|LargeObject|null
              {
                  // Only scalar values and null are allowed
                  if (!\is_null($value) && !\is_scalar($value)) {
                      throw Debug::createException(
          Severity: Major
          Found in src/RepositoryReadOnly.php - About 2 hrs to fix

            Function preprocessOrder has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function preprocessOrder(array $orderOptions): array
                {
                    // Order SQL parts
                    $orderProcessed = [];
            
            
            Severity: Minor
            Found in src/RepositoryReadOnly.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 withRepositories has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function withRepositories(array $repositories): self
                {
                    // Connection to use for transaction
                    $connection = null;
            
            
            Severity: Minor
            Found in src/Transaction.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 __invoke has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __invoke(string $fileContents): array
                  {
                      // List of classes, each entry has the namespace as first element and the
                      // class name as the second element
                      $classes = [];
              Severity: Major
              Found in src/Generate/FindClassesWithAttribute.php - About 2 hrs to fix

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

                    public static function withRepositories(array $repositories): self
                    {
                        // Connection to use for transaction
                        $connection = null;
                
                
                Severity: Major
                Found in src/Transaction.php - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language