Skip to content

Instantly share code, notes, and snippets.

@calexandrepcjr
Created February 28, 2019 00:55
Show Gist options
  • Save calexandrepcjr/fbfef8a3a1359a8adbcbe7e8908e7970 to your computer and use it in GitHub Desktop.
Save calexandrepcjr/fbfef8a3a1359a8adbcbe7e8908e7970 to your computer and use it in GitHub Desktop.
<?php
/**
* This method was created to easily parse any URI helping
* with HTTP Clients requests when adding routes
*
* @param string $uri
* @return string
**/
function uriSanitizer(string $uri): string
{
if ($route === '' || getenv('APP_DEBUG') === 'true') {
return $uri;
}
if (substr($uri, -1) !== DIRECTORY_SEPARATOR) {
$uri .= DIRECTORY_SEPARATOR;
}
return $uri . ltrim($route, DIRECTORY_SEPARATOR);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment