File ModelCriteria.php
has 1184 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
ModelCriteria
has 96 functions (exceeds 20 allowed). Consider refactoring. Open
class ModelCriteria extends BaseModelCriteria
{
/**
* @var string
*/
Function getCriterionForClause
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected function getCriterionForClause(string $clause, $value, ?int $bindingType = null): AbstractCriterion
{
$origin = $clause = trim($clause);
if ($this->replaceNames($clause)) {
// at least one column name was found and replaced in the clause
- Read upRead up
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 21 (exceeds 5 allowed). Consider refactoring. Open
public function doUpdate($updateValues, ConnectionInterface $con, bool $forceIndividualSaves = false): int
{
if ($forceIndividualSaves) {
if ($updateValues instanceof Criteria) {
throw new LogicException('Parameter #1 `$updateValues` must be an array while `$forceIndividualSaves = true`.');
- Read upRead up
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 __call
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function __call(string $name, array $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 $methodName) {
- Read upRead up
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 19 (exceeds 5 allowed). Consider refactoring. Open
protected function getColumnFromName(string $columnName, bool $failSilently = true): array
{
if (strpos($columnName, '.') === false) {
$prefix = (string)$this->getModelAliasOrName();
} else {
- Read upRead up
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 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __call(string $name, array $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 $methodName) {
Method getColumnFromName
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getColumnFromName(string $columnName, bool $failSilently = true): array
{
if (strpos($columnName, '.') === false) {
$prefix = (string)$this->getModelAliasOrName();
} else {
Method join
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function join(string $relation, string $joinType = Criteria::INNER_JOIN)
{
// relation looks like '$leftName.$relationName $relationAlias'
[$fullName, $relationAlias] = self::getClassAndAlias($relation);
if (strpos($fullName, '.') === false) {
Method getCriterionForClause
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getCriterionForClause(string $clause, $value, ?int $bindingType = null): AbstractCriterion
{
$origin = $clause = trim($clause);
if ($this->replaceNames($clause)) {
// at least one column name was found and replaced in the clause
Function join
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function join(string $relation, string $joinType = Criteria::INNER_JOIN)
{
// relation looks like '$leftName.$relationName $relationAlias'
[$fullName, $relationAlias] = self::getClassAndAlias($relation);
if (strpos($fullName, '.') === false) {
- Read upRead up
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 getParams
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getParams(): array
{
$params = [];
$dbMap = Propel::getServiceContainer()->getDatabaseMap($this->getDbName());
- Read upRead up
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 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doUpdate($updateValues, ConnectionInterface $con, bool $forceIndividualSaves = false): int
{
if ($forceIndividualSaves) {
if ($updateValues instanceof Criteria) {
throw new LogicException('Parameter #1 `$updateValues` must be an array while `$forceIndividualSaves = true`.');
Function convertValueForColumn
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function convertValueForColumn($value, ColumnMap $colMap)
{
if ($colMap->getType() === 'OBJECT' && is_object($value)) {
$value = serialize($value);
} elseif ($colMap->getType() === 'ARRAY' && is_array($value)) {
- Read upRead up
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 getParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getParams(): array
{
$params = [];
$dbMap = Propel::getServiceContainer()->getDatabaseMap($this->getDbName());
Function configureSelectColumns
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function configureSelectColumns(): void
{
if (!$this->select) {
return;
}
- Read upRead up
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 findOneOrCreate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function findOneOrCreate(?ConnectionInterface $con = null)
{
if ($this->joins) {
throw new PropelException(__METHOD__ . ' cannot be used on a query with a join, because Propel cannot transform a SQL JOIN into a subquery. You should split the query in two queries to avoid joins.');
}
- Read upRead up
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 addJoinCondition
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function addJoinCondition(string $name, string $clause, $value = null, ?string $operator = null, ?int $bindingType = null)
Method useAbstractInnerQueryCriterion
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $abstractInnerQueryCriterionClass,
string $relationName,
?string $modelAlias = null,
?string $queryClass = null,
?string $operatorDeclaration = null
Function groupByClass
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function groupByClass(string $class)
{
if ($class == $this->getModelAliasOrName()) {
// column of the Criteria's model
$tableMap = $this->getTableMap();
- Read upRead up
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 addSelectQuery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addSelectQuery(Criteria $subQueryCriteria, ?string $alias = null, bool $addAliasAndSelectColumns = true)
{
if (!$subQueryCriteria->hasSelectClause()) {
$subQueryCriteria->addSelfSelectColumns();
}
- Read upRead up
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 BasicModelCriterion($this, $clause, $colMap, $value, $this->currentAlias);
Avoid too many return
statements within this method. Open
return new CustomCriterion($this, $clause);
Avoid too many return
statements within this method. Open
return [null, null];
Avoid too many return
statements within this method. Open
return new RawCriterion($this, $clause, $value, $bindingType);
Avoid too many return
statements within this method. Open
return new SeveralModelCriterion($this, $clause, $colMap, $value, $this->currentAlias);