Code Duplication    Length = 32-32 lines in 2 locations

Components/ProductFromShop.php 2 locations

@@ 582-613 (lines=32) @@
579
        }
580
    }
581
582
    private function markStreamsAsNotExported()
583
    {
584
        $streamIds = $this->manager->getConnection()->executeQuery(
585
            'SELECT pcs.stream_id as streamId
586
             FROM s_plugin_connect_streams as pcs
587
             WHERE export_status = ?',
588
            [ProductStreamService::STATUS_DELETE]
589
        )->fetchAll();
590
591
        foreach ($streamIds as $stream) {
592
            $streamId = $stream['streamId'];
593
594
            $notDeleted = $this->manager->getConnection()->executeQuery(
595
                'SELECT pss.id
596
                 FROM s_product_streams_selection as pss
597
                 JOIN s_plugin_connect_items as pci
598
                 ON pss.article_id = pci.article_id
599
                 WHERE pss.stream_id = ?
600
                 AND pci.export_status != ?',
601
                [$streamId, null]
602
            )->fetchAll();
603
604
            if (count($notDeleted) === 0) {
605
                $this->manager->getConnection()->executeQuery(
606
                    'UPDATE s_plugin_connect_streams
607
                     SET export_status = ?
608
                     WHERE stream_id = ?',
609
                    [null, $streamId]
610
                );
611
            }
612
        }
613
    }
614
615
    private function markStreamsAsSynced()
616
    {
@@ 615-646 (lines=32) @@
612
        }
613
    }
614
615
    private function markStreamsAsSynced()
616
    {
617
        $streamIds = $this->manager->getConnection()->executeQuery(
618
            'SELECT pcs.stream_id as streamId
619
             FROM s_plugin_connect_streams as pcs
620
             WHERE export_status = ?',
621
            [ProductStreamService::STATUS_EXPORT]
622
        )->fetchAll();
623
624
        foreach ($streamIds as $stream) {
625
            $streamId = $stream['streamId'];
626
627
            $notExported = $this->manager->getConnection()->executeQuery(
628
                'SELECT pss.id
629
                 FROM s_product_streams_selection as pss
630
                 JOIN s_plugin_connect_items as pci
631
                 ON pss.article_id = pci.article_id
632
                 WHERE pss.stream_id = ?
633
                 AND pci.export_status != ?',
634
                [$streamId, Attribute::STATUS_SYNCED]
635
            )->fetchAll();
636
637
            if (count($notExported) === 0) {
638
                $this->manager->getConnection()->executeQuery(
639
                    'UPDATE s_plugin_connect_streams
640
                     SET export_status = ?
641
                     WHERE stream_id = ?',
642
                    [ProductStreamService::STATUS_SYNCED, $streamId]
643
                );
644
            }
645
        }
646
    }
647
648
    /**
649
     * @param Address $address