Code Duplication    Length = 32-32 lines in 2 locations

Components/ProductFromShop.php 2 locations

@@ 709-740 (lines=32) @@
706
        }
707
    }
708
709
    private function markStreamsAsNotExported()
710
    {
711
        $streamIds = $this->manager->getConnection()->executeQuery(
712
            'SELECT pcs.stream_id as streamId
713
             FROM s_plugin_connect_streams as pcs
714
             WHERE export_status = ?',
715
            [ProductStreamService::STATUS_DELETE]
716
        )->fetchAll();
717
718
        foreach ($streamIds as $stream) {
719
            $streamId = $stream['streamId'];
720
721
            $notDeleted = $this->manager->getConnection()->executeQuery(
722
                'SELECT pss.id
723
                 FROM s_product_streams_selection as pss
724
                 JOIN s_plugin_connect_items as pci
725
                 ON pss.article_id = pci.article_id
726
                 WHERE pss.stream_id = ?
727
                 AND pci.export_status != ?',
728
                [$streamId, null]
729
            )->fetchAll();
730
731
            if (count($notDeleted) === 0) {
732
                $this->manager->getConnection()->executeQuery(
733
                    'UPDATE s_plugin_connect_streams
734
                     SET export_status = ?
735
                     WHERE stream_id = ?',
736
                    [null, $streamId]
737
                );
738
            }
739
        }
740
    }
741
742
    private function markStreamsAsSynced()
743
    {
@@ 742-773 (lines=32) @@
739
        }
740
    }
741
742
    private function markStreamsAsSynced()
743
    {
744
        $streamIds = $this->manager->getConnection()->executeQuery(
745
            'SELECT pcs.stream_id as streamId
746
             FROM s_plugin_connect_streams as pcs
747
             WHERE export_status = ?',
748
            [ProductStreamService::STATUS_EXPORT]
749
        )->fetchAll();
750
751
        foreach ($streamIds as $stream) {
752
            $streamId = $stream['streamId'];
753
754
            $notExported = $this->manager->getConnection()->executeQuery(
755
                'SELECT pss.id
756
                 FROM s_product_streams_selection as pss
757
                 JOIN s_plugin_connect_items as pci
758
                 ON pss.article_id = pci.article_id
759
                 WHERE pss.stream_id = ?
760
                 AND pci.export_status != ?',
761
                [$streamId, Attribute::STATUS_SYNCED]
762
            )->fetchAll();
763
764
            if (count($notExported) === 0) {
765
                $this->manager->getConnection()->executeQuery(
766
                    'UPDATE s_plugin_connect_streams
767
                     SET export_status = ?
768
                     WHERE stream_id = ?',
769
                    [ProductStreamService::STATUS_SYNCED, $streamId]
770
                );
771
            }
772
        }
773
    }
774
775
    /**
776
     * @param ConnectAddress $address