Extbase\Utility
Class Tx_Extbase_Utility_Arrays
public class Tx_Extbase_Utility_Arrays
The array functions from the good old t3lib_div plus new code.
Package: Extbase
Subpackage: Utility
Version: $Id: Arrays.php 1951 2009-03-02 10:51:15Z k-fish $
Subpackage: Utility
Version: $Id: Arrays.php 1951 2009-03-02 10:51:15Z k-fish $
Method Summary
| static array | integerExplode(string $delimiter, string $string) |
| static array | trimExplode(string $delimiter, string $string, boolean $onlyNonEmptyValues=FALSE) |
| static array | arrayMergeRecursiveOverrule(array $firstArray, array $secondArray, mixed $dontAddNewKeys=FALSE, mixed $emptyValuesOverride=TRUE) |
| static array | randomizeArrayOrder(array $array) |
| static boolean | containsMultipleTypes(array $array) |
| static mixed | array_reduce(array $array, string $function, mixed $initial=NULL) |
| static mixed | getValueByPath(array $array, array $path) |
| static boolean | sortKeysRecursively(array $array, integer $sortFlags=NULL) |
Method Detail
integerExplode
public static array integerExplode(string $delimiter, string $string)
Explodes a $string delimited by $delimeter and passes each item in the array through intval().
Corresponds to explode(), but with conversion to integers for all values.
Parameters
$delimiter - Delimiter string to explode with
$string - The string to explode
$string - The string to explode
trimExplode
public static array trimExplode(string $delimiter, string $string, boolean $onlyNonEmptyValues=FALSE)
Explodes a string and trims all values for whitespace in the ends.
If $onlyNonEmptyValues is set, then all blank ('') values are removed.
Parameters
$delimiter - Delimiter string to explode with
$string - The string to explode
$onlyNonEmptyValues - If set, all empty values (='') will NOT be set in output
$string - The string to explode
$onlyNonEmptyValues - If set, all empty values (='') will NOT be set in output
arrayMergeRecursiveOverrule
public static array arrayMergeRecursiveOverrule(array $firstArray, array $secondArray, mixed $dontAddNewKeys=FALSE, mixed $emptyValuesOverride=TRUE)
Merges two arrays recursively and "binary safe" (integer keys are overridden as well), overruling similar values in the first array ($firstArray) with the values of the second array ($secondArray) In case of identical keys, ie. keeping the values of the second.
Parameters
$firstArray - array
$secondArray - array, overruling the first array
$dontAddNewKeys - set, keys that are NOT found in $firstArray (first array) will not be set. Thus only existing value can/will be overruled from second array.
$emptyValuesOverride - set (which is the default), values from $secondArray will overrule if they are empty (according to PHP's empty() function)
$secondArray - array, overruling the first array
$dontAddNewKeys - set, keys that are NOT found in $firstArray (first array) will not be set. Thus only existing value can/will be overruled from second array.
$emptyValuesOverride - set (which is the default), values from $secondArray will overrule if they are empty (according to PHP's empty() function)
randomizeArrayOrder
containsMultipleTypes
array_reduce
public static mixed array_reduce(array $array, string $function, mixed $initial=NULL)
Replacement for array_reduce that allows any type for $initial (instead of only integer)
Parameters
$array - the array to reduce
$function - the reduce function with the same order of parameters as in the native array_reduce (i.e. accumulator first, then current array element)
$initial - the initial accumulator value
$function - the reduce function with the same order of parameters as in the native array_reduce (i.e. accumulator first, then current array element)
$initial - the initial accumulator value