summaryrefslogtreecommitdiffstats
path: root/vendor/gipfl/icingaweb2/src/FakeRequest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gipfl/icingaweb2/src/FakeRequest.php')
-rw-r--r--vendor/gipfl/icingaweb2/src/FakeRequest.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/gipfl/icingaweb2/src/FakeRequest.php b/vendor/gipfl/icingaweb2/src/FakeRequest.php
new file mode 100644
index 0000000..854c26e
--- /dev/null
+++ b/vendor/gipfl/icingaweb2/src/FakeRequest.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace gipfl\IcingaWeb2;
+
+use Icinga\Web\Request;
+use RuntimeException;
+
+class FakeRequest extends Request
+{
+ /** @var string */
+ private static $baseUrl;
+
+ public static function setConfiguredBaseUrl($url)
+ {
+ self::$baseUrl = $url;
+ }
+
+ public function setUrl(Url $url)
+ {
+ $this->url = $url;
+ return $this;
+ }
+
+ public function getBaseUrl($raw = false)
+ {
+ if (self::$baseUrl === null) {
+ throw new RuntimeException('Cannot determine base URL on CLI if not configured');
+ } else {
+ return self::$baseUrl;
+ }
+ }
+}