Automattic\WooCommerce\Utilities
StringUtil::class_name_without_namespace
Get the name of a class without the namespace.
Method of the class: StringUtil{}
No Hooks.
Returns
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() StringUtil::class name without namespace code WC 10.3.5
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;
}