FilesystemInterface
in
Defines several stream-save filesystem actions.
Tags
Table of Contents
Methods
- basename() : string
- Unicode-safe and stream-safe `\basename()` replacement.
- dirname() : string
- Unicode-safe and stream-safe `\dirname()` replacement.
- normalize() : string
- Normalize path by cleaning up `\`, `/./`, `//` and `/../`.
- parent() : string
- Get parent path. Empty path is returned if there are no segments remaining.
- pathinfo() : array<string|int, mixed>|string
- Unicode-safe and stream-safe `\pathinfo()` replacement.
Methods
basename()
Unicode-safe and stream-safe `\basename()` replacement.
public
basename(string $path[, string|null $suffix = null ]) : string
Parameters
- $path : string
-
A filename or path, does not need to exist as a file.
- $suffix : string|null = null
-
If the filename ends in suffix this will also be cut off.
Return values
stringdirname()
Unicode-safe and stream-safe `\dirname()` replacement.
public
dirname(string $path[, int $levels = 1 ]) : string
Parameters
- $path : string
-
A filename or path, does not need to exist as a file.
- $levels : int = 1
-
The number of parent directories to go up (>= 1).
Tags
Return values
string —Returns path to the directory.
normalize()
Normalize path by cleaning up `\`, `/./`, `//` and `/../`.
public
normalize(string $path) : string
Parameters
- $path : string
-
A filename or path, does not need to exist as a file.
Tags
Return values
string —Returns normalized path.
parent()
Get parent path. Empty path is returned if there are no segments remaining.
public
parent(string $path[, int $levels = 1 ]) : string
Can be used recursively to get towards the root directory.
Parameters
- $path : string
-
A filename or path, does not need to exist as a file.
- $levels : int = 1
-
The number of parent directories to go up (>= 1).
Tags
Return values
string —Returns parent path.
pathinfo()
Unicode-safe and stream-safe `\pathinfo()` replacement.
public
pathinfo(string $path[, int|null $options = null ]) : array<string|int, mixed>|string
Parameters
- $path : string
-
A filename or path, does not need to exist as a file.
- $options : int|null = null
-
A PATHINFO_* constant.