Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories

Register::normalize_url()privateWC 1.0

Normalizes the provided URL, by trimming whitespace per normal PHP conventions and removing any trailing slashes. If it lacks a scheme, the file scheme is assumed and prepended.

Method of the class: Register{}

No Hooks.

Return

String.

Usage

// private - for code of main (parent) class only
$result = $this->normalize_url( $url ): string;
$url(string) (required)
The URL to be normalized.

Register::normalize_url() code WC 8.7.0

private function normalize_url( string $url ): string {
	$url = untrailingslashit( trim( $url ) );
	return ( new URL( $url ) )->get_url();
}