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.

Метод класса: 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.

Code of Register::normalize_url() WC 7.1.0

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