Automattic\WooCommerce\Internal\Abilities
AbilitiesTracking::get_rest_namespace
Get the namespace of the outermost REST route being dispatched, such as wp_abilities or mcp.
Only the namespace is used: the rest of the route can hold IDs.
Method of the class: AbilitiesTracking{}
No Hooks.
Returns
string.
Usage
// private - for code of main (parent) class only $result = $this->get_rest_namespace(): string;
AbilitiesTracking::get_rest_namespace() AbilitiesTracking::get rest namespace code WC 11.3.0
private function get_rest_namespace(): string {
if ( ! $this->rest_requests ) {
return self::NONE;
}
$segments = explode( '/', ltrim( $this->rest_requests[0]->get_route(), '/' ), 2 );
return self::normalize_value( $segments[0] );
}