Code Duplication    Length = 9-10 lines in 2 locations

system/modules/Ecommerce/Ecommerce.php 2 locations

@@ 260-268 (lines=9) @@
257
                            $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['max'], '<='];
258
                        }
259
                        break;
260
                    case 'options':
261
                        foreach ($filter as $optionId => $optionValue) {
262
                            $optionId = (int) $optionId;
263
                            $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
264
                                'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
265
                                'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = ' . \App::$cur->db->connection->pdo->quote($optionValue) . '',
266
                                'inner', 'option' . $optionId];
267
                        }
268
                        break;
269
                    case 'offerOptions':
270
                        //$selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = offer.' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'left', 'offer'];
271
                        foreach ($filter as $optionId => $optionValue) {
@@ 269-278 (lines=10) @@
266
                                'inner', 'option' . $optionId];
267
                        }
268
                        break;
269
                    case 'offerOptions':
270
                        //$selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = offer.' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'left', 'offer'];
271
                        foreach ($filter as $optionId => $optionValue) {
272
                            $optionId = (int) $optionId;
273
                            $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index() . ' = ' . 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer::index() . ' AND ' .
274
                                'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer\Option::index() . ' = "' . (int) $optionId . '" AND ' .
275
                                'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . 'value = ' . \App::$cur->db->connection->pdo->quote($optionValue) . '',
276
                                'inner', 'offerOption' . $optionId];
277
                        }
278
                        break;
279
                }
280
            }
281
        }