Code Duplication    Length = 32-32 lines in 2 locations

Components/ProductFromShop.php 2 locations

@@ 563-594 (lines=32) @@
560
        }
561
    }
562
563
    private function markStreamsAsNotExported()
564
    {
565
        $streamIds = $this->manager->getConnection()->executeQuery(
566
            'SELECT pcs.stream_id as streamId
567
             FROM s_plugin_connect_streams as pcs
568
             WHERE export_status = ?',
569
            [ProductStreamService::STATUS_DELETE]
570
        )->fetchAll();
571
572
        foreach ($streamIds as $stream) {
573
            $streamId = $stream['streamId'];
574
575
            $notDeleted = $this->manager->getConnection()->executeQuery(
576
                'SELECT pss.id
577
                 FROM s_product_streams_selection as pss
578
                 JOIN s_plugin_connect_items as pci
579
                 ON pss.article_id = pci.article_id
580
                 WHERE pss.stream_id = ?
581
                 AND pci.export_status != ?',
582
                [$streamId, null]
583
            )->fetchAll();
584
585
            if (count($notDeleted) === 0) {
586
                $this->manager->getConnection()->executeQuery(
587
                    'UPDATE s_plugin_connect_streams
588
                     SET export_status = ?
589
                     WHERE stream_id = ?',
590
                    [null, $streamId]
591
                );
592
            }
593
        }
594
    }
595
596
    private function markStreamsAsSynced()
597
    {
@@ 596-627 (lines=32) @@
593
        }
594
    }
595
596
    private function markStreamsAsSynced()
597
    {
598
        $streamIds = $this->manager->getConnection()->executeQuery(
599
            'SELECT pcs.stream_id as streamId
600
             FROM s_plugin_connect_streams as pcs
601
             WHERE export_status = ?',
602
            [ProductStreamService::STATUS_EXPORT]
603
        )->fetchAll();
604
605
        foreach ($streamIds as $stream) {
606
            $streamId = $stream['streamId'];
607
608
            $notExported = $this->manager->getConnection()->executeQuery(
609
                'SELECT pss.id
610
                 FROM s_product_streams_selection as pss
611
                 JOIN s_plugin_connect_items as pci
612
                 ON pss.article_id = pci.article_id
613
                 WHERE pss.stream_id = ?
614
                 AND pci.export_status != ?',
615
                [$streamId, Attribute::STATUS_SYNCED]
616
            )->fetchAll();
617
618
            if (count($notExported) === 0) {
619
                $this->manager->getConnection()->executeQuery(
620
                    'UPDATE s_plugin_connect_streams
621
                     SET export_status = ?
622
                     WHERE stream_id = ?',
623
                    [ProductStreamService::STATUS_SYNCED, $streamId]
624
                );
625
            }
626
        }
627
    }
628
629
    /**
630
     * @param Address $address