propelorm/Propel2

View on GitHub
src/Propel/Generator/Util/QuickBuilder.php

Summary

Maintainability
D
2 days
Test Coverage

File QuickBuilder.php has 388 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * MIT License. This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
Severity: Minor
Found in src/Propel/Generator/Util/QuickBuilder.php - About 5 hrs to fix

    QuickBuilder has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class QuickBuilder
    {
        use VfsTrait;
    
        /**
    Severity: Minor
    Found in src/Propel/Generator/Util/QuickBuilder.php - About 3 hrs to fix

      Function fixNamespaceDeclarations has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function fixNamespaceDeclarations(string $source): string
          {
              $cooperativeLexems = [T_WHITESPACE, T_NS_SEPARATOR, T_STRING];
      
              if (PHP_VERSION_ID >= 80000) {
      Severity: Minor
      Found in src/Propel/Generator/Util/QuickBuilder.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 getClassesForTable has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getClassesForTable(Table $table, ?array $classTargets = null): string
          {
              $classTargets = $classTargets ?? $this->classTargets;
              $script = '';
      
      
      Severity: Minor
      Found in src/Propel/Generator/Util/QuickBuilder.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 fixNamespaceDeclarations has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function fixNamespaceDeclarations(string $source): string
          {
              $cooperativeLexems = [T_WHITESPACE, T_NS_SEPARATOR, T_STRING];
      
              if (PHP_VERSION_ID >= 80000) {
      Severity: Minor
      Found in src/Propel/Generator/Util/QuickBuilder.php - About 1 hr to fix

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

            public function getClassesForTable(Table $table, ?array $classTargets = null): string
            {
                $classTargets = $classTargets ?? $this->classTargets;
                $script = '';
        
        
        Severity: Minor
        Found in src/Propel/Generator/Util/QuickBuilder.php - About 1 hr to fix

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

              public function updateDB(ConnectionInterface $con): ?Database
              {
                  $database = $this->readConnectedDatabase();
                  $diff = DatabaseComparator::computeDiff($database, $this->database);
          
          
          Severity: Minor
          Found in src/Propel/Generator/Util/QuickBuilder.php - About 1 hr to fix

            Method buildSchema has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    string $schema,
                    ?string $dsn = null,
                    ?string $user = null,
                    ?string $pass = null,
                    ?AdapterInterface $adapter = null,
            Severity: Minor
            Found in src/Propel/Generator/Util/QuickBuilder.php - About 45 mins to fix

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

                  public function buildSQL(ConnectionInterface $con): int
                  {
                      $sql = $this->getSQL();
                      $statements = SqlParser::parseString($sql);
                      foreach ($statements as $statement) {
              Severity: Minor
              Found in src/Propel/Generator/Util/QuickBuilder.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 build has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      ?string $dsn = null,
                      ?string $user = null,
                      ?string $pass = null,
                      ?AdapterInterface $adapter = null,
                      ?array $classTargets = null
              Severity: Minor
              Found in src/Propel/Generator/Util/QuickBuilder.php - About 35 mins to fix

                Function getBuildName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getBuildName(?array $classTargets = null): string
                    {
                        $tables = [];
                        foreach ($this->getDatabase()->getTables() as $table) {
                            if (count($tables) > 3) {
                Severity: Minor
                Found in src/Propel/Generator/Util/QuickBuilder.php - About 35 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

                Function updateDB has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function updateDB(ConnectionInterface $con): ?Database
                    {
                        $database = $this->readConnectedDatabase();
                        $diff = DatabaseComparator::computeDiff($database, $this->database);
                
                
                Severity: Minor
                Found in src/Propel/Generator/Util/QuickBuilder.php - About 25 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

                There are no issues that match your filters.

                Category
                Status