Code Duplication    Length = 13-13 lines in 4 locations

src/Intraface/modules/shop/BasketEvaluation.php 2 locations

@@ 258-270 (lines=13) @@
255
                    $evaluate = (int)$basket->getTotalWeight();
256
                    settype($evaluation['evaluate_value'], 'integer');
257
                    break;
258
                case 'customer_coupon':
259
                    settype($customer['customer_coupon'], 'string');
260
                    if ($evaluation['evaluate_value_case_sensitive'] != 1) {
261
                        $evaluate = strtolower(trim($customer['customer_coupon']));
262
                        $evaluation['evaluate_value'] = strtolower($evaluation['evaluate_value']);
263
                    } else {
264
                        $evaluate = trim($customer['customer_coupon']);
265
                    }
266
                    // coupons can only be evaluated as 'equals' or 'different from'
267
                    if ($evaluation['evaluate_method'] != 'equals' && $evaluation['evaluate_method'] != 'different_from') {
268
                        $evaluation['evaluate_method'] = 'different_from';
269
                    }
270
                    break;
271
                case 'customer_country':
272
                    settype($customer['country'], 'string');
273
                    if ($evaluation['evaluate_value_case_sensitive'] != 1) {
@@ 271-283 (lines=13) @@
268
                        $evaluation['evaluate_method'] = 'different_from';
269
                    }
270
                    break;
271
                case 'customer_country':
272
                    settype($customer['country'], 'string');
273
                    if ($evaluation['evaluate_value_case_sensitive'] != 1) {
274
                        $evaluate = strtolower(trim($customer['country']));
275
                        $evaluation['evaluate_value'] = strtolower($evaluation['evaluate_value']);
276
                    } else {
277
                        $evaluate = trim($customer['country']);
278
                    }
279
                    // country can only be evaluated as 'equals' or 'different from'
280
                    if ($evaluation['evaluate_method'] != 'equals' && $evaluation['evaluate_method'] != 'different_from') {
281
                        $evaluation['evaluate_method'] = 'different_from';
282
                    }
283
                    break;
284
                case 'customer_country_region':
285
                    settype($customer['country'], 'string');
286
                    

src/Intraface/modules/webshop/BasketEvaluation.php 2 locations

@@ 264-276 (lines=13) @@
261
                    $evaluate = (int)$basket->getTotalWeight();
262
                    settype($evaluation['evaluate_value'], 'integer');
263
                    break;
264
                case 'customer_coupon':
265
                    settype($customer['customer_coupon'], 'string');
266
                    if ($evaluation['evaluate_value_case_sensitive'] != 1) {
267
                        $evaluate = strtolower(trim($customer['customer_coupon']));
268
                        $evaluation['evaluate_value'] = strtolower($evaluation['evaluate_value']);
269
                    } else {
270
                        $evaluate = trim($customer['customer_coupon']);
271
                    }
272
                    // coupons can only be evaluated as 'equals' or 'different from'
273
                    if ($evaluation['evaluate_method'] != 'equals' && $evaluation['evaluate_method'] != 'different_from') {
274
                        $evaluation['evaluate_method'] = 'different_from';
275
                    }
276
                    break;
277
                case 'customer_country':
278
                    settype($customer['country'], 'string');
279
                    if ($evaluation['evaluate_value_case_sensitive'] != 1) {
@@ 277-289 (lines=13) @@
274
                        $evaluation['evaluate_method'] = 'different_from';
275
                    }
276
                    break;
277
                case 'customer_country':
278
                    settype($customer['country'], 'string');
279
                    if ($evaluation['evaluate_value_case_sensitive'] != 1) {
280
                        $evaluate = strtolower(trim($customer['country']));
281
                        $evaluation['evaluate_value'] = strtolower($evaluation['evaluate_value']);
282
                    } else {
283
                        $evaluate = trim($customer['country']);
284
                    }
285
                    // country can only be evaluated as 'equals' or 'different from'
286
                    if ($evaluation['evaluate_method'] != 'equals' && $evaluation['evaluate_method'] != 'different_from') {
287
                        $evaluation['evaluate_method'] = 'different_from';
288
                    }
289
                    break;
290
                default:
291
                    throw new Exception("Invalid evaluation_target in BasketEvaluation->run");
292
                    return false;