Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | 80 | public static function assertBaseUri(string $value, string $message = ''): void |
|
38 | { |
||
39 | 80 | $baseUri = ReportingCloud::DEFAULT_BASE_URI; |
|
40 | |||
41 | 80 | $host1 = parse_url($baseUri, PHP_URL_HOST); |
|
42 | 80 | $host2 = parse_url($value, PHP_URL_HOST); |
|
43 | 80 | assert(is_string($host2)); |
|
44 | |||
45 | 80 | if (!StringUtils::endsWith($host2, $host1)) { |
|
46 | 4 | $format = 0 === strlen($message) ? 'Expected base URI to end in %2$s. Got %1$s' : $message; |
|
47 | 4 | $message = sprintf($format, self::valueToString($value), self::valueToString($host1)); |
|
48 | 4 | throw new InvalidArgumentException($message); |
|
49 | } |
||
52 |