Showing 30 of 34 total issues
File BelongsToMany.php
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Finesse\Wired\Relations;
use Finesse\MiniDB\Database;
Method attach
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function attach(
Mapper $mapper,
array $parents,
array $children,
string $onMatch,
Function updateAttachmentsGroup
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function updateAttachmentsGroup(
$parentId,
$childId,
array $parents,
array $children,
- 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 attach
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function attach(
Mapper $mapper,
array $parents,
array $children,
string $onMatch,
- 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 updateAttachmentsGroup
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function updateAttachmentsGroup(
$parentId,
$childId,
array $parents,
array $children,
Method loadCyclicRelativesForModelsOfSameClass
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loadCyclicRelativesForModelsOfSameClass(
array $models,
string $relationName,
\Closure $clause = null,
bool $onlyMissing = false
Function filterModelRelatives
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function filterModelRelatives(ModelInterface $model, string $relation, callable $filter)
{
if (!$model->doesHaveLoadedRelatives($relation)) {
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
Method loadRelatives
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadRelatives(Mapper $mapper, string $name, array $parents, \Closure $constraint = null)
{
if (!$parents) {
return;
}
Method saveModel
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function saveModel(ModelInterface $model, string $mode)
{
$identifierField = $model::getIdentifierField();
$row = $model->convertToRow();
$doUpdate = false;
Function loadRelatives
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function loadRelatives(Mapper $mapper, string $name, array $parents, \Closure $constraint = null)
{
if (!$parents) {
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
Method filterModelRelatives
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function filterModelRelatives(ModelInterface $model, string $relation, callable $filter)
{
if (!$model->doesHaveLoadedRelatives($relation)) {
return;
}
Function collectModelsRelatives
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function collectModelsRelatives(array $models, string $relation): array
{
$modelsSet = new \SplObjectStorage;
foreach ($models as $model) {
$modelsSet->attach($model);
- 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 loadCyclicRelativesForModelsOfSameClass
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function loadCyclicRelativesForModelsOfSameClass(
array $models,
string $relationName,
\Closure $clause = null,
bool $onlyMissing = 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 loadRelatives
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function loadRelatives(Mapper $mapper, string $name, array $parents, \Closure $constraint = null)
{
if (!$parents) {
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 wrapException
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function wrapException(\Throwable $exception): \Throwable
{
if ($exception instanceof ExceptionInterface) {
return $exception;
}
- 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 loadRelatives
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadRelatives(Mapper $mapper, string $name, array $parents, \Closure $constraint = null)
{
if (!$parents) {
return;
}
Function loadRelativesForModelsOfSameClass
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function loadRelativesForModelsOfSameClass(
array $models,
string $relationName,
\Closure $clause = null,
bool $onlyMissing = 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 saveModel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function saveModel(ModelInterface $model, string $mode)
{
$identifierField = $model::getIdentifierField();
$row = $model->convertToRow();
$doUpdate = 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
Method attachWithDetails
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
$parents,
string $relationName,
$children,
string $onMatch,
bool $detachOther,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $modelClass,
string $pivotParentField,
string $pivotTable,
string $pivotChildField,
string $parentIdentifierField = null,