class Pipe (View source)

The Pipe class handles the chain of processes to manipulate variable values.

Properties

static private $phpFunctions Whitelist of standard PHP functions.

Methods

static string
process(string $value, array $functions)

Processes an array of functions applied to a given value.

static string
extension(string $function, array $parameters, string $value)

Call custom string function.

static number
math(string $operator, string $number, string $value)

Simple math operations.

static string
stringFunction(string $function, array $parameters, string|null $value = null)

Apply string function to $value.

Details

static string process(string $value, array $functions)

Processes an array of functions applied to a given value.

$functions is an array of associative arrays with function name and parameters. In case the function name is a mathematical operator, the value is just the numeric value instead of an array.

Parameters

string $value
array $functions

Return Value

string The modified $value

static private string extension(string $function, array $parameters, string $value)

Call custom string function.

Parameters

string $function
array $parameters
string $value

Return Value

string $value

static private number math(string $operator, string $number, string $value)

Simple math operations.

Parameters

string $operator
string $number
string $value

Return Value

number $value

static private string stringFunction(string $function, array $parameters, string|null $value = null)

Apply string function to $value.

Parameters

string $function
array $parameters
string|null $value

Return Value

string $value