PHPMailer\PHPMailer

DSNConfigurator::parseUrlprotectedWP 1.0

Parse a URL. Wrapper for the built-in parse_url function to work around a bug in PHP 5.5.

Method of the class: DSNConfigurator{}

No Hooks.

Returns

Array|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->parseUrl( $url );
$url(string) (required)
URL.

DSNConfigurator::parseUrl() code WP 6.9.1

protected function parseUrl($url)
{
    if (\PHP_VERSION_ID >= 50600 || false === strpos($url, '?')) {
        return parse_url($url);
    }

    $chunks = explode('?', $url);
    if (is_array($chunks)) {
        $result = parse_url($chunks[0]);
        if (is_array($result)) {
            $result['query'] = $chunks[1];
        }
        return $result;
    }

    return false;
}