Skip to content

Commit

Permalink
Make phpcs happy
Browse files Browse the repository at this point in the history
  • Loading branch information
psrpinto committed Sep 12, 2022
1 parent 5ef5882 commit b7d0c52
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Http/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ function () use ( $route, $methods ) {
);
}

private function get_current_route() {
private function get_current_route(): string {
$wp_url = get_site_url();
$installed_dir = parse_url( $wp_url, PHP_URL_PATH );
$installed_dir = wp_parse_url( $wp_url, PHP_URL_PATH );

// requested uri relative to WP install
$request_uri = str_replace( $installed_dir, '', $_SERVER['REQUEST_URI'] );
// Requested URI relative to WP install.
$uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$uri = str_replace( $installed_dir, '', $uri );

$uri = sanitize_text_field( wp_unslash( $request_uri ) );
$route = strtok( $uri, '?' );

return trim( $route, '/' );
Expand Down

0 comments on commit b7d0c52

Please sign in to comment.