Automattic\WooCommerce\Internal\Admin\Settings

Utils::trim_php_file_extensionpublic staticWC 1.0

Trim the .php file extension from a path.

Method of the class: Utils{}

No Hooks.

Returns

String. The trimmed path. If the path does not end with .php, it will be returned as is.

Usage

$result = Utils::trim_php_file_extension( $path ): string;
$path(string) (required)
The path to trim.

Utils::trim_php_file_extension() code WC 10.9.4

public static function trim_php_file_extension( string $path ): string {
	if ( ! empty( $path ) && str_ends_with( $path, '.php' ) ) {
		$path = substr( $path, 0, - 4 );
	}

	return $path;
}