tools update, bug fix Strings to return path if null, Fix form list loader, fix paths

This commit is contained in:
Clemens Schwaighofer
2024-03-07 15:01:19 +09:00
parent d3d4cf512f
commit 8c607ae610
16 changed files with 200 additions and 38 deletions

View File

@@ -118,6 +118,22 @@ class Strings
return $value;
}
}
/**
* Strip any duplicated slahes from a path
* eg: //foo///bar/foo.inc -> /foo/bar/foo.inc
*
* @param string $path Path to strip slashes from
* @return string Clean path, on error returns original path
*/
public static function stripMultiplePathSlashes(string $path): string
{
return preg_replace(
'#/+#',
'/',
$path
) ?? $path;
}
}
// __END__