summaryrefslogtreecommitdiffstats
path: root/vendor/gipfl/icingaweb2/src/FakeRequest.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:23:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:23:16 +0000
commit3e97c51418e6d27e9a81906f347fcb7c78e27d4f (patch)
treeee596ce1bc9840661386f96f9b8d1f919a106317 /vendor/gipfl/icingaweb2/src/FakeRequest.php
parentInitial commit. (diff)
downloadicingaweb2-module-incubator-3e97c51418e6d27e9a81906f347fcb7c78e27d4f.tar.xz
icingaweb2-module-incubator-3e97c51418e6d27e9a81906f347fcb7c78e27d4f.zip
Adding upstream version 0.20.0.upstream/0.20.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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;
+ }
+ }
+}