Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_CLI_REST_Command::get_filled_route( array $args = array() )
Get the route for this resource
Description Description
Parameters Parameters
- $args
-
(Optional) Positional arguments passed to the originating WP-CLI command.
Default value: array()
Return Return
(string)
Source Source
File: includes/cli/class-wc-cli-rest-command.php
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( '(?P<' . $id_name . '>[\d]+)', $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 ); }