Code Duplication    Length = 20-21 lines in 2 locations

Subscribers/Lifecycle.php 2 locations

@@ 360-380 (lines=21) @@
357
     * @param \Shopware\Models\Article\Detail $detail
358
     * @param bool $force
359
     */
360
    private function generateChangesForDetail(\Shopware\Models\Article\Detail $detail, $force = false)
361
    {
362
        $attribute = $this->helper->getConnectAttributeByModel($detail);
363
        if (!$detail->getActive() && $this->config->getConfig('excludeInactiveProducts')) {
364
            $this->connectExport->syncDeleteDetail($detail);
365
366
            return;
367
        }
368
369
        if ($this->isAutoUpdateEnabled($force)) {
370
            $this->connectExport->export(
371
                [$attribute->getSourceId()], null
372
            );
373
        } elseif ($this->autoUpdateProducts == Config::UPDATE_CRON_JOB) {
374
            $this->manager->getConnection()->update(
375
                's_plugin_connect_items',
376
                ['cron_update' => 1],
377
                ['article_detail_id' => $detail->getId()]
378
            );
379
        }
380
    }
381
382
    /**
383
     * @param \Shopware\Models\Article\Article $article
@@ 386-405 (lines=20) @@
383
     * @param \Shopware\Models\Article\Article $article
384
     * @param bool $force
385
     */
386
    private function generateChangesForArticle(\Shopware\Models\Article\Article $article, $force = false)
387
    {
388
        if (!$article->getActive() && $this->config->getConfig('excludeInactiveProducts')) {
389
            $this->connectExport->setDeleteStatusForVariants($article);
390
391
            return;
392
        }
393
394
        if ($this->isAutoUpdateEnabled($force)) {
395
            $sourceIds = $this->helper->getSourceIdsFromArticleId($article->getId());
396
397
            $this->connectExport->export($sourceIds, null);
398
        } elseif ($this->autoUpdateProducts == Config::UPDATE_CRON_JOB) {
399
            $this->manager->getConnection()->update(
400
                's_plugin_connect_items',
401
                ['cron_update' => 1],
402
                ['article_id' => $article->getId()]
403
            );
404
        }
405
    }
406
407
    /**
408
     * @param bool $force