Code Duplication    Length = 19-19 lines in 2 locations

src/voku/db/Helper.php 2 locations

@@ 45-63 (lines=19) @@
42
     *
43
     * @return int
44
     */
45
    public static function optimizeTables(array $tables = [], DB $dbConnection = null): int
46
    {
47
        if ($dbConnection === null) {
48
            $dbConnection = DB::getInstance();
49
        }
50
51
        $optimized = 0;
52
        if (!empty($tables)) {
53
            foreach ($tables as $table) {
54
                $optimize = 'OPTIMIZE TABLE ' . $dbConnection->quote_string($table);
55
                $result = $dbConnection->query($optimize);
56
                if ($result) {
57
                    $optimized++;
58
                }
59
            }
60
        }
61
62
        return $optimized;
63
    }
64
65
    /**
66
     * Repair tables
@@ 73-91 (lines=19) @@
70
     *
71
     * @return int
72
     */
73
    public static function repairTables(array $tables = [], DB $dbConnection = null): int
74
    {
75
        if ($dbConnection === null) {
76
            $dbConnection = DB::getInstance();
77
        }
78
79
        $optimized = 0;
80
        if (!empty($tables)) {
81
            foreach ($tables as $table) {
82
                $optimize = 'REPAIR TABLE ' . $dbConnection->quote_string($table);
83
                $result = $dbConnection->query($optimize);
84
                if ($result) {
85
                    $optimized++;
86
                }
87
            }
88
        }
89
90
        return $optimized;
91
    }
92
93
    /**
94
     * Check if "mysqlnd"-driver is used.