Created
February 28, 2019 00:55
-
-
Save calexandrepcjr/fbfef8a3a1359a8adbcbe7e8908e7970 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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