From c868789472bd74423c63b048c4367956722c61a4 Mon Sep 17 00:00:00 2001 From: Noah Hilverling Date: Thu, 13 Oct 2016 10:52:54 +0200 Subject: [PATCH] Url: Add alternative attributes for baseUrl refs #12133 --- library/Icinga/Web/Url.php | 151 +++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/library/Icinga/Web/Url.php b/library/Icinga/Web/Url.php index b61fd990f..3fec8e385 100644 --- a/library/Icinga/Web/Url.php +++ b/library/Icinga/Web/Url.php @@ -52,6 +52,41 @@ class Url */ protected $baseUrl = ''; + /** + * The host of the Url + * + * @var string + */ + protected $host; + + /** + * The port auf the Url + * + * @var string + */ + protected $port; + + /** + * The scheme of the Url + * + * @var string + */ + protected $scheme; + + /** + * The username passed with the Url + * + * @var string + */ + protected $username; + + /** + * The password passed with the Url + * + * @var string + */ + protected $password; + protected function __construct() { $this->params = UrlParams::fromQueryString(''); // TODO: ::create() @@ -228,6 +263,76 @@ class Url return $this; } + + /** + * Overwrite the host + * + * @param string $host New host of this Url + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Return the host set for this Url + * + * @return string + */ + public function getHost() + { + return $this->host; + } + + /** + * Overwrite the port + * + * @param string $port New port of this Url + * + * @return $this + */ + public function setPort($port) + { + $this->port = $port; + return $this; + } + + /** + * Return the port set for this url + * + * @return string + */ + public function getPort() + { + return $this->port; + } + + /** + * Overwrite the scheme + * + * @param string $scheme The scheme used for this url + * + * @return $this + */ + public function setScheme($scheme) + { + $this->scheme = $scheme; + return $this; + } + + /** + * Return the scheme set for this url + * + * @return string + */ + public function getScheme() + { + return $this->scheme; + } + /** * Overwrite the baseUrl * @@ -299,6 +404,52 @@ class Url return $this->external; } + /** + * Set the username passed with the url + * + * @param string $username The username to set + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Return the username passed with the url + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Set the username passed with the url + * + * @param string $password The password to set + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Return the password passed with the url + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + /** * Return the relative url *