Code Duplication    Length = 32-32 lines in 2 locations

Components/ProductFromShop.php 2 locations

@@ 621-652 (lines=32) @@
618
        }
619
    }
620
621
    private function markStreamsAsNotExported()
622
    {
623
        $streamIds = $this->manager->getConnection()->executeQuery(
624
            'SELECT pcs.stream_id as streamId
625
             FROM s_plugin_connect_streams as pcs
626
             WHERE export_status = ?',
627
            [ProductStreamService::STATUS_DELETE]
628
        )->fetchAll();
629
630
        foreach ($streamIds as $stream) {
631
            $streamId = $stream['streamId'];
632
633
            $notDeleted = $this->manager->getConnection()->executeQuery(
634
                'SELECT pss.id
635
                 FROM s_product_streams_selection as pss
636
                 JOIN s_plugin_connect_items as pci
637
                 ON pss.article_id = pci.article_id
638
                 WHERE pss.stream_id = ?
639
                 AND pci.export_status != ?',
640
                [$streamId, null]
641
            )->fetchAll();
642
643
            if (count($notDeleted) === 0) {
644
                $this->manager->getConnection()->executeQuery(
645
                    'UPDATE s_plugin_connect_streams
646
                     SET export_status = ?
647
                     WHERE stream_id = ?',
648
                    [null, $streamId]
649
                );
650
            }
651
        }
652
    }
653
654
    private function markStreamsAsSynced()
655
    {
@@ 654-685 (lines=32) @@
651
        }
652
    }
653
654
    private function markStreamsAsSynced()
655
    {
656
        $streamIds = $this->manager->getConnection()->executeQuery(
657
            'SELECT pcs.stream_id as streamId
658
             FROM s_plugin_connect_streams as pcs
659
             WHERE export_status = ?',
660
            [ProductStreamService::STATUS_EXPORT]
661
        )->fetchAll();
662
663
        foreach ($streamIds as $stream) {
664
            $streamId = $stream['streamId'];
665
666
            $notExported = $this->manager->getConnection()->executeQuery(
667
                'SELECT pss.id
668
                 FROM s_product_streams_selection as pss
669
                 JOIN s_plugin_connect_items as pci
670
                 ON pss.article_id = pci.article_id
671
                 WHERE pss.stream_id = ?
672
                 AND pci.export_status != ?',
673
                [$streamId, Attribute::STATUS_SYNCED]
674
            )->fetchAll();
675
676
            if (count($notExported) === 0) {
677
                $this->manager->getConnection()->executeQuery(
678
                    'UPDATE s_plugin_connect_streams
679
                     SET export_status = ?
680
                     WHERE stream_id = ?',
681
                    [ProductStreamService::STATUS_SYNCED, $streamId]
682
                );
683
            }
684
        }
685
    }
686
687
    /**
688
     * @param Address $address