Code Duplication    Length = 7-9 lines in 5 locations

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

@@ 358-364 (lines=7) @@
355
        $value = str_replace("'", '"', $value);
356
        $conditions = ["{$not} MATCH(SearchDatasets.words) AGAINST('{$value}' IN BOOLEAN MODE)"];
357
358
        if ($token->where() === 'or') {
359
            $query->orWhere($conditions);
360
        } elseif ($token->where() === 'and') {
361
            $query->andWhere($conditions);
362
        } else {
363
            $query->where($conditions);
364
        }
365
366
        return $query;
367
    }

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

@@ 319-327 (lines=9) @@
316
            $conditions = ['Contents.promote {$conjunction}' => 0];
317
        }
318
319
        if (!empty($conditions)) {
320
            if ($token->where() === 'or') {
321
                $query->orWhere($conditions);
322
            } elseif ($token->where() === 'and') {
323
                $query->andWhere($conditions);
324
            } else {
325
                $query->where($conditions);
326
            }
327
        }
328
329
        return $query;
330
    }
@@ 391-399 (lines=9) @@
388
                })
389
        ];
390
391
        if (!empty($conditions)) {
392
            if ($token->where() === 'or') {
393
                $query->orWhere($conditions);
394
            } elseif ($token->where() === 'and') {
395
                $query->andWhere($conditions);
396
            } else {
397
                $query->where($conditions);
398
            }
399
        }
400
401
        return $query;
402
    }