propelorm/Propel2

View on GitHub

Showing 693 of 740 total issues

File ObjectCollection.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

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

    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

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

        protected function arrayToDOM(array $array, DOMElement $rootElement, ?string $charset = null): DOMElement
        {
            foreach ($array as $key => $value) {
                if (is_numeric($key)) {
                    $key = $rootElement->nodeName;
    Severity: Minor
    Found in src/Propel/Runtime/Parser/XmlParser.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 addForeignKeys has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function addForeignKeys(Table $table): void
        {
            $database = $table->getDatabase();
    
            /** @var \PDOStatement $stmt */
    Severity: Minor
    Found in src/Propel/Generator/Reverse/SqliteSchemaParser.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 addColumnMutatorMethods has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function addColumnMutatorMethods(string &$script): void
        {
            foreach ($this->getTable()->getColumns() as $col) {
                if ($col->getType() === PropelTypes::OBJECT) {
                    $this->addObjectMutator($script, $col);
    Severity: Minor
    Found in src/Propel/Generator/Builder/Om/AbstractObjectBuilder.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 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 __toString has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __toString(): string
        {
            $tables = [];
            foreach ($this->getTables() as $table) {
                $columns = [];
    Severity: Minor
    Found in src/Propel/Generator/Model/Database.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 compareForeignKeys has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function compareForeignKeys(bool $caseInsensitive = false): int
        {
            $fkDifferences = 0;
            $fromTableFks = $this->getFromTable()->getForeignKeys();
            $toTableFks = $this->getToTable()->getForeignKeys();
    Severity: Minor
    Found in src/Propel/Generator/Model/Diff/TableComparator.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 addMakeSlugUnique has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function addMakeSlugUnique(string &$script): void
        {
            $script .= "
    
    /**
    Severity: Major
    Found in src/Propel/Generator/Behavior/Sluggable/SluggableBehavior.php - About 2 hrs to fix

      Method parseTables has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function parseTables(array &$tableWraps, Database $database, ?Table $filterTable = null): void
          {
              $params = [];
      
              $sql = "
      Severity: Major
      Found in src/Propel/Generator/Reverse/PgsqlSchemaParser.php - About 2 hrs to fix

        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

          File SluggableBehavior.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Method addFixLevels has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function addFixLevels(string &$script): void
                {
                    $objectClassName = $this->objectClassName;
                    $queryClassName = $this->queryClassName;
                    $tableMapClassName = $this->tableMapClassName;

              File ArchivableBehavior.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                Consider simplifying this complex logical expression.
                Open

                            if (
                                $this->offset === $criteria->getOffset()
                                && $this->limit === $criteria->getLimit()
                                && $this->ignoreCase === $criteria->isIgnoreCase()
                                && $this->singleRecord === $criteria->isSingleRecord()
                Severity: Critical
                Found in src/Propel/Runtime/ActiveQuery/Criteria.php - About 2 hrs to fix

                  AbstractCriterion has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  abstract class AbstractCriterion
                  {
                      /**
                       * @var string
                       */
                  Severity: Minor
                  Found in src/Propel/Runtime/ActiveQuery/Criterion/AbstractCriterion.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

                      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 loadDataModels has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function loadDataModels(): void
                            {
                                $schemas = [];
                                $totalNbTables = 0;
                                $dataModelFiles = $this->getSchemas();
                        Severity: Major
                        Found in src/Propel/Generator/Manager/AbstractManager.php - About 2 hrs to fix

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

                              public function mergeWith(self $criteria, ?string $operator = null)
                              {
                                  // merge limit
                                  $limit = $criteria->getLimit();
                                  if ($limit && $this->getLimit() === -1) {
                          Severity: Minor
                          Found in src/Propel/Runtime/ActiveQuery/Criteria.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

                          Severity
                          Category
                          Status
                          Source
                          Language