Utils
in package
Support class for filename extension and unit conversion
Table of Contents
Methods
- getExt() : string
- Get file extension
- getIcon() : string
- Get fontawesome icon based on file extension
- getMaxUpload() : int
- Get maximum upload size
- numToSize() : array{: float, : string}|string
- Convert numeric value to KB
- sizeToNum() : int
- Convert KB to number
- sortByDate() : int
- Sort files by date
- sortByName() : int
- Sort files by name
- sortBySize() : int
- Sort files by size
Methods
getExt()
Get file extension
public
static getExt(string $name) : string
Parameters
- $name : string
Return values
stringgetIcon()
Get fontawesome icon based on file extension
public
static getIcon(string $ext) : string
Parameters
- $ext : string
Return values
stringgetMaxUpload()
Get maximum upload size
public
static getMaxUpload([int $custom = 0 ]) : int
Parameters
- $custom : int = 0
Return values
intnumToSize()
Convert numeric value to KB
public
static numToSize(int $num[, bool $split = false ]) : array{: float, : string}|string
Parameters
- $num : int
- $split : bool = false
Return values
array{: float, : string}|stringsizeToNum()
Convert KB to number
public
static sizeToNum(string $val) : int
Parameters
- $val : string
Return values
intsortByDate()
Sort files by date
public
static sortByDate(array<string, string> $a, array<string, string> $b) : int
Parameters
- $a : array<string, string>
- $b : array<string, string>
Return values
intsortByName()
Sort files by name
public
static sortByName(array<string, string> $a, array<string, string> $b) : int
Parameters
- $a : array<string, string>
- $b : array<string, string>
Return values
intsortBySize()
Sort files by size
public
static sortBySize(array<string, int> $a, array<string, int> $b) : int
Parameters
- $a : array<string, int>
- $b : array<string, int>