Code Duplication    Length = 20-21 lines in 2 locations

Subscribers/Lifecycle.php 2 locations

@@ 331-351 (lines=21) @@
328
     * @param \Shopware\Models\Article\Detail $detail
329
     * @param bool $force
330
     */
331
    private function generateChangesForDetail(\Shopware\Models\Article\Detail $detail, $force = false)
332
    {
333
        $attribute = $this->helper->getConnectAttributeByModel($detail);
334
        if (!$detail->getActive() && $this->config->getConfig('excludeInactiveProducts')) {
335
            $this->connectExport->syncDeleteDetail($detail);
336
337
            return;
338
        }
339
340
        if ($this->autoUpdateProducts == 1 || $force === true) {
341
            $this->connectExport->export(
342
                [$attribute->getSourceId()], null
343
            );
344
        } elseif ($this->autoUpdateProducts == 2) {
345
            $this->manager->getConnection()->update(
346
                's_plugin_connect_items',
347
                ['cron_update' => 1],
348
                ['article_detail_id' => $detail->getId()]
349
            );
350
        }
351
    }
352
353
    /**
354
     * @param \Shopware\Models\Article\Article $article
@@ 357-376 (lines=20) @@
354
     * @param \Shopware\Models\Article\Article $article
355
     * @param bool $force
356
     */
357
    private function generateChangesForArticle(\Shopware\Models\Article\Article $article, $force = false)
358
    {
359
        if (!$article->getActive() && $this->config->getConfig('excludeInactiveProducts')) {
360
            $this->connectExport->setDeleteStatusForVariants($article);
361
362
            return;
363
        }
364
365
        if ($this->autoUpdateProducts == 1 || $force === true) {
366
            $sourceIds = $this->helper->getSourceIdsFromArticleId($article->getId());
367
368
            $this->connectExport->export($sourceIds, null);
369
        } elseif ($this->autoUpdateProducts == 2) {
370
            $this->manager->getConnection()->update(
371
                's_plugin_connect_items',
372
                ['cron_update' => 1],
373
                ['article_id' => $article->getId()]
374
            );
375
        }
376
    }
377
378
    /**
379
     * Sends the new order status when supplier change it