The Path class is a utility class that helps to deal with relative and absolute paths on the Yothalot cluster (see Files and paths for some background).
Its member functions are:
- __construct() (constructor)
- absolute() (absolute path)
- relative() (relative path)
The constructor takes a string that holds the relative or absolute path to a file.
/** * Create a path class to manipulate absolute and relative paths. * @var Yothalot\Path */ $path = new Yothalot\Path("/absolute/path/to/glusterfs/file");
In this case the string passed to the constructor is an absolute path. You can also use:
/** * Create a path class to manipulate absolute and relative paths. * @var Yothalot\Path */ path = new Yothalot\Path("relative/path/to/glusterfs/file");
Here the string holds a relative path.
In order to retrieve the absolute path from the path given to the constructor you can
/** * Obtain the absolute class */ echo("Absolute: ".$path->absolute()."\n");
To obtain a relative path based on the path provided to the constructor you can use
/** * Obtain the relative paht */ echo("Relative: ".$path->relative()."\n");