| Methods |
public
static
|
globRecursive(string $base, string $pattern, integer $flags = 0): array
Similar to glob but also recursively calls glob on subfolders too.
Similar to glob but also recursively calls glob on subfolders too.
Parameters
| $base |
The base path.
|
| $pattern |
The pattern to test for inside.
|
| $flags |
glob() flags.
|
Returns
A list of all the files that were found, this does not include the sub folder names.
|
#
|
public
static
|
ensureFolder(string $dir): boolean
Makes sure a folder exists by creating it if it doesnt exist.
Makes sure a folder exists by creating it if it doesnt exist.
Parameters
| $dir |
The folder to check.
|
Returns
True if the folder already existed or exists now, false on failure.
|
#
|
public
static
|
mkFolder(string $path): boolean
Creates a folder.
Parameters
| $path |
The path of the folder to create, the folders parent does not need to exist to create it.
|
Returns
|
#
|
public
static
|
mkFile(string $path, string $data, string $fopenMode = "w", boolean $overwrite = true): boolean
Creates a file, the parent directory does not need to exist to create the file.
Creates a file, the parent directory does not need to exist to create the file.
Parameters
| $path |
The path of the file.
|
| $data |
The data to put into the file.
|
| $fopenMode |
What mode fopen should use.
|
| $overwrite |
Weather to overwrite any existing file.
|
Returns
|
#
|
public
static
|
getFileDir(string $path): string
Removes the last name in a file path.
Removes the last name in a file path.
Parameters
| $path |
The full file path.
|
Returns
The path without the last name.
|
#
|
public
static
|
getFileName(string $path): string
Use basename instead.
|
#
|
public
static
|
copyFile(string $pathFrom, string $pathTo, boolean $showProgress = true): boolean
Copies a file from one place to another.
Copies a file from one place to another.
Parameters
| $pathFrom |
The source file.
|
| $pathTo |
The destination file, the destination file's folder will be created if it doesnt already exist.
|
| $showProgress |
Weather to show a progress bar, this changes the copy from copy() to many fread and fwrites.
|
Returns
|
#
|
public
static
|
validatePath(string $path, boolean $addquotes = false): string
Makes all slashes backslashes and adds quotes if enabled and needed.
Makes all slashes backslashes and adds quotes if enabled and needed.
Parameters
| $path |
The path to be made valid for a windows command.
|
| $addquotes |
Weather to add quotes if needed.
|
Returns
|
#
|
public
static
|
getFileExtension(string $fileName): string
Gets the extension from the last .xyz part of a path.
Gets the extension from the last .xyz part of a path.
Parameters
| $fileName |
The path or name of the file.
|
Returns
The extension of the file.
|
#
|
public
static
|
fileExtensionMimeTypes(): array
Returns an array which has lowercase file extensions as keys and mime types as values.
Returns an array which has lowercase file extensions as keys and mime types as values.
|
#
|
public
static
|
formatBytes(integer $bytes): string
Converts a number of bytes into a string with an appropriate unit.
Converts a number of bytes into a string with an appropriate unit.
Parameters
| $bytes |
The number of bytes.
|
Returns
|
#
|
public
static
|
progressBar(
float $precentage,
integer $barWidth = 30,
integer $totalBytes = 0,
integer $bytesPerSecond = 0,
integer $secondsLeft = 0,
): string
Makes a string that is a probress bar that can be printed to the command line.
Makes a string that is a probress bar that can be printed to the command line.
Parameters
| $precentage |
The current percentage the bar should show.
|
| $barWidth |
The number of characters the bar should be made of.
|
| $totalBytes |
The total number of bytes, 0 to not show total.
|
| $bytesPerSecond |
The current speed to show, 0 to not show speed.
|
| $secondsLeft |
The number of seconds left, 0 to not show time left.
|
Returns
|
#
|
public
static
|
progressTracker(
integer $total,
integer $current,
integer $barWidth = 30,
boolean $showTotal = true,
boolean $showSpeed = true,
boolean $showEta = true,
): string
Repeatedly call this function and it will return a progress bar with calculated time left and speed.
Repeatedly call this function and it will return a progress bar with calculated time left and speed.
Parameters
| $total |
The total number of bytes in the operation.
|
| $current |
The current number of bytes done.
|
| $barWidth |
The width of the bar part.
|
| $showTotal |
Weather to show the total number of bytes.
|
| $showSpeed |
Weather to calculate the speed of current bytes change between calls.
|
| $showEta |
Weather to calculate the time left between calls.
|
Returns
The current state of the progress bar.
|
#
|