Url: Remove deprecated methods `setBaseUrl()` and `getBaseUrl()`

This commit is contained in:
Sukhwinder Dhillon 2022-05-02 15:23:05 +02:00 committed by Johannes Meyer
parent 55d23a531f
commit a9af8f2e1a
1 changed files with 0 additions and 69 deletions

View File

@ -367,75 +367,6 @@ class Url
return $this->scheme;
}
/**
* Set the baseUrl for this url
*
* @deprecated Please create a new url from scratch instead
*
* @param string $baseUrl The url path to use as the url base
*
* @return $this
*/
public function setBaseUrl($baseUrl)
{
$urlParts = parse_url($baseUrl);
if (isset($urlParts["host"])) {
$this->setHost($urlParts["host"]);
}
if (isset($urlParts["port"])) {
$this->setPort($urlParts["port"]);
}
if (isset($urlParts['scheme'])) {
$this->setScheme($urlParts['scheme']);
}
if (isset($urlParts['user'])) {
$this->setUsername($urlParts['user']);
}
if (isset($urlParts['pass'])) {
$this->setPassword($urlParts['pass']);
}
if (isset($urlParts['path'])) {
$this->setBasePath($urlParts['path']);
}
return $this;
}
/**
* Return the baseUrl for this url
*
* @deprecated
*
* @return string
*/
public function getBaseUrl()
{
if (! $this->isExternal()) {
return $this->getBasePath();
}
$urlString = '';
if ($this->getScheme()) {
$urlString .= $this->getScheme() . '://';
}
if ($this->getPassword()) {
$urlString .= $this->getUsername() . ':' . $this->getPassword() . '@';
} elseif ($this->getUsername()) {
$urlString .= $this->getUsername() . '@';
}
if ($this->getHost()) {
$urlString .= $this->getHost();
}
if ($this->getPort()) {
$urlString .= ':' . $this->getPort();
}
if ($this->getBasePath()) {
$urlString .= $this->getBasePath();
}
return $urlString;
}
/**
* Set the relative path of this url, without query parameters
*