propelorm/Propel2

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

Summary

Maintainability
D
2 days
Test Coverage

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

<?php

/**
 * 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 4 hrs to fix

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

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

      Function getClassesForTable has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getClassesForTable(Table $table, array $classTargets = null)
          {
              if (null === $classTargets) {
                  $classTargets = $this->classTargets;
              }
      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 fixNamespaceDeclarations has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public function fixNamespaceDeclarations($source)
          {
              $source = $this->forceNamespace($source);
      
              if (!function_exists('token_get_all')) {
      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 buildClasses has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function buildClasses(array $classTargets = null, $separate = false)
          {
              $classes = $classTargets === null ? ['tablemap', 'object', 'query', 'objectstub', 'querystub'] : $classTargets;
      
              $dirHash = substr(sha1(getcwd()), 0, 10);
      Severity: Minor
      Found in src/Propel/Generator/Util/QuickBuilder.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 getClassesForTable has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

            public function buildClasses(array $classTargets = null, $separate = false)
            {
                $classes = $classTargets === null ? ['tablemap', 'object', 'query', 'objectstub', 'querystub'] : $classTargets;
        
                $dirHash = substr(sha1(getcwd()), 0, 10);
        Severity: Minor
        Found in src/Propel/Generator/Util/QuickBuilder.php - About 1 hr to fix

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

              public function fixNamespaceDeclarations($source)
              {
                  $source = $this->forceNamespace($source);
          
                  if (!function_exists('token_get_all')) {
          Severity: Minor
          Found in src/Propel/Generator/Util/QuickBuilder.php - About 1 hr to fix

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

                public function buildSQL(ConnectionInterface $con)
                {
                    $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 buildSchema has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function buildSchema($schema, $dsn = null, $user = null, $pass = null, $adapter = null)
            Severity: Minor
            Found in src/Propel/Generator/Util/QuickBuilder.php - About 35 mins to fix

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

                  public function build($dsn = null, $user = null, $pass = null, $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($classTargets = null)
                    {
                        $tables = [];
                        foreach ($this->getDatabase()->getTables() as $table) {
                            if (count($tables) > 3) break;
                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

                There are no issues that match your filters.

                Category
                Status