WordPress at Your Fingertips
function is not described

WC_CLI_REST_Command::get_filled_route() private WC 1.0

Get the route for this resource

{} It's a method of the class: WC_CLI_REST_Command{}

No Hooks.

Return

String.

Usage

// private - for code of main (parent) class only
$result = $this->get_filled_route( $args );
$args(array)
Positional arguments passed to the originating WP-CLI command.
Default: array()

Code of WC_CLI_REST_Command::get_filled_route() WC 5.9.0

private function get_filled_route( $args = array() ) {
	$supported_id_matched = false;
	$route                = $this->route;

	foreach ( $this->get_supported_ids() as $id_name => $id_desc ) {
		if ( 'id' !== $id_name && strpos( $route, '<' . $id_name . '>' ) !== false && ! empty( $args ) ) {
			$route                = str_replace( array( '(?P<' . $id_name . '>[\d]+)', '(?P<' . $id_name . '>\w[\w\s\-]*)' ), $args[0], $route );
			$supported_id_matched = true;
		}
	}

	if ( ! empty( $args ) ) {
		$id_replacement = $supported_id_matched && ! empty( $args[1] ) ? $args[1] : $args[0];
		$route          = str_replace( array( '(?P<id>[\d]+)', '(?P<id>[\w-]+)' ), $id_replacement, $route );
	}

	return rtrim( $route );
}