propelorm/Propel2

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

Summary

Maintainability
F
1 mo
Test Coverage

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

    ObjectBuilder has 209 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ObjectBuilder extends AbstractObjectBuilder
    {
        /**
         * Returns the package for the base object classes.
         *
    Severity: Major
    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 4 days to fix

      Method addCrossFKGet has 122 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function addCrossFKGet(string &$script, CrossForeignKeys $crossFKs): void
          {
              $refFK = $crossFKs->getIncomingForeignKey();
              $selfRelationName = $this->getFKPhpNameAffix($refFK, false);
              $crossRefTableName = $crossFKs->getMiddleTable()->getName();
      Severity: Major
      Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 4 hrs to fix

        Method addCrossFkScheduledForDeletion has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function addCrossFkScheduledForDeletion(string &$script, CrossForeignKeys $crossFKs): void
            {
                $multipleFks = 1 < count($crossFKs->getCrossForeignKeys()) || (bool)$crossFKs->getUnclassifiedPrimaryKeys();
                $scheduledForDeletionVarName = $this->getCrossScheduledForDeletionVarName($crossFKs);
                $queryClassName = $this->getNewStubQueryBuilder($crossFKs->getMiddleTable())->getClassname();
        Severity: Major
        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 4 hrs to fix

          Method addDoInsertBodyRaw has 119 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function addDoInsertBodyRaw(): string
              {
                  $this->declareClasses(
                      '\Propel\Runtime\Propel',
                      '\PDO',
          Severity: Major
          Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 4 hrs to fix

            Function addHydrateBody has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function addHydrateBody(string &$script): void
                {
                    $table = $this->getTable();
                    $platform = $this->getPlatform();
            
            
            Severity: Minor
            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addDoSave has 110 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function addDoSave(string &$script): void
                {
                    $table = $this->getTable();
            
                    $reloadOnUpdate = $table->isReloadOnUpdate();
            Severity: Major
            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 4 hrs to fix

              Function addDoInsertBodyRaw has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function addDoInsertBodyRaw(): string
                  {
                      $this->declareClasses(
                          '\Propel\Runtime\Propel',
                          '\PDO',
              Severity: Minor
              Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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

              Method addHydrateBody has 93 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function addHydrateBody(string &$script): void
                  {
                      $table = $this->getTable();
                      $platform = $this->getPlatform();
              
              
              Severity: Major
              Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 3 hrs to fix

                Method addSaveBody has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function addSaveBody(string &$script): void
                    {
                        $table = $this->getTable();
                        $reloadOnUpdate = $table->isReloadOnUpdate();
                        $reloadOnInsert = $table->isReloadOnInsert();
                Severity: Major
                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 3 hrs to fix

                  Function addCrossFkScheduledForDeletion has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function addCrossFkScheduledForDeletion(string &$script, CrossForeignKeys $crossFKs): void
                      {
                          $multipleFks = 1 < count($crossFKs->getCrossForeignKeys()) || (bool)$crossFKs->getUnclassifiedPrimaryKeys();
                          $scheduledForDeletionVarName = $this->getCrossScheduledForDeletionVarName($crossFKs);
                          $queryClassName = $this->getNewStubQueryBuilder($crossFKs->getMiddleTable())->getClassname();
                  Severity: Minor
                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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

                  Method addClassBody has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function addClassBody(string &$script): void
                      {
                          $this->declareClassFromBuilder($this->getStubObjectBuilder());
                          $this->declareClassFromBuilder($this->getStubQueryBuilder());
                          $this->declareClassFromBuilder($this->getTableMapBuilder());
                  Severity: Major
                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 3 hrs to fix

                    Method addToArray has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function addToArray(string &$script): void
                        {
                            $fks = $this->getTable()->getForeignKeys();
                            $referrers = $this->getTable()->getReferrers();
                            $hasFks = count($fks) > 0 || count($referrers) > 0;
                    Severity: Major
                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                      Method addCrossFKDoAdd has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function addCrossFKDoAdd(string &$script, CrossForeignKeys $crossFKs): void
                          {
                              $selfRelationNamePlural = $this->getFKPhpNameAffix($crossFKs->getIncomingForeignKey(), true);
                              $relatedObjectClassName = $this->getCrossFKsPhpNameAffix($crossFKs, false);
                              $className = $this->getClassNameFromTable($crossFKs->getIncomingForeignKey()->getTable());
                      Severity: Major
                      Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

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

                            protected function addDoSave(string &$script): void
                            {
                                $table = $this->getTable();
                        
                                $reloadOnUpdate = $table->isReloadOnUpdate();
                        Severity: Minor
                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addFKAccessor has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function addFKAccessor(string &$script, ForeignKey $fk): void
                            {
                                $varName = $this->getFKVarName($fk);
                                $fkQueryBuilder = $this->getNewStubQueryBuilder($fk->getForeignTable());
                                $fkObjectBuilder = $this->getNewObjectBuilder($fk->getForeignTable())->getStubObjectBuilder();
                        Severity: Major
                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                          Method addLazyLoaderBody has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function addLazyLoaderBody(string &$script, Column $column): void
                              {
                                  $platform = $this->getPlatform();
                                  $clo = $column->getLowercasedName();
                          
                          
                          Severity: Major
                          Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                            Function addMutatorCloseBody has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function addMutatorCloseBody(string &$script, Column $column): void
                                {
                                    $table = $this->getTable();
                            
                                    if ($column->isForeignKey()) {
                            Severity: Minor
                            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addToArray has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function addToArray(string &$script): void
                                {
                                    $fks = $this->getTable()->getForeignKeys();
                                    $referrers = $this->getTable()->getReferrers();
                                    $hasFks = count($fks) > 0 || count($referrers) > 0;
                            Severity: Minor
                            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addCrossFKCount has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function addCrossFKCount(string &$script, CrossForeignKeys $crossFKs): void
                                {
                                    $refFK = $crossFKs->getIncomingForeignKey();
                                    $selfRelationName = $this->getFKPhpNameAffix($refFK, false);
                            
                            
                            Severity: Major
                            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                              Method addReload has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function addReload(string &$script): void
                                  {
                                      $table = $this->getTable();
                                      $script .= "
                                  /**
                              Severity: Major
                              Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                                Method addCrossFKRemove has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function addCrossFKRemove(string &$script, CrossForeignKeys $crossFKs): void
                                    {
                                        $relCol = $this->getCrossFKsPhpNameAffix($crossFKs, true);
                                        if (1 < count($crossFKs->getCrossForeignKeys()) || $crossFKs->getUnclassifiedPrimaryKeys()) {
                                            $collName = 'combination' . ucfirst($this->getCrossFKsVarName($crossFKs));
                                Severity: Major
                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                                  Function addDoInsertBodyWithIdMethod has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      protected function addDoInsertBodyWithIdMethod(): string
                                      {
                                          $table = $this->getTable();
                                          $script = '';
                                          foreach ($table->getPrimaryKey() as $col) {
                                  Severity: Minor
                                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addCopyInto has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function addCopyInto(string &$script): void
                                      {
                                          $table = $this->getTable();
                                  
                                          $script .= "
                                  Severity: Major
                                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

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

                                        protected function addCrossFKInit(string &$script, CrossForeignKeys $crossFKs): void
                                        {
                                            $inits = [];
                                    
                                            if (1 < count($crossFKs->getCrossForeignKeys()) || $crossFKs->getUnclassifiedPrimaryKeys()) {
                                    Severity: Major
                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

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

                                          protected function addClearAllReferences(string &$script): void
                                          {
                                              $table = $this->getTable();
                                              $script .= "
                                          /**
                                      Severity: Major
                                      Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

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

                                            protected function getDefaultValueString(Column $column): string
                                            {
                                                $defaultValue = var_export(null, true);
                                                $val = $column->getPhpDefaultValue();
                                                if ($val === null) {
                                        Severity: Minor
                                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addFKAccessor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function addFKAccessor(string &$script, ForeignKey $fk): void
                                            {
                                                $varName = $this->getFKVarName($fk);
                                                $fkQueryBuilder = $this->getNewStubQueryBuilder($fk->getForeignTable());
                                                $fkObjectBuilder = $this->getNewObjectBuilder($fk->getForeignTable())->getStubObjectBuilder();
                                        Severity: Minor
                                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addFKMutator has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            protected function addFKMutator(string &$script, ForeignKey $fk): void
                                            {
                                                $fkTable = $fk->getForeignTable();
                                                $interface = $fk->getInterface();
                                        
                                        
                                        Severity: Major
                                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                                          Method addCrossFKCreateQuery has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              protected function addCrossFKCreateQuery(string &$script, CrossForeignKeys $crossFKs): void
                                              {
                                                  if (1 <= count($crossFKs->getCrossForeignKeys()) && !$crossFKs->getUnclassifiedPrimaryKeys()) {
                                                      return;
                                                  }
                                          Severity: Major
                                          Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                                            Method addCrossFKSet has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                protected function addCrossFKSet(string &$script, CrossForeignKeys $crossFKs): void
                                                {
                                                    $scheduledForDeletionVarName = $this->getCrossScheduledForDeletionVarName($crossFKs);
                                            
                                                    $multi = 1 < count($crossFKs->getCrossForeignKeys()) || (bool)$crossFKs->getUnclassifiedPrimaryKeys();
                                            Severity: Minor
                                            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

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

                                                  protected function addRefFKGet(string &$script, ForeignKey $refFK): void
                                                  {
                                                      $fkQueryClassName = $this->getClassNameFromBuilder($this->getNewStubQueryBuilder($refFK->getTable()));
                                                      $relCol = $this->getRefFKPhpNameAffix($refFK, true);
                                                      $collName = $this->getRefFKCollVarName($refFK);
                                              Severity: Minor
                                              Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                Function addClassBody has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    protected function addClassBody(string &$script): void
                                                    {
                                                        $this->declareClassFromBuilder($this->getStubObjectBuilder());
                                                        $this->declareClassFromBuilder($this->getStubQueryBuilder());
                                                        $this->declareClassFromBuilder($this->getTableMapBuilder());
                                                Severity: Minor
                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addSetByPosition has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    protected function addSetByPosition(string &$script): void
                                                    {
                                                        $table = $this->getTable();
                                                        $script .= "
                                                    /**
                                                Severity: Minor
                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                  Method addClear has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      protected function addClear(string &$script): void
                                                      {
                                                          $table = $this->getTable();
                                                  
                                                          $script .= "
                                                  Severity: Minor
                                                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                    Function addCopyInto has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                        protected function addCopyInto(string &$script): void
                                                        {
                                                            $table = $this->getTable();
                                                    
                                                            $script .= "
                                                    Severity: Minor
                                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addHashCode has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        protected function addHashCode(string &$script): void
                                                        {
                                                            $script .= "
                                                        /**
                                                         * If the primary key is not null, return the hashcode of the
                                                    Severity: Minor
                                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                      Method addMutatorCloseBody has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          protected function addMutatorCloseBody(string &$script, Column $column): void
                                                          {
                                                              $table = $this->getTable();
                                                      
                                                              if ($column->isForeignKey()) {
                                                      Severity: Minor
                                                      Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                        Method addDoInsertBodyWithIdMethod has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            protected function addDoInsertBodyWithIdMethod(): string
                                                            {
                                                                $table = $this->getTable();
                                                                $script = '';
                                                                foreach ($table->getPrimaryKey() as $col) {
                                                        Severity: Minor
                                                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

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

                                                              protected function getDefaultValueString(Column $column): string
                                                              {
                                                                  $defaultValue = var_export(null, true);
                                                                  $val = $column->getPhpDefaultValue();
                                                                  if ($val === null) {
                                                          Severity: Minor
                                                          Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

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

                                                                protected function addTemporalMutator(string &$script, Column $col): void
                                                                {
                                                                    $clo = $col->getLowercasedName();
                                                            
                                                                    $dateTimeClass = $this->getDateTimeClass($col);
                                                            Severity: Minor
                                                            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                              Method addRefFKRemove has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                  protected function addRefFKRemove(string &$script, ForeignKey $refFK): void
                                                                  {
                                                                      $tblFK = $refFK->getTable();
                                                              
                                                                      $className = $this->getClassNameFromTable($refFK->getTable());
                                                              Severity: Minor
                                                              Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                                Method addRefFKSet has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                    protected function addRefFKSet(string &$script, ForeignKey $refFK): void
                                                                    {
                                                                        $relatedName = $this->getRefFKPhpNameAffix($refFK, true);
                                                                        $relatedObjectClassName = $this->getRefFKPhpNameAffix($refFK, false);
                                                                
                                                                
                                                                Severity: Minor
                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                                  Method addDeleteBody has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                  Open

                                                                      protected function addDeleteBody(string &$script): void
                                                                      {
                                                                          $script .= "
                                                                          if (\$this->isDeleted()) {
                                                                              throw new PropelException(\"This object has already been deleted.\");
                                                                  Severity: Minor
                                                                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

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

                                                                        protected function addSaveBody(string &$script): void
                                                                        {
                                                                            $table = $this->getTable();
                                                                            $reloadOnUpdate = $table->isReloadOnUpdate();
                                                                            $reloadOnInsert = $table->isReloadOnInsert();
                                                                    Severity: Minor
                                                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addCrossFKGet has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                        protected function addCrossFKGet(string &$script, CrossForeignKeys $crossFKs): void
                                                                        {
                                                                            $refFK = $crossFKs->getIncomingForeignKey();
                                                                            $selfRelationName = $this->getFKPhpNameAffix($refFK, false);
                                                                            $crossRefTableName = $crossFKs->getMiddleTable()->getName();
                                                                    Severity: Minor
                                                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addCrossFKInit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                        protected function addCrossFKInit(string &$script, CrossForeignKeys $crossFKs): void
                                                                        {
                                                                            $inits = [];
                                                                    
                                                                            if (1 < count($crossFKs->getCrossForeignKeys()) || $crossFKs->getUnclassifiedPrimaryKeys()) {
                                                                    Severity: Minor
                                                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addCrossFKDoAdd has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                        protected function addCrossFKDoAdd(string &$script, CrossForeignKeys $crossFKs): void
                                                                        {
                                                                            $selfRelationNamePlural = $this->getFKPhpNameAffix($crossFKs->getIncomingForeignKey(), true);
                                                                            $relatedObjectClassName = $this->getCrossFKsPhpNameAffix($crossFKs, false);
                                                                            $className = $this->getClassNameFromTable($crossFKs->getIncomingForeignKey()->getTable());
                                                                    Severity: Minor
                                                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addEnsureConsistency has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                        protected function addEnsureConsistency(string &$script): void
                                                                        {
                                                                            $table = $this->getTable();
                                                                    
                                                                            $script .= "
                                                                    Severity: Minor
                                                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addRefFKGetJoinMethods has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                        protected function addRefFKGetJoinMethods(string &$script, ForeignKey $refFK): void
                                                                        {
                                                                            $table = $this->getTable();
                                                                            $tblFK = $refFK->getTable();
                                                                            $joinBehavior = $this->getBuildProperty('generator.objectModel.useLeftJoinsInDoJoinMethods') ? 'Criteria::LEFT_JOIN' : 'Criteria::INNER_JOIN';
                                                                    Severity: Minor
                                                                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                                      Method addCrossFKAdd has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                      Open

                                                                          protected function addCrossFKAdd(string &$script, CrossForeignKeys $crossFKs): void
                                                                          {
                                                                              $refFK = $crossFKs->getIncomingForeignKey();
                                                                      
                                                                              foreach ($crossFKs->getCrossForeignKeys() as $crossFK) {
                                                                      Severity: Minor
                                                                      Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                                        Function addClearAllReferences has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                            protected function addClearAllReferences(string &$script): void
                                                                            {
                                                                                $table = $this->getTable();
                                                                                $script .= "
                                                                            /**
                                                                        Severity: Minor
                                                                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 getCrossRefFKRemoveObjectNames has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                            protected function getCrossRefFKRemoveObjectNames(CrossForeignKeys $crossFKs, ForeignKey $excludeFK): string
                                                                            {
                                                                                $names = [];
                                                                        
                                                                                $fks = $crossFKs->getCrossForeignKeys();
                                                                        Severity: Minor
                                                                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addClear has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                                        Open

                                                                            protected function addClear(string &$script): void
                                                                            {
                                                                                $table = $this->getTable();
                                                                        
                                                                                $script .= "
                                                                        Severity: Minor
                                                                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addRefFKCount has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                        Open

                                                                            protected function addRefFKCount(string &$script, ForeignKey $refFK): void
                                                                            {
                                                                                $fkQueryClassName = $this->getClassNameFromBuilder($this->getNewStubQueryBuilder($refFK->getTable()));
                                                                                $relCol = $this->getRefFKPhpNameAffix($refFK, true);
                                                                                $collName = $this->getRefFKCollVarName($refFK);
                                                                        Severity: Minor
                                                                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

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

                                                                              protected function addRemoveArrayElement(string &$script, Column $col): void
                                                                              {
                                                                                  $clo = $col->getLowercasedName();
                                                                                  $cfc = $col->getPhpName();
                                                                                  $visibility = $col->getAccessorVisibility();
                                                                          Severity: Minor
                                                                          Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

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

                                                                                protected function addCrossFKIsLoaded(string &$script, CrossForeignKeys $crossFKs): void
                                                                                {
                                                                                    $inits = [];
                                                                            
                                                                                    if (1 < count($crossFKs->getCrossForeignKeys()) || $crossFKs->getUnclassifiedPrimaryKeys()) {
                                                                            Severity: Minor
                                                                            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

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

                                                                                  protected function addHasOnlyDefaultValuesBody(string &$script): void
                                                                                  {
                                                                                      $table = $this->getTable();
                                                                                      $colsWithDefaults = [];
                                                                                      foreach ($table->getColumns() as $col) {
                                                                              Severity: Minor
                                                                              Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                                                                Function addLazyLoaderBody has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addLazyLoaderBody(string &$script, Column $column): void
                                                                                    {
                                                                                        $platform = $this->getPlatform();
                                                                                        $clo = $column->getLowercasedName();
                                                                                
                                                                                
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 55 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 addHasOnlyDefaultValuesBody has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addHasOnlyDefaultValuesBody(string &$script): void
                                                                                    {
                                                                                        $table = $this->getTable();
                                                                                        $colsWithDefaults = [];
                                                                                        foreach ($table->getColumns() as $col) {
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 55 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 addReload has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addReload(string &$script): void
                                                                                    {
                                                                                        $table = $this->getTable();
                                                                                        $script .= "
                                                                                    /**
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 55 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 addApplyDefaultValuesBody has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addApplyDefaultValuesBody(string &$script): void
                                                                                    {
                                                                                        $table = $this->getTable();
                                                                                        // FIXME - Apply support for PHP default expressions here
                                                                                        // see: http://propel.phpdb.org/trac/ticket/378
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addClassOpen has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addClassOpen(string &$script): void
                                                                                    {
                                                                                        $table = $this->getTable();
                                                                                        $tableName = $table->getName();
                                                                                        $tableDesc = $table->getDescription();
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addColumnAttributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addColumnAttributes(string &$script): void
                                                                                    {
                                                                                        $table = $this->getTable();
                                                                                
                                                                                        foreach ($table->getColumns() as $col) {
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addRefFKGetJoinMethods has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addRefFKGetJoinMethods(string &$script, ForeignKey $refFK): void
                                                                                    {
                                                                                        $table = $this->getTable();
                                                                                        $tblFK = $refFK->getTable();
                                                                                        $joinBehavior = $this->getBuildProperty('generator.objectModel.useLeftJoinsInDoJoinMethods') ? 'Criteria::LEFT_JOIN' : 'Criteria::INNER_JOIN';
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addCrossFKCreateQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addCrossFKCreateQuery(string &$script, CrossForeignKeys $crossFKs): void
                                                                                    {
                                                                                        if (1 <= count($crossFKs->getCrossForeignKeys()) && !$crossFKs->getUnclassifiedPrimaryKeys()) {
                                                                                            return;
                                                                                        }
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addFKMutator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addFKMutator(string &$script, ForeignKey $fk): void
                                                                                    {
                                                                                        $fkTable = $fk->getForeignTable();
                                                                                        $interface = $fk->getInterface();
                                                                                
                                                                                
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addCrossFKSet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addCrossFKSet(string &$script, CrossForeignKeys $crossFKs): void
                                                                                    {
                                                                                        $scheduledForDeletionVarName = $this->getCrossScheduledForDeletionVarName($crossFKs);
                                                                                
                                                                                        $multi = 1 < count($crossFKs->getCrossForeignKeys()) || (bool)$crossFKs->getUnclassifiedPrimaryKeys();
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addHashCode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addHashCode(string &$script): void
                                                                                    {
                                                                                        $script .= "
                                                                                    /**
                                                                                     * If the primary key is not null, return the hashcode of the
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addDoInsert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addDoInsert(): string
                                                                                    {
                                                                                        $table = $this->getTable();
                                                                                        $script = "
                                                                                    /**
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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 addColumnAttributeComment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                Open

                                                                                    protected function addColumnAttributeComment(string &$script, Column $column): void
                                                                                    {
                                                                                        if ($column->isTemporalType()) {
                                                                                            $cptype = $this->getDateTimeClass($column);
                                                                                        } else {
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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

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

                                                                                    protected function validateModel(): void
                                                                                    {
                                                                                        parent::validateModel();
                                                                                
                                                                                        $table = $this->getTable();
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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

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

                                                                                    protected function addTemporalMutator(string &$script, Column $col): void
                                                                                    {
                                                                                        $clo = $col->getLowercasedName();
                                                                                
                                                                                        $dateTimeClass = $this->getDateTimeClass($col);
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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

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

                                                                                    protected function addCrossFKIsLoaded(string &$script, CrossForeignKeys $crossFKs): void
                                                                                    {
                                                                                        $inits = [];
                                                                                
                                                                                        if (1 < count($crossFKs->getCrossForeignKeys()) || $crossFKs->getUnclassifiedPrimaryKeys()) {
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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

                                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                Open

                                                                                    protected function addAddArrayElement(string &$script, Column $col): void
                                                                                    {
                                                                                        $clo = $col->getLowercasedName();
                                                                                        $cfc = $col->getPhpName();
                                                                                        $visibility = $col->getAccessorVisibility();
                                                                                Severity: Major
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php and 1 other location - About 4 hrs to fix
                                                                                src/Propel/Generator/Builder/Om/ObjectBuilder.php on lines 2236..2277

                                                                                Duplicated Code

                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                Tuning

                                                                                This issue has a mass of 178.

                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                Refactorings

                                                                                Further Reading

                                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                Open

                                                                                    protected function addRemoveArrayElement(string &$script, Column $col): void
                                                                                    {
                                                                                        $clo = $col->getLowercasedName();
                                                                                        $cfc = $col->getPhpName();
                                                                                        $visibility = $col->getAccessorVisibility();
                                                                                Severity: Major
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php and 1 other location - About 4 hrs to fix
                                                                                src/Propel/Generator/Builder/Om/ObjectBuilder.php on lines 2188..2226

                                                                                Duplicated Code

                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                Tuning

                                                                                This issue has a mass of 178.

                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                Refactorings

                                                                                Further Reading

                                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                Open

                                                                                                    if ($this->getPlatform() instanceof MysqlPlatform) {
                                                                                                        if (in_array($col->getType(), [PropelTypes::TIMESTAMP, PropelTypes::DATETIME], true)) {
                                                                                                            $handleMysqlDate = true;
                                                                                                            $mysqlInvalidDateString = '0000-00-00 00:00:00';
                                                                                                        } elseif ($col->getType() === PropelTypes::DATE) {
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php and 1 other location - About 55 mins to fix
                                                                                src/Propel/Generator/Builder/Om/ObjectBuilder.php on lines 896..905

                                                                                Duplicated Code

                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                Tuning

                                                                                This issue has a mass of 99.

                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                Refactorings

                                                                                Further Reading

                                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                Open

                                                                                        if ($this->getPlatform() instanceof MysqlPlatform) {
                                                                                            if (in_array($column->getType(), [PropelTypes::TIMESTAMP, PropelTypes::DATETIME], true)) {
                                                                                                $handleMysqlDate = true;
                                                                                                $mysqlInvalidDateString = '0000-00-00 00:00:00';
                                                                                            } elseif ($column->getType() === PropelTypes::DATE) {
                                                                                Severity: Minor
                                                                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php and 1 other location - About 55 mins to fix
                                                                                src/Propel/Generator/Builder/Om/ObjectBuilder.php on lines 2716..2725

                                                                                Duplicated Code

                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                Tuning

                                                                                This issue has a mass of 99.

                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                Refactorings

                                                                                Further Reading

                                                                                There are no issues that match your filters.

                                                                                Category
                                                                                Status