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.
Метод класса: AbilitiesTracking{}
Хуков нет.
Возвращает
string.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_rest_namespace(): string;
Код AbilitiesTracking::get_rest_namespace() AbilitiesTracking::get rest namespace 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] );
}