| Conditions | 6 |
| Paths | 14 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 6 | function get_path_to() |
||
| 7 | { |
||
| 8 | $segments = func_get_args(); |
||
| 9 | |||
| 10 | $finalIndex = count( $segments ) - 1; |
||
| 11 | $finalIndex = $finalIndex < 0 ? 0 : $finalIndex; |
||
| 12 | $finalSegment = ''; |
||
| 13 | |||
| 14 | $disabledChars = [ '/', '\\', NULL ]; |
||
| 15 | foreach( $segments as $count => $segment ) |
||
| 16 | { |
||
| 17 | if ( !in_array( $segment, $disabledChars ) ) $finalSegment .= $count > 0 ? trim( $segment, '/' ) : rtrim( $segment, '/' ); |
||
| 18 | |||
| 19 | if ( $count != $finalIndex ) $finalSegment .= '/'; |
||
| 20 | } |
||
| 21 | |||
| 22 | $finalSegment = '/'.ltrim( $finalSegment, '/' ); |
||
| 23 | |||
| 24 | return $finalSegment; |
||
| 25 | } |