Code Duplication    Length = 7-9 lines in 5 locations

plugins/Search/src/Operator/GenericOperator.php 1 location

@@ 87-93 (lines=7) @@
84
            "{$tableAlias}.{$column} {$conjunction}" => $value,
85
        ];
86
87
        if ($token->where() === 'or') {
88
            $query->orWhere($conditions);
89
        } elseif ($token->where() === 'and') {
90
            $query->andWhere($conditions);
91
        } else {
92
            $query->where($conditions);
93
        }
94
95
        return $query;
96
    }

plugins/Search/src/Operator/RangeOperator.php 1 location

@@ 74-80 (lines=7) @@
71
            $conditions = ["{$tableAlias}.{$column} {$cmp}" => $range['lower']];
72
        }
73
74
        if ($token->where() === 'or') {
75
            $query->orWhere($conditions);
76
        } elseif ($token->where() === 'and') {
77
            $query->andWhere($conditions);
78
        } else {
79
            $query->where($conditions);
80
        }
81
82
        return $query;
83
    }

plugins/Content/src/Model/Table/ContentsTable.php 2 locations

@@ 312-320 (lines=9) @@
309
            $conditions = ['Contents.promote {$conjunction}' => 0];
310
        }
311
312
        if (!empty($conditions)) {
313
            if ($token->where() === 'or') {
314
                $query->orWhere($conditions);
315
            } elseif ($token->where() === 'and') {
316
                $query->andWhere($conditions);
317
            } else {
318
                $query->where($conditions);
319
            }
320
        }
321
322
        return $query;
323
    }
@@ 384-392 (lines=9) @@
381
                })
382
        ];
383
384
        if (!empty($conditions)) {
385
            if ($token->where() === 'or') {
386
                $query->orWhere($conditions);
387
            } elseif ($token->where() === 'and') {
388
                $query->andWhere($conditions);
389
            } else {
390
                $query->where($conditions);
391
            }
392
        }
393
394
        return $query;
395
    }

plugins/Search/src/Engine/Generic/GenericEngine.php 1 location

@@ 463-469 (lines=7) @@
460
        $value = str_replace("'", '"', $value);
461
        $conditions = ["{$not} MATCH(SearchDatasets.words) AGAINST('{$value}' IN BOOLEAN MODE) > 0"];
462
463
        if ($token->where() === 'or') {
464
            $query->orWhere($conditions);
465
        } elseif ($token->where() === 'and') {
466
            $query->andWhere($conditions);
467
        } else {
468
            $query->where($conditions);
469
        }
470
471
        return $query;
472
    }