add shitty documentation to FileSystem

This commit is contained in:
Pachira 2016-10-07 20:00:37 +02:00
parent 6d0ec8d1e5
commit 217580ab1f

View file

@ -13,8 +13,16 @@ namespace Sakura;
*/
class FileSystem
{
/**
* Cached copy of the root path.
* @var string
*/
private static $rootPath = null;
/**
* Resolves the root path.
* @return string
*/
public static function getRootPath()
{
if (self::$rootPath === null) {
@ -25,11 +33,19 @@ class FileSystem
return self::$rootPath;
}
/**
* Fixes a given path to the correct slashes and root.
* @return string
*/
public static function getPath($path)
{
return self::getRootPath() . DIRECTORY_SEPARATOR . self::fixSlashes($path);
}
/**
* Fixes slashes.
* @return string
*/
private static function fixSlashes($path)
{
return str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);