summaryrefslogtreecommitdiffstats
path: root/library/Businessprocess/Web/FakeRequest.php
blob: 4e54117c3f02ebee47799ad623fe16445f4d6525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

namespace Icinga\Module\Businessprocess\Web;

use Icinga\Exception\ProgrammingError;
use Icinga\Web\Request;

class FakeRequest extends Request
{
    /** @var string */
    private static $baseUrl;

    public static function setConfiguredBaseUrl($url)
    {
        self::$baseUrl = $url;
    }

    public function getBaseUrl($raw = false)
    {
        if (self::$baseUrl === null) {
            throw new ProgrammingError('Cannot determine base URL on CLI if not configured');
        } else {
            return self::$baseUrl;
        }
    }
}