propelorm/Propel2

View on GitHub
src/Propel/Runtime/ActiveQuery/ModelCriteria.php

Summary

Maintainability
F
1 wk
Test Coverage

File ModelCriteria.php has 1073 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
Severity: Major
Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 2 days to fix

    ModelCriteria has 86 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ModelCriteria extends BaseModelCriteria
    {
        const FORMAT_STATEMENT  = '\Propel\Runtime\Formatter\StatementFormatter';
        const FORMAT_ARRAY      = '\Propel\Runtime\Formatter\ArrayFormatter';
        const FORMAT_OBJECT     = '\Propel\Runtime\Formatter\ObjectFormatter';
    Severity: Major
    Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 day to fix

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

          public function __call($name, $arguments)
          {
              // Maybe it's a magic call to one of the methods supporting it, e.g. 'findByTitle'
              static $methods = ['findBy', 'findOneBy', 'requireOneBy', 'filterBy', 'orderBy', 'groupBy'];
              foreach ($methods as $method) {
      Severity: Minor
      Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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

      Function getCriterionForClause has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getCriterionForClause($clause, $value, $bindingType = null)
          {
              $origin = $clause = trim($clause);
              if ($this->replaceNames($clause)) {
                  // at least one column name was found and replaced in the clause
      Severity: Minor
      Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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

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

          protected function getColumnFromName($phpName, $failSilently = true)
          {
              if (false === strpos($phpName, '.')) {
                  $prefix = $this->getModelAliasOrName();
              } else {
      Severity: Minor
      Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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 doUpdate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function doUpdate($values, ConnectionInterface $con, $forceIndividualSaves = false)
          {
              if ($forceIndividualSaves) {
      
                  // Update rows one by one
      Severity: Minor
      Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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 __call has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __call($name, $arguments)
          {
              // Maybe it's a magic call to one of the methods supporting it, e.g. 'findByTitle'
              static $methods = ['findBy', 'findOneBy', 'requireOneBy', 'filterBy', 'orderBy', 'groupBy'];
              foreach ($methods as $method) {
      Severity: Minor
      Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

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

            protected function getColumnFromName($phpName, $failSilently = true)
            {
                if (false === strpos($phpName, '.')) {
                    $prefix = $this->getModelAliasOrName();
                } else {
        Severity: Minor
        Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

          Method join has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function join($relation, $joinType = Criteria::INNER_JOIN)
              {
                  // relation looks like '$leftName.$relationName $relationAlias'
                  list($fullName, $relationAlias) = self::getClassAndAlias($relation);
                  if (false === strpos($fullName, '.')) {
          Severity: Minor
          Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

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

                protected function convertValueForColumn($value, ColumnMap $colMap)
                {
                    if ($colMap->getType() == 'OBJECT' && is_object($value)) {
                        if (is_array($value)) {
                            $value = array_map('serialize', $value);
            Severity: Minor
            Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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 getCriterionForClause has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function getCriterionForClause($clause, $value, $bindingType = null)
                {
                    $origin = $clause = trim($clause);
                    if ($this->replaceNames($clause)) {
                        // at least one column name was found and replaced in the clause
            Severity: Minor
            Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

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

                  public function getParams()
                  {
                      $params = [];
                      $dbMap = Propel::getServiceContainer()->getDatabaseMap($this->getDbName());
              
              
              Severity: Minor
              Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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 join has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function join($relation, $joinType = Criteria::INNER_JOIN)
                  {
                      // relation looks like '$leftName.$relationName $relationAlias'
                      list($fullName, $relationAlias) = self::getClassAndAlias($relation);
                      if (false === strpos($fullName, '.')) {
              Severity: Minor
              Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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 doUpdate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function doUpdate($values, ConnectionInterface $con, $forceIndividualSaves = false)
                  {
                      if ($forceIndividualSaves) {
              
                          // Update rows one by one
              Severity: Minor
              Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

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

                    public function getParams()
                    {
                        $params = [];
                        $dbMap = Propel::getServiceContainer()->getDatabaseMap($this->getDbName());
                
                
                Severity: Minor
                Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

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

                      public function addJoinCondition($name, $clause, $value = null, $operator = null, $bindingType = null)
                  Severity: Minor
                  Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 35 mins to fix

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

                        public function groupByClass($class)
                        {
                            if ($class == $this->getModelAliasOrName()) {
                                // column of the Criteria's model
                                $tableMap = $this->getTableMap();
                    Severity: Minor
                    Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Avoid too many return statements within this method.
                    Open

                            return new CustomCriterion($this, $clause);
                    Severity: Major
                    Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return new BasicModelCriterion($this, $clause, $colMap, $value, $this->currentAlias);
                      Severity: Major
                      Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return new SeveralModelCriterion($this, $clause, $colMap, $value, $this->currentAlias);
                        Severity: Major
                        Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return new RawCriterion($this, $clause, $value, $bindingType);
                          Severity: Major
                          Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return [null, $phpName];
                            Severity: Major
                            Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return [null, null];
                              Severity: Major
                              Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 30 mins to fix

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

                                    public function configureSelectColumns()
                                    {
                                        if (is_null($this->select)) {
                                            // leave early
                                            return;
                                Severity: Minor
                                Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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 doReplaceNameInExpression has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function doReplaceNameInExpression($matches)
                                    {
                                        $key = $matches[0];
                                        list($column, $realFullColumnName) = $this->getColumnFromName($key);
                                
                                
                                Severity: Minor
                                Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 25 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                There are no issues that match your filters.

                                Category
                                Status