Code Duplication    Length = 19-19 lines in 2 locations

src/voku/db/Helper.php 2 locations

@@ 25-43 (lines=19) @@
22
   *
23
   * @return int
24
   */
25
  public static function optimizeTables(array $tables = [], DB $dbConnection = null): int
26
  {
27
    if ($dbConnection === null) {
28
      $dbConnection = DB::getInstance();
29
    }
30
31
    $optimized = 0;
32
    if (!empty($tables)) {
33
      foreach ($tables as $table) {
34
        $optimize = 'OPTIMIZE TABLE ' . $dbConnection->quote_string($table);
35
        $result = $dbConnection->query($optimize);
36
        if ($result) {
37
          $optimized++;
38
        }
39
      }
40
    }
41
42
    return $optimized;
43
  }
44
45
  /**
46
   * Repair tables
@@ 53-71 (lines=19) @@
50
   *
51
   * @return int
52
   */
53
  public static function repairTables(array $tables = [], DB $dbConnection = null): int
54
  {
55
    if ($dbConnection === null) {
56
      $dbConnection = DB::getInstance();
57
    }
58
59
    $optimized = 0;
60
    if (!empty($tables)) {
61
      foreach ($tables as $table) {
62
        $optimize = 'REPAIR TABLE ' . $dbConnection->quote_string($table);
63
        $result = $dbConnection->query($optimize);
64
        if ($result) {
65
          $optimized++;
66
        }
67
      }
68
    }
69
70
    return $optimized;
71
  }
72
73
  /**
74
   * Check if "mysqlnd"-driver is used.