| @@ 1671-1679 (lines=9) @@ | ||
| 1668 | * @param string $path Path |
|
| 1669 | * @return string Last path segment |
|
| 1670 | */ |
|
| 1671 | protected function get_last_segment_of_relative_path( $path) { |
|
| 1672 | $path_parts = array_filter( explode( '/', $path ) ); |
|
| 1673 | ||
| 1674 | if ( empty( $path_parts ) ) { |
|
| 1675 | return null; |
|
| 1676 | } |
|
| 1677 | ||
| 1678 | return end( $path_parts ); |
|
| 1679 | } |
|
| 1680 | ||
| 1681 | /** |
|
| 1682 | * Generate a URL to an endpoint |
|
| @@ 254-262 (lines=9) @@ | ||
| 251 | * @param string $path Path |
|
| 252 | * @return string Last path segment |
|
| 253 | */ |
|
| 254 | protected function get_last_segment_of_relative_path( $path) { |
|
| 255 | $path_parts = array_filter( explode( '/', $path ) ); |
|
| 256 | ||
| 257 | if ( empty( $path_parts ) ) { |
|
| 258 | return null; |
|
| 259 | } |
|
| 260 | ||
| 261 | return end( $path_parts ); |
|
| 262 | } |
|
| 263 | } |
|