ArrayUtil Class Reference

Static Public Member Functions

static getArrayValue ($array, $element)
static getArrayValueAndResolveNullAsZero ($array, $element)
static getArrayValueWithExceptionIfNotFound ($array, $element)
static resolveArrayToLowerCase ($array)
static array_iunique ($array)
static stringify ($data)
static flatten ($array, $preserveKeys=false)
static subValueSort ($array, $subKey, $sortFunctionName)
static arrayUniqueRecursive ($array)
static isValidArrayIndex ($index, $array)
static isArrayNotUnique ($a)
static chopArray (array &$array, $size)
static encodeAutoCompleteOptionsArray (array $options)
static decodeAutoCompleteOptionsArray ($options)
static isAssoc (array $array)
static sortArrayByElementField ($compareFunction, $sortFunctionName, &$data, $className)
static findLastKey (array &$array)
static getNestedValue (array $array, $key)
static recursivelyRemoveEmptyValues (array $haystack)

Detailed Description

Helper functionality for use in accessing and manipulating arrays.

Definition at line 40 of file ArrayUtil.php.


Member Function Documentation

static getArrayValue ( array,
element 
) [static]

Returns value of $array[$element] if $element is defined, otherwise if not defined will return null

Definition at line 45 of file ArrayUtil.php.

static getArrayValueAndResolveNullAsZero ( array,
element 
) [static]

Returns value of $array[$element] if $element is defined, otherwise if not defined will return 0

Definition at line 57 of file ArrayUtil.php.

static getArrayValueWithExceptionIfNotFound ( array,
element 
) [static]
Parameters:
$array 
$element 
Returns:
null
Exceptions:
NotFoundException 

Definition at line 72 of file ArrayUtil.php.

static array_iunique ( array  )  [static]

Case insensitive version of array $array

Definition at line 93 of file ArrayUtil.php.

static stringify ( data  )  [static]

Given an array, stringify the array values into content seperated by commas and return the content.

Parameters:
array $data

Definition at line 102 of file ArrayUtil.php.

static flatten ( array,
preserveKeys = false 
) [static]

Convert multi-dimenision array into flat(one dimension) array

Definition at line 120 of file ArrayUtil.php.

static subValueSort ( array,
subKey,
sortFunctionName 
) [static]

Pass an array in to sort by an element's value.

Parameters:
Array $array
Mixed $subKey (integer or string)
string $sortFunctionName
Returns:
sorted array or empty array if nothing to sort

Definition at line 153 of file ArrayUtil.php.

static isAssoc ( array $  array  )  [static]
Parameters:
array $array
Returns:
bool Checks if provided array is associative or indexed. If there exists one string key, it will return true.

Definition at line 234 of file ArrayUtil.php.

static sortArrayByElementField ( compareFunction,
sortFunctionName,
&$  data,
className 
) [static]

Sorts array by a field in array element.

Parameters:
string $compareFunction
string $sortFunctionName
array $data
string $className

Definition at line 246 of file ArrayUtil.php.

static findLastKey ( array &$  array  )  [static]

Find the last key in an array

Parameters:
array $array
Returns:
mixed

Definition at line 260 of file ArrayUtil.php.

static getNestedValue ( array $  array,
key 
) [static]

Returns nested value. Key could be like, key, key[subkey], key['subkey']

Parameters:
array $array
$key 
Returns:
array|null

Definition at line 275 of file ArrayUtil.php.

static recursivelyRemoveEmptyValues ( array $  haystack  )  [static]

Remove all empty values

Parameters:
array $haystack
Returns:
array

Definition at line 295 of file ArrayUtil.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Sat Oct 21 07:10:22 2017