private function validateDatabaseDetails($environment)
    {
        $db_config = [];
        $configFile = DIR_CONFIG_SITE . '/database.php';
        $environmentConfig = DIR_CONFIG_SITE . "/{$environment}.database.php";

        // If the database.php file exists, load it first
        if (file_exists($configFile)) {
            $db_config = include DIR_CONFIG_SITE . '/database.php';
        }

        // If there's an environment specific database file, load that too
        if (file_exists($environmentConfig)) {
            $db_config = array_merge($db_config, include $environmentConfig);
        }

        // Make sure the default connection is set
        $defaultConnection = array_get($db_config, 'default-connection');

        // Make sure we have all the stuff we expect
        $connection = array_get($db_config, "connections.{$defaultConnection}");

        // Make sure we have all the keys we are expecting
        return $defaultConnection && $connection &&
            array_get($connection, 'database') &&
            array_get($connection, 'username') &&
            array_get($connection, 'server');
    }