UserFrosting API

Util

Util Class.

Static utility functions for UserFrosting.

Tags
author

Alex Weissman (https://alexanderweissman.com)

author

RocketTheme (http://www.rockettheme.com/)

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
see
https://github.com/rockettheme/toolbox/blob/develop/ResourceLocator/src/UniformResourceLocator.php
throws
BadMethodCallException
Return values
string|array|bool

stripPrefix()

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
string

stringMatches()

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
bool

arrayFilterRecursive()

Recursively apply a callback to members of an array.

public static arrayFilterRecursive( $input : array [, $callback : callable = null ] ) : array
Parameters
$input : array
$callback : callable = null
Return values
array

Search results