| 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 |
||
| 30 | 76 | public static function assertBaseUri(string $value, string $message = ''): void |
|
| 31 | { |
||
| 32 | 76 | $baseUri = ReportingCloud::DEFAULT_BASE_URI; |
|
| 33 | |||
| 34 | 76 | $host1 = parse_url($baseUri, PHP_URL_HOST); |
|
| 35 | 76 | $host2 = parse_url($value, PHP_URL_HOST); |
|
| 36 | 76 | assert(is_string($host2)); |
|
| 37 | |||
| 38 | 76 | if (!str_ends_with($host2, $host1)) { |
|
| 39 | 4 | $format = '' === $message ? 'Expected base URI to end in %2$s. Got %1$s' : $message; |
|
| 40 | 4 | $message = sprintf($format, self::valueToString($value), self::valueToString($host1)); |
|
| 41 | 4 | throw new InvalidArgumentException($message); |
|
| 42 | } |
||
| 45 |