Url: Remove deprecated methods `setBaseUrl()` and `getBaseUrl()`
This commit is contained in:
parent
55d23a531f
commit
a9af8f2e1a
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue