refacto(utils): remove a useless intermediate variable

This is the commit of the suggestion I made here:
https://framagit.org/framasoft/framadate/framadate/merge_requests/344/diffs#note_399810
This commit is contained in:
Paul B 2019-04-16 16:04:27 +02:00
parent 3ec6435323
commit 6d9130ef84
No known key found for this signature in database
GPG Key ID: DE331B23748D3A27
1 changed files with 1 additions and 3 deletions

View File

@ -34,15 +34,13 @@ class Utils {
(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
) ? 'https' : 'http';
$domain = defined('APP_URL') ? APP_URL : $serverName;
$port = in_array($serverPort, ['80', '443'], true) ? '' : ':' . $serverPort;
$dirname = dirname($_SERVER['SCRIPT_NAME']);
$dirname = $dirname === '\\' ? '/' : $dirname . '/';
$dirname = str_replace('/admin', '', $dirname);
$dirname = str_replace('/action', '', $dirname);
$appUrlConfig = defined('APP_URL') ? APP_URL : '';
$domain = $appUrlConfig === '' ? $serverName : $appUrlConfig;
return $scheme . '://' . preg_replace('#//+#', '/', $domain . $port . $dirname);
}