Code Duplication    Length = 12-12 lines in 2 locations

lib/Base.php 2 locations

@@ 74-85 (lines=12) @@
71
        }
72
    }
73
74
    public static function getDbName ($database = NULL) {
75
        global $config;
76
        if (self::isMultipleDatabaseEnabled ()) {
77
            if (is_null ($database)) $database = GetUrlParam (DB, 0);
78
            if (!is_null($database) && !preg_match('/^\d+$/', $database)) {
79
                self::error ($database);
80
            }
81
            $array = array_keys ($config['calibre_directory']);
82
            return  $array[$database];
83
        }
84
        return "";
85
    }
86
87
    public static function getDbDirectory ($database = NULL) {
88
        global $config;
@@ 87-98 (lines=12) @@
84
        return "";
85
    }
86
87
    public static function getDbDirectory ($database = NULL) {
88
        global $config;
89
        if (self::isMultipleDatabaseEnabled ()) {
90
            if (is_null ($database)) $database = GetUrlParam (DB, 0);
91
            if (!is_null($database) && !preg_match('/^\d+$/', $database)) {
92
                self::error ($database);
93
            }
94
            $array = array_values ($config['calibre_directory']);
95
            return  $array[$database];
96
        }
97
        return $config['calibre_directory'];
98
    }
99
100
101
    public static function getDbFileName ($database = NULL) {