WC_CLI_REST_Command::get_filled_route()
Get the route for this resource
Метод класса: WC_CLI_REST_Command{}
Хуков нет.
Возвращает
Строку
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_filled_route( $args );
- $args(массив)
- Positional arguments passed to the originating WP-CLI command.
По умолчанию: array()
Код WC_CLI_REST_Command::get_filled_route() WC CLI REST Command::get filled route WC 9.6.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 ); }