Doctrine\DBAL\DriverManager::parseDatabaseUrlScheme PHP Method

parseDatabaseUrlScheme() private static method

Parses the scheme part from given connection URL and resolves the given connection parameters.
private static parseDatabaseUrlScheme ( array $url, array $params ) : array
$url array The connection URL parts to evaluate.
$params array The connection parameters to resolve.
return array The resolved connection parameters.
    private static function parseDatabaseUrlScheme(array $url, array $params)
    {
        if (isset($url['scheme'])) {
            // The requested driver from the URL scheme takes precedence
            // over the default custom driver from the connection parameters (if any).
            unset($params['driverClass']);
            // URL schemes must not contain underscores, but dashes are ok
            $driver = str_replace('-', '_', $url['scheme']);
            // The requested driver from the URL scheme takes precedence
            // over the default driver from the connection parameters (if any).
            $params['driver'] = isset(self::$driverSchemeAliases[$driver]) ? self::$driverSchemeAliases[$driver] : $driver;
            return $params;
        }
        // If a schemeless connection URL is given, we require a default driver or default custom driver
        // as connection parameter.
        if (!isset($params['driverClass']) && !isset($params['driver'])) {
            throw DBALException::driverRequired($params['url']);
        }
        return $params;
    }