| Total Complexity | 2 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class Util |
||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Joins string pieces and formats it as an absolute path. |
||
| 13 | * |
||
| 14 | * @param string ...$args |
||
| 15 | * @return string |
||
| 16 | */ |
||
| 17 | public static function path(string ...$args): string |
||
| 18 | { |
||
| 19 | $path = trim(implode('/', $args), '/'); |
||
| 20 | $path = preg_replace('/\/+/', '/', $path); |
||
| 21 | return '/' . $path; |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Joins string pieces and formats it as a human friendly slug. |
||
| 26 | * |
||
| 27 | * @param string ...$args |
||
| 28 | * @return string |
||
| 29 | */ |
||
| 30 | public static function slug(string ...$args): string |
||
| 36 | } |
||
| 37 | } |
||
| 38 |