diff options
author | Julius Härtl <jus@bitgrid.net> | 2017-06-15 21:51:51 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-06-16 10:51:31 +0200 |
commit | f039ba748032a78e70845adad9152730715a8219 (patch) | |
tree | 908786d51bdf65f90b906fd9289bd4fbc3f475f0 /lib/private/URLGenerator.php | |
parent | 0999ed1778d7b1d95e4fb45b5d28162f2cc4d985 (diff) | |
download | nextcloud-server-f039ba748032a78e70845adad9152730715a8219.tar.gz nextcloud-server-f039ba748032a78e70845adad9152730715a8219.zip |
Add tests and inject IRequest
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/URLGenerator.php')
-rw-r--r-- | lib/private/URLGenerator.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 6db675e7d77..073d40b0de8 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -35,7 +35,9 @@ namespace OC; use OCP\ICacheFactory; use OCP\IConfig; +use OCP\IRequest; use OCP\IURLGenerator; +use OCP\Route\IRoute; use RuntimeException; /** @@ -46,15 +48,20 @@ class URLGenerator implements IURLGenerator { private $config; /** @var ICacheFactory */ private $cacheFactory; + /** @var IRequest */ + private $request; /** * @param IConfig $config * @param ICacheFactory $cacheFactory + * @param IRequest $request */ public function __construct(IConfig $config, - ICacheFactory $cacheFactory) { + ICacheFactory $cacheFactory, + IRequest $request) { $this->config = $config; $this->cacheFactory = $cacheFactory; + $this->request = $request; } /** @@ -244,7 +251,6 @@ class URLGenerator implements IURLGenerator { * @return string base url of the current request */ public function getBaseUrl() { - $request = \OC::$server->getRequest(); - return $request->getServerProtocol() . '://' . $request->getServerHost() . \OC::$WEBROOT; + return $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; } } |