Showing 30 of 34 total issues
Method attach
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Mapper $mapper,
array $parents,
array $children,
string $onMatch,
bool $detachOther,
Method makeAttachmentExtraFields
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ModelInterface $parent,
ModelInterface $child,
$parentKey,
$childKey,
callable $extraFieldsMaker = null,
Method setAttachments
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
$parents,
string $relationName,
$children,
bool $keepOther = false,
callable $getAttachmentData = null,
Method attach
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Mapper $mapper,
array $parents,
array $children,
string $onMatch,
bool $detachOther,
Method addModelsConstraintToQuery
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ModelQuery $query,
string $parentField,
string $childField,
string $childClass,
array $models
Method addModelConstraintToQuery
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ModelQuery $query,
string $parentField,
string $childField,
string $childClass,
ModelInterface $model
Method addClauseConstraintToQuery
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ModelQuery $query,
string $parentField,
string $childField,
string $childClass,
\Closure $clause = null
Method addConstraintToQuery
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ModelQuery $query,
string $parentField,
string $childField,
string $childClass,
$constraint
Function collectModelsCyclicRelatives
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function collectModelsCyclicRelatives(array $models, string $relation): array
{
// The goal is to track the list of unique models
// We can't index the relatives list by models identifiers because a model can have no identifier
// Using SplObjectStorage is the faster than using in_array or spl_object_hash: https://3v4l.org/h6YA6
- 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 deleteModelsOfSameClass
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function deleteModelsOfSameClass(array $models)
{
$sampleModel = reset($models);
$identifierField = $sampleModel::getIdentifierField();
$ids = [];
- 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"