Showing 228 of 247 total issues
Function _renderField
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function _renderField($addAlias = true): string
{
// if no fields were defined, use defaultField
if (($this->args['field'] ?? []) === []) {
if ($this->defaultField instanceof Expression) {
- Read upRead up
- Create a ticketCreate a ticket
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 order
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function order($order, $direction = null)
{
if (is_string($order) && str_contains($order, ',')) {
throw new Exception('Comma-separated fields list is no longer accepted, use array instead');
}
- Read upRead up
- Create a ticketCreate a ticket
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 _load
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function _load(bool $fromReload, bool $fromTryLoad, $id)
{
$this->getModel()->assertHasPersistence();
if ($this->isLoaded()) {
throw new Exception('Entity must be unloaded');
- Read upRead up
- Create a ticketCreate a ticket
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 init
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
#[\Override]
protected function init(): void
{
parent::init();
- Read upRead up
- Create a ticketCreate a ticket
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 isIndexExists
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function isIndexExists(array $fields, bool $requireUnique = false): bool
{
$fields = array_map(fn ($field) => $this->resolvePersistenceField($field), $fields);
$tableName = reset($fields)->getOwner()->table;
- Read upRead up
- Create a ticketCreate a ticket
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 consume
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function consume($expr, string $escapeMode): string
{
if (!is_object($expr)) {
switch ($escapeMode) {
case self::ESCAPE_PARAM:
- Create a ticketCreate a ticket
Method escapeStringLiteral
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
protected function escapeStringLiteral(string $value): string
{
$dummyPersistence = (new \ReflectionClass(Persistence\Sql::class))->newInstanceWithoutConstructor();
if (\Closure::bind(static fn () => $dummyPersistence->explicitCastIsEncodedBinary($value), null, Persistence\Sql::class)()) {
- Create a ticketCreate a ticket
Method getColumnComment
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
protected function getColumnComment(Column $column)
{
$tmpType = new class extends Type {
private Type $type;
- Create a ticketCreate a ticket
Method makeHashFromKey
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function makeHashFromKey($value, ?\HashContext $hashContext = null): ?int
{
if ($hashContext === null) {
$hashContext = hash_init('crc32c');
$return = true;
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (($f === 'system' && $field->system)
|| ($f === 'not system' && !$field->system)
|| ($f === 'editable' && $field->isEditable())
|| ($f === 'visible' && $field->isVisible())
) {
- Create a ticketCreate a ticket
Method _renderConditionBinary
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override] // @phpstan-ignore method.childParameterType (https://github.com/phpstan/phpstan/issues/10942)
protected function _renderConditionBinary(string $operator, string $sqlLeft, $sqlRight): string
{
if (in_array($operator, ['in', 'not in'], true)) {
if (is_array($sqlRight)) {
- Create a ticketCreate a ticket
Method tryLoad
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
public function tryLoad(Model $model, $id): ?array
{
$model->assertIsModel();
- Create a ticketCreate a ticket
Method wrap
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
public function wrap(Driver $driver): Driver
{
return new class($driver) extends AbstractDriverMiddleware {
#[\Override]
- Create a ticketCreate a ticket
Method _renderConditionBinaryReuse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _renderConditionBinaryReuse(
string $sqlLeft,
string $sqlRight,
\Closure $makeSqlFx,
bool $allowReuseLeft = true,
- Create a ticketCreate a ticket
Method _renderConditionLikeOperator
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
protected function _renderConditionLikeOperator(bool $negated, string $sqlLeft, string $sqlRight): string
{
return ($negated ? 'not ' : '') . $this->_renderConditionBinaryReuse(
$sqlLeft,
- Create a ticketCreate a ticket
Method match
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function match(array $row, Model\Scope\AbstractScope $condition): bool
{
if ($condition instanceof Model\Scope\Condition) { // simple condition
$args = $condition->toQueryArguments();
- Create a ticketCreate a ticket
Method initUserActions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function initUserActions(): void
{
// declare our basic CRUD actions for the model
$this->addUserAction('add', [
'fields' => true,
- Create a ticketCreate a ticket
Method deduplicateAnalysingKey
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function deduplicateAnalysingKey(array $analysingKey, object $analysingOwner): array
{
if ((self::$analysingClosureMap ?? null) === null) {
self::$analysingClosureMap = new WeakAnalysingMap();
}
- Create a ticketCreate a ticket
Function restoreSequencesIfDecremented
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function restoreSequencesIfDecremented(array $beforeRollbackSequences): void
{
$afterRollbackSequences = $this->listSequences();
foreach ($beforeRollbackSequences as $schema => $beforeRollbackSequences2) {
- Read upRead up
- Create a ticketCreate a ticket
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 saveRow
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function saveRow(Model $model, array $rowData, $id): void
{
if ($model->idField) {
$idField = $model->getIdField();
$id = $idField->normalize($id);
- Read upRead up
- Create a ticketCreate a ticket
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"