Util
Util Class.
Static utility functions for UserFrosting.
Tags
Table of Contents
normalizePath() | Returns the canonicalized URI on success. The resulting path will have no '/./' or '/../' components. | string|array|bool |
---|---|---|
stripPrefix() | Removes a prefix from the beginning of a string, if a match is found. | string |
stringMatches() | Determine if a given string matches one or more regular expressions. | bool |
arrayFilterRecursive() | Recursively apply a callback to members of an array. | array |
Methods
normalizePath()
Returns the canonicalized URI on success. The resulting path will have no '/./' or '/../' components.
public
static normalizePath(
$uri :
string
[, $throwException :
bool
= false ]
[, $splitStream :
bool
= false ]
)
: string|array|bool
Trailing delimiter /
is kept.
By default (if $throwException parameter is not set to true) returns false on failure.
Parameters
- $uri : string
- $throwException : bool = false
- $splitStream : bool = false
Tags
Return values
string|array|boolstripPrefix()
Removes a prefix from the beginning of a string, if a match is found.
public
static stripPrefix(
$str :
string
[, $prefix :
string
= '' ]
)
: string
Parameters
- $str : string
The string to process.
- $prefix : string = ''
The prefix to find and remove.
Return values
stringstringMatches()
Determine if a given string matches one or more regular expressions.
public
static stringMatches(
$patterns :
string|array
, $subject :
string
[, &$matches :
array
= null ]
[, $delimiter :
string
= '~' ]
, $flags :
int
, $offset :
int
)
: bool
Parameters
- $patterns : string|array
- $subject : string
- $matches : array = null
- $delimiter : string = '~'
- $flags : int
- $offset : int
Return values
boolarrayFilterRecursive()
Recursively apply a callback to members of an array.
public
static arrayFilterRecursive(
$input :
array
[, $callback :
callable
= null ]
)
: array
Parameters
- $input : array
- $callback : callable = null