class Utils (View source)

Methods

static  string
arrayToPipedString( array $defaultValues)

Takes an array of values and ouputs them as a string between brackets and separated by a pipe.

static  bool
arrayIsMulti( array $array)

Simple test to see if array is multi-dimensional.

static  boolean
arrayValuesCheck( array $array, string $type, string $className = '')

Simple test to see if array values are of specified type.

static  bool
isIntOrPercent( mixed $val)

Tests input for valid int or percent

static  bool
between( int|float $lower, int|float $test, int|float $upper, bool $includeLimits = true)

Test if a number is between two other numbers.

static  bool
nonEmptyString( string $var)

Checks if variable is a non-empty string

static  bool
nonEmptyStringInArray( string $var, array $arr)

Checks if variable is a non-empty string within an array of values

Details

at line 14
static string arrayToPipedString( array $defaultValues)

Takes an array of values and ouputs them as a string between brackets and separated by a pipe.

Parameters

array $defaultValues Array of default values

Return Value

string Converted array to string.

at line 32
static bool arrayIsMulti( array $array)

Simple test to see if array is multi-dimensional.

Parameters

array $array Array of values.

Return Value

bool Returns true is first element in the array is an array, otherwise false.

at line 53
static boolean arrayValuesCheck( array $array, string $type, string $className = '')

Simple test to see if array values are of specified type.

Parameters

array $array Array of values.
string $type Type to check
string $className Named class, if type == 'class'

Return Value

boolean Returns true is all values match type, otherwise false.

at line 101
static bool isIntOrPercent( mixed $val)

Tests input for valid int or percent

Valid int = 5 or 12 Valid percent = 32% or 100%

Parameters

mixed $val Integer or string.

Return Value

bool Returns true if valid in or percent, otherwise false.

at line 139
static bool between( int|float $lower, int|float $test, int|float $upper, bool $includeLimits = true)

Test if a number is between two other numbers.

Pass in the number to test, the lower limit and upper limit. Defaults to including the limits with <= & >=, set to false to exclude the limits with < & >

Parameters

int|float $lower The lower limit
int|float $test The number to test
int|float $upper The upper limit
bool $includeLimits Set whether to include limits

Return Value

bool

at line 162
static bool nonEmptyString( string $var)

Checks if variable is a non-empty string

Parameters

string $var

Return Value

bool

at line 178
static bool nonEmptyStringInArray( string $var, array $arr)

Checks if variable is a non-empty string within an array of values

Parameters

string $var
array $arr

Return Value

bool