Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories
Register::normalize_url
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.
Returns
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() Register::normalize url code WC 10.7.0
private function normalize_url( string $url ): string {
$url = untrailingslashit( trim( $url ) );
return ( new URL( $url ) )->get_url();
}