Conditions | 3 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
42 | 292 | public static function assertBaseUri($value, string $message = ''): void |
|
43 | { |
||
44 | 292 | $baseUri = ReportingCloud::DEFAULT_BASE_URI; |
|
45 | |||
46 | 292 | $host1 = (string) parse_url($baseUri, PHP_URL_HOST); |
|
47 | 292 | $host2 = (string) parse_url($value, PHP_URL_HOST); |
|
48 | |||
49 | 292 | if (!StringUtils::endsWith($host2, $host1)) { |
|
50 | 9 | $format = $message ?: 'Expected base URI to end in %2$s. Got %1$s'; |
|
51 | 9 | $message = sprintf($format, self::valueToString($value), self::valueToString($host1)); |
|
52 | 9 | throw new InvalidArgumentException($message); |
|
53 | } |
||
56 |