| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 11 | public static function buildEndpoint(...$endpoints): string |
|
| 18 | { |
||
| 19 | 11 | $url = ''; |
|
| 20 | |||
| 21 | 11 | foreach ($endpoints as $endpoint) { |
|
| 22 | 11 | if (is_string($endpoint)) |
|
| 23 | { |
||
| 24 | 11 | $url = implode('/', array_filter([$url, $endpoint])); |
|
| 25 | 11 | continue; |
|
| 26 | } |
||
| 27 | |||
| 28 | 10 | if (is_array($endpoint)) |
|
| 29 | { |
||
| 30 | 10 | $url .= '/'. implode('/', $endpoint); |
|
| 31 | 10 | continue; |
|
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | 11 | return $url; |
|
| 36 | } |
||
| 38 |