Automattic\WooCommerce\Utilities

StringUtil::class_name_without_namespace()public staticWC 1.0

Get the name of a class without the namespace.

Method of the class: StringUtil{}

No Hooks.

Return

String. The class name without the namespace.

Usage

$result = StringUtil::class_name_without_namespace( $class_name );
$class_name(string) (required)
The full class name.

StringUtil::class_name_without_namespace() code WC 9.4.2

public static function class_name_without_namespace( string $class_name ) {
	// A '?:' would convert this to a one-liner, but WP coding standards disallow these :shrug:.
	$result = substr( strrchr( $class_name, '\\' ), 1 );
	return $result ? $result : $class_name;
}