Code Duplication    Length = 15-16 lines in 4 locations

Bootstrap/Update.php 4 locations

@@ 491-505 (lines=15) @@
488
        }
489
    }
490
491
    private function setDefaultConfigForUpdateOrderStatus()
492
    {
493
        if (version_compare($this->version, '1.1.7', '<=')) {
494
            try {
495
                $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("updateOrderStatus", "0", "import")');
496
            } catch (\Exception $e) {
497
                // ignore it if exists
498
                $this->logger->write(
499
                    true,
500
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
501
                    $e->getMessage()
502
                );
503
            }
504
        }
505
    }
506
507
  /**
508
     * Create index by articleID in s_plugin_connect_product_to_categories table.
@@ 475-489 (lines=15) @@
472
        }
473
    }
474
475
    private function recreateRemoteCategoriesAndProductAssignments()
476
    {
477
        if (version_compare($this->version, '1.1.4', '<=')) {
478
            try {
479
                $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`) VALUES ("recreateConnectCategories", "0")');
480
            } catch (\Exception $e) {
481
                // ignore it if exists
482
                $this->logger->write(
483
                    true,
484
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
485
                    $e->getMessage()
486
                );
487
            }
488
        }
489
    }
490
491
    private function setDefaultConfigForUpdateOrderStatus()
492
    {
@@ 510-524 (lines=15) @@
507
  /**
508
     * Create index by articleID in s_plugin_connect_product_to_categories table.
509
     */
510
    private function addProductToCategoryIndex()
511
    {
512
        if (version_compare($this->version, '1.1.7', '<=')) {
513
            try {
514
                $this->db->query('ALTER TABLE s_plugin_connect_product_to_categories ADD INDEX article_id(articleID)');
515
            } catch (\Exception $e) {
516
                // ignore it if exists
517
                $this->logger->write(
518
                    true,
519
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
520
                    $e->getMessage()
521
                );
522
            }
523
        }
524
    }
525
526
    private function addShopIdToConnectCategories()
527
    {
@@ 545-560 (lines=16) @@
542
        }
543
    }
544
545
    private function addOverwriteMainImage()
546
    {
547
        if (version_compare($this->version, '1.1.8', '<=')) {
548
            try {
549
                $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("overwriteProductMainImage", "1", "import")');
550
                $this->db->query('ALTER TABLE `s_plugin_connect_items` ADD COLUMN `update_main_image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL');
551
            } catch (\Exception $e) {
552
                // ignore it if exists
553
                $this->logger->write(
554
                    true,
555
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
556
                    $e->getMessage()
557
                );
558
            }
559
        }
560
    }
561
}
562