sfToolkit
in package
Table of Contents
Methods
- clearDirectory() : mixed
- Clear all files in a directory.
- getArrayValueForPath() : mixed
- Get a value from a nested array using path notation.
- getPhpCli() : string
- Find the PHP CLI executable.
- isArrayValuesEmpty() : bool
- Check if array values are empty.
- isPathAbsolute() : bool
- Check if a path is absolute.
- isUTF8() : bool
- Check if a string is valid UTF-8.
- literalize() : mixed
- Literalize a string value.
- mkdir() : bool
- Recursively create a directory.
- pregtr() : string
- Multiple regex replacement.
- replaceConstants() : string
- Replace constants in a string (e.g., %SF_DATA_DIR%).
- setArrayValueForPath() : mixed
- Set a value in a nested array using path notation.
- slugify() : string
- Generate a URL-friendly slug from a string.
- stringToArray() : array<string|int, mixed>
- Converts PHP-like attribute strings to arrays.
Methods
clearDirectory()
Clear all files in a directory.
public
static clearDirectory(string $directory) : mixed
Parameters
- $directory : string
getArrayValueForPath()
Get a value from a nested array using path notation.
public
static getArrayValueForPath(array<string|int, mixed> $values, string $name[, mixed $default = null ]) : mixed
Parameters
- $values : array<string|int, mixed>
-
The array to search
- $name : string
-
Path (e.g., 'foo[bar][baz]')
- $default : mixed = null
-
Default if not found
getPhpCli()
Find the PHP CLI executable.
public
static getPhpCli() : string
Return values
stringisArrayValuesEmpty()
Check if array values are empty.
public
static isArrayValuesEmpty(array<string|int, mixed> $array) : bool
Parameters
- $array : array<string|int, mixed>
Return values
boolisPathAbsolute()
Check if a path is absolute.
public
static isPathAbsolute(string $path) : bool
Parameters
- $path : string
Return values
boolisUTF8()
Check if a string is valid UTF-8.
public
static isUTF8(string $string) : bool
Parameters
- $string : string
Return values
boolliteralize()
Literalize a string value.
public
static literalize(string $value) : mixed
Converts: null, true, false, integers, floats, and defined constants.
Parameters
- $value : string
mkdir()
Recursively create a directory.
public
static mkdir(string $path[, int $mode = 0777 ]) : bool
Parameters
- $path : string
- $mode : int = 0777
Return values
boolpregtr()
Multiple regex replacement.
public
static pregtr(string $search, array<string|int, mixed> $replacePairs) : string
Parameters
- $search : string
-
Subject
- $replacePairs : array<string|int, mixed>
-
pattern => replacement
Return values
stringreplaceConstants()
Replace constants in a string (e.g., %SF_DATA_DIR%).
public
static replaceConstants(string $value) : string
Parameters
- $value : string
Return values
stringsetArrayValueForPath()
Set a value in a nested array using path notation.
public
static setArrayValueForPath(array<string|int, mixed> &$values, string $name, mixed $value) : mixed
Parameters
- $values : array<string|int, mixed>
-
The array to modify
- $name : string
-
Path (e.g., 'foo[bar][baz]')
- $value : mixed
-
Value to set
slugify()
Generate a URL-friendly slug from a string.
public
static slugify(string $text[, string $separator = '-' ]) : string
Parameters
- $text : string
- $separator : string = '-'
Return values
stringstringToArray()
Converts PHP-like attribute strings to arrays.
public
static stringToArray(string $string) : array<string|int, mixed>
Parameters
- $string : string
-
e.g., 'class="foo" id="bar"'