From: Michael Date: Fri, 22 May 2020 04:52:43 +0000 (+0000) Subject: Added documentation, simplified code X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=071505f024d18aba07fb2447f76f59fbe7f3ff78;p=friendica.git Added documentation, simplified code --- diff --git a/src/Model/GServer.php b/src/Model/GServer.php index 08663fa065..560c0831d7 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -247,6 +247,12 @@ class GServer Logger::info('Set failed status for new server', ['url' => $url]); } + /** + * Remove unwanted content from the given URL + * + * @param string $url + * @return string cleaned URL + */ public static function cleanURL(string $url) { $url = trim($url, '/'); @@ -260,13 +266,15 @@ class GServer return Network::unparseURL($urlparts); } + /** + * Return the base URL + * + * @param string $url + * @return string base URL + */ private static function getBaseURL(string $url) { - $urlparts = parse_url($url); - unset($urlparts['user']); - unset($urlparts['pass']); - unset($urlparts['query']); - unset($urlparts['fragment']); + $urlparts = parse_url(self::cleanURL($url)); unset($urlparts['path']); return Network::unparseURL($urlparts); }