Code Duplication    Length = 29-31 lines in 2 locations

Controllers/Backend/ConnectConfig.php 2 locations

@@ 313-341 (lines=29) @@
310
            $data['priceFieldForPurchasePriceExport'] = 'detailPurchasePrice';
311
        }
312
313
        if ($priceType == \Shopware\Connect\SDK::PRICE_TYPE_BOTH
314
            || $priceType == \Shopware\Connect\SDK::PRICE_TYPE_RETAIL
315
        ) {
316
            /** @var \Shopware\Models\Customer\Group $groupPrice */
317
            $groupPrice = $this->getCustomerGroupRepository()->findOneBy(['key' => $data['priceGroupForPriceExport']]);
318
            if (!$groupPrice) {
319
                $this->View()->assign([
320
                    'success' => false,
321
                    'message' => Shopware()->Snippets()->getNamespace('backend/connect/view/main')->get(
322
                        'config/export/invalid_customer_group',
323
                        'Ungültige Kundengruppe',
324
                        true
325
                    )
326
                ]);
327
328
                return;
329
            }
330
331
            if ($this->getPriceGateway()->countProductsWithConfiguredPrice($groupPrice, $data['priceFieldForPriceExport']) === 0) {
332
                $this->View()->assign([
333
                    'success' => false,
334
                    'message' => Shopware()->Snippets()->getNamespace('backend/connect/view/main')->get(
335
                        'config/export/priceFieldIsNotSupported',
336
                        'Price field is not maintained. Some of the products have price = 0',
337
                        true
338
                    )
339
                ]);
340
341
                return;
342
            }
343
        }
344
@@ 345-375 (lines=31) @@
342
            }
343
        }
344
345
        if ($priceType == \Shopware\Connect\SDK::PRICE_TYPE_BOTH
346
            || $priceType == \Shopware\Connect\SDK::PRICE_TYPE_PURCHASE
347
        ) {
348
            /** @var \Shopware\Models\Customer\Group $groupPurchasePrice */
349
            $groupPurchasePrice = $this->getCustomerGroupRepository()->findOneBy([
350
                'key' => $data['priceGroupForPurchasePriceExport']
351
            ]);
352
            if (!$groupPurchasePrice && !$detailPurchasePrice) {
353
                $this->View()->assign([
354
                    'success' => false,
355
                    'message' => Shopware()->Snippets()->getNamespace('backend/connect/view/main')->get(
356
                        'config/export/invalid_customer_group',
357
                        'Ungültige Kundengruppe',
358
                        true
359
                    )
360
                ]);
361
362
                return;
363
            }
364
365
            if ($this->getPriceGateway()->countProductsWithConfiguredPrice($groupPurchasePrice, $data['priceFieldForPurchasePriceExport']) === 0) {
366
                $this->View()->assign([
367
                    'success' => false,
368
                    'message' => Shopware()->Snippets()->getNamespace('backend/connect/view/main')->get(
369
                        'config/export/priceFieldIsNotSupported',
370
                        'Price field is not maintained. Some of the products have price = 0',
371
                        true
372
                    )
373
                ]);
374
375
                return;
376
            }
377
        }
378