propelorm/Propel2

View on GitHub
src/Propel/Generator/Builder/Om/AbstractOMBuilder.php

Summary

Maintainability
F
4 days
Test Coverage

File AbstractOMBuilder.php has 580 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: Major
Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 1 day to fix

    AbstractOMBuilder has 50 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class AbstractOMBuilder extends DataModelBuilder
    {
        /**
         * Declared fully qualified classnames, to build the 'namespace' statements
         * according to this table's namespace.
    Severity: Minor
    Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 7 hrs to fix

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

          public function declareClassNamespace($class, $namespace = '', $alias = false)
          {
              $namespace = trim($namespace, '\\');
      
              // check if the class is already declared
      Severity: Minor
      Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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 getCrossFKsPhpNameAffix has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getCrossFKsPhpNameAffix(CrossForeignKeys $crossFKs, $plural = true)
          {
              $names = [];
      
              if ($plural) {
      Severity: Minor
      Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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

      Function needAliasForClassName has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function needAliasForClassName($class, $namespace)
          {
              if ($namespace == $this->getNamespace()) {
                  return false;
              }
      Severity: Minor
      Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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 declareClassNamespace has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function declareClassNamespace($class, $namespace = '', $alias = false)
          {
              $namespace = trim($namespace, '\\');
      
              // check if the class is already declared
      Severity: Minor
      Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 1 hr to fix

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

            public function applyBehaviorModifierBase($hookName, $modifier, &$script, $tab = "        ")
            {
                $modifierGetter = 'get' . $modifier;
                foreach ($this->getTable()->getBehaviors() as $behavior) {
                    $modifier = $behavior->$modifierGetter();
        Severity: Minor
        Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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

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

            public function getUseStatements($ignoredNamespace = null)
            {
                $script = '';
                $declaredClasses = $this->declaredClasses;
                unset($declaredClasses[$ignoredNamespace]);
        Severity: Minor
        Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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

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

            protected static function getRefRelatedBySuffix(ForeignKey $fk)
            {
                $relCol = '';
                foreach ($fk->getMapping() as $mapping) {
                    list($localColumn, $foreignValueOrColumn) = $mapping;
        Severity: Minor
        Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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

        Function extractCrossInformation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function extractCrossInformation(
                CrossForeignKeys $crossFKs,
                $crossFKToIgnore = null,
                &$signature,
                &$shortSignature,
        Severity: Minor
        Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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 extractCrossInformation has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                CrossForeignKeys $crossFKs,
                $crossFKToIgnore = null,
                &$signature,
                &$shortSignature,
                &$normalizedShortSignature,
        Severity: Minor
        Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 45 mins to fix

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

              private function clean($content)
              {
                  // line feed
                  $content = str_replace("\r\n", "\n", $content);
               
          Severity: Minor
          Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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

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

              protected static function getRelatedBySuffix(ForeignKey $fk)
              {
                  $relCol = '';
          
                  foreach ($fk->getMapping() as $mapping) {
          Severity: Minor
          Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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

          Avoid too many return statements within this method.
          Open

                          return true;
          Severity: Major
          Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return true;
            Severity: Major
            Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $this->declareClassNamespace($class, $namespace, $autoAliasName);
              Severity: Major
              Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return false;
                Severity: Major
                Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 30 mins to fix

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

                      protected function getCrossRefFKGetterName(CrossForeignKeys $crossFKs, ForeignKey $excludeFK)
                      {
                          $names = [];
                  
                          $fks = $crossFKs->getCrossForeignKeys();
                  Severity: Minor
                  Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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