Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | final class DiffusionPathIDQuery extends Phobject { | ||||
* Convert a path to the canonical, absolute representation used by Diffusion. | * Convert a path to the canonical, absolute representation used by Diffusion. | ||||
* | * | ||||
* @param string Some repository path. | * @param string Some repository path. | ||||
* @return string Canonicalized Diffusion path. | * @return string Canonicalized Diffusion path. | ||||
* @task pathutil | * @task pathutil | ||||
*/ | */ | ||||
public static function normalizePath($path) { | public static function normalizePath($path) { | ||||
if ($path === null) { | |||||
return '/'; | |||||
} | |||||
// Normalize to single slashes, e.g. "///" => "/". | // Normalize to single slashes, e.g. "///" => "/". | ||||
$path = preg_replace('@[/]{2,}@', '/', $path); | $path = preg_replace('@[/]{2,}@', '/', $path); | ||||
return '/'.trim($path, '/'); | return '/'.trim($path, '/'); | ||||
} | } | ||||
/** | /** | ||||
Show All 38 Lines |