Code Duplication    Length = 32-32 lines in 2 locations

Components/ProductFromShop.php 2 locations

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