public static function getDatabaseConfig($database)
    {
        $cached = self::$cache[$database] ?? null;
        if ($cached !== null) {
            return $cached;
        }

        if (self::$config === null) {
            throw new \BadMethodCallException('Config was not loaded');
        }
        if (!array_key_exists($database, self::$config['databases'])) {
            throw new \LogicException("Unknown database '$database'");
        }

        $data = self::$config['databases'][$database];
        if (is_string($data)) {
            $data = ['database_name' => $data];
        }

        $server = $data['server'] ?? 'default';
        $servers = self::$config['servers'] ?? [];
        if (array_key_exists($server, $servers)) {
            unset($data['server']);
            $data = array_merge($servers[$server], $data);
        }

        self::$cache[$database] = $data;
        return $data;
    }
public static function getDatabaseConfig($database)
    {
        $cached = self::$cache[$database] ?? null;
        if ($cached !== null) {
            return $cached;
        }

        if (self::$config === null) {
            throw new \BadMethodCallException('Config was not loaded');
        }
        if (!array_key_exists($database, self::$config['databases'])) {
            throw new \LogicException("Unknown database '$database'");
        }

        $data = self::$config['databases'][$database];
        if (is_string($data)) {
            $data = ['database_name' => $data];
        }

        $server = $data['server'] ?? 'default';
        $servers = self::$config['servers'] ?? [];
        if (array_key_exists($server, $servers)) {
            unset($data['server']);
            $data = array_merge($servers[$server], $data);
        }

        self::$cache[$database] = $data;
        return $data;
    }
public static function getDatabaseConfig ( $ database ) { $ cached = self :: $ cache [ $ database ] ?? null ; if ( $ cached !== null ) { return $ cached ; } if ( self :: $ config === null ) { throw new \ BadMethodCallException ( 'Config was not loaded' ) ; } if ( ! array_key_exists ( $ database , self :: $ config [ 'databases' ] ) ) { throw new \ LogicException ( "Unknown database '$database'" ) ; } $ data = self :: $ config [ 'databases' ] [ $ database ] ; if ( is_string ( $ data ) ) { $ data = [ 'database_name' => $ data ] ; } $ server = $ data [ 'server' ] ?? 'default' ; $ servers = self :: $ config [ 'servers' ] ?? [ ] ; if ( array_key_exists ( $ server , $ servers ) ) { unset ( $ data [ 'server' ] ) ; $ data = array_merge ( $ servers [ $ server ] , $ data ) ; } self :: $ cache [ $ database ] = $ data ; return $ data ; }
Returns data for Medoo connect to a Database

@param string $database Key for a database in the config

@return array

@throws \BadMethodCallException If called before loadConfig()
@throws \LogicException         If database is not in config
Returns data for Medoo connect to a Database