Code Duplication    Length = 16-18 lines in 5 locations

Bootstrap/Update.php 5 locations

@@ 482-498 (lines=17) @@
479
        }
480
    }
481
482
    private function recreateRemoteCategoriesAndProductAssignments()
483
    {
484
        if (version_compare($this->version, '1.1.4', '<=')) {
485
            try {
486
                if (!$this->existsConfig('recreateConnectCategories')) {
487
                    $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`) VALUES ("recreateConnectCategories", "0")');
488
                }
489
            } catch (\Exception $e) {
490
                // ignore it if exists
491
                $this->logger->write(
492
                    true,
493
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
494
                    $e->getMessage()
495
                );
496
            }
497
        }
498
    }
499
500
    private function setDefaultConfigForUpdateOrderStatus()
501
    {
@@ 500-516 (lines=17) @@
497
        }
498
    }
499
500
    private function setDefaultConfigForUpdateOrderStatus()
501
    {
502
        if (version_compare($this->version, '1.1.7', '<=')) {
503
            try {
504
                if (!$this->existsConfig('updateOrderStatus')) {
505
                    $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("updateOrderStatus", "0", "import")');
506
                }
507
            } catch (\Exception $e) {
508
                // ignore it if exists
509
                $this->logger->write(
510
                    true,
511
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
512
                    $e->getMessage()
513
                );
514
            }
515
        }
516
    }
517
518
    /**
519
      * Create index by articleID in s_plugin_connect_product_to_categories table.
@@ 580-596 (lines=17) @@
577
        }
578
    }
579
580
    private function changeExportStatusToVarchar()
581
    {
582
        if (version_compare($this->version, '1.1.8', '<=')) {
583
            try {
584
                $this->db->query('ALTER TABLE s_plugin_connect_items MODIFY export_status varchar(255)');
585
                $this->db->query('ALTER TABLE s_plugin_connect_items ADD INDEX IDX_revision (revision)');
586
                $this->db->query('ALTER TABLE s_plugin_connect_items ADD INDEX IDX_status (export_status)');
587
            } catch (\Exception $e) {
588
                // ignore it if exists
589
                $this->logger->write(
590
                    true,
591
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
592
                    $e->getMessage()
593
                );
594
            }
595
        }
596
    }
597
598
    private function addArticleRelationsTable()
599
    {
@@ 625-642 (lines=18) @@
622
        }
623
    }
624
625
    private function addOverwriteMainImage()
626
    {
627
        if (version_compare($this->version, '1.1.8', '<=')) {
628
            try {
629
                if (!$this->existsConfig('overwriteProductMainImage')) {
630
                    $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("overwriteProductMainImage", "1", "import")');
631
                }
632
                $this->db->query('ALTER TABLE `s_plugin_connect_items` ADD COLUMN `update_main_image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL');
633
            } catch (\Exception $e) {
634
                // ignore it if exists
635
                $this->logger->write(
636
                    true,
637
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
638
                    $e->getMessage()
639
                );
640
            }
641
        }
642
    }
643
644
    private function changeGroupNameImportSettings()
645
    {
@@ 678-693 (lines=16) @@
675
        }
676
    }
677
678
    private function addConfigForBasketRemovals()
679
    {
680
        if (version_compare($this->version, '1.1.18', '<=')) {
681
            try {
682
                if (!$this->existsConfig('removeBasketAdditions')) {
683
                    $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("removeBasketAdditions", "1", "import")');
684
                }
685
            } catch (\Exception $e) {
686
                $this->logger->write(
687
                    true,
688
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
689
                    $e->getMessage()
690
                );
691
            }
692
        }
693
    }
694
695
    /**
696
     * @param string $configName