Removed unnecessary checks from URL formatter.

This commit is contained in:
flash 2023-07-18 22:36:07 +00:00
parent 473d5f22b5
commit bec58f589f

View file

@ -136,10 +136,6 @@ function url(string $name, array $variables = []): string {
return '';
$info = MSZ_URLS[$name];
if(!isset($info[0]) || !is_string($info[0]))
return '';
$splitUrl = explode('/', $info[0]);
for($i = 0; $i < count($splitUrl); $i++)
@ -147,7 +143,7 @@ function url(string $name, array $variables = []): string {
$url = implode('/', $splitUrl);
if(!empty($info[1]) && is_array($info[1])) {
if(!empty($info[1])) {
$url .= '?';
foreach($info[1] as $key => $value) {
@ -162,7 +158,7 @@ function url(string $name, array $variables = []): string {
$url = trim($url, '?&');
}
if(!empty($info[2]) && is_string($info[2]))
if(!empty($info[2]))
$url .= rtrim(sprintf('#%s', url_variable($info[2], $variables)), '#');
return $url;