@@ 164-171 (lines=8) @@ | ||
161 | * @param string $path The path to get the root entry of. |
|
162 | * @return string The root entry of the given path, without slashes. |
|
163 | */ |
|
164 | public static function head($path) |
|
165 | { |
|
166 | if (!\arc\path::isAbsolute($path)) { |
|
167 | $path = '/' . $path; |
|
168 | } |
|
169 | ||
170 | return substr( (string)$path, 1, strpos( (string)$path, '/', 1) - 1 ); |
|
171 | } |
|
172 | ||
173 | /** |
|
174 | * Returns the path without its root entry. |
|
@@ 182-189 (lines=8) @@ | ||
179 | * @param string $path The path to get the tail of. |
|
180 | * @return string The path without its root entry. |
|
181 | */ |
|
182 | public static function tail($path) |
|
183 | { |
|
184 | if (!\arc\path::isAbsolute($path)) { |
|
185 | $path = '/' . $path; |
|
186 | } |
|
187 | ||
188 | return substr( (string)$path, strpos( (string)$path, '/', 1) ); |
|
189 | } |
|
190 | ||
191 | /** |
|
192 | * Returns the difference between sourcePath and targetPath as a relative path in |