PHP Class Kraken\Util\Support\ArraySupport

Afficher le fichier Open project: kraken-php/framework Class Usage Examples

Méthodes publiques

Méthode Description
exists ( array $array, string $key ) : boolean Check if given key exists in array with dot notation support.
expand ( $array ) : array Expand flattened array into a multi-dimensional one.
flatten ( array $array ) : array Flatten a multi-dimensional array into a single level using dot notation.
get ( array $array, string $key, mixed $default = null ) : mixed Return the value stored under given key in the array with dot notation support.
isEmpty ( array $array ) : boolean Check if given array is empty.
merge ( array[] $arrays ) : array Merge several arrays, preserving dot notation.
normalizeKey ( string $key ) : string Normalize key to dot notation valid format.
remove ( &$array, string $key ) : boolean Remove the value stored under given key from the array with dot notation support.
replace ( array[] $arrays ) : array Merge several arrays.
set ( &$array, string $key, mixed $value ) : array Set the value for given key in the array with dot notation support.

Méthodes protégées

Méthode Description
flattenRecursive ( array &$recursion, string $prefix ) : array Flatten a single recursion of array.

Method Details

exists() public static méthode

Check if given key exists in array with dot notation support.
public static exists ( array $array, string $key ) : boolean
$array array
$key string
Résultat boolean

expand() public static méthode

Expand flattened array into a multi-dimensional one.
public static expand ( $array ) : array
$array
Résultat array

flatten() public static méthode

Flatten a multi-dimensional array into a single level using dot notation.
public static flatten ( array $array ) : array
$array array
Résultat array

flattenRecursive() protected static méthode

Flatten a single recursion of array.
protected static flattenRecursive ( array &$recursion, string $prefix ) : array
$recursion array
$prefix string
Résultat array

get() public static méthode

Return the value stored under given key in the array with dot notation support.
public static get ( array $array, string $key, mixed $default = null ) : mixed
$array array
$key string
$default mixed
Résultat mixed

isEmpty() public static méthode

Check if given array is empty.
public static isEmpty ( array $array ) : boolean
$array array
Résultat boolean

merge() public static méthode

Merge several arrays, preserving dot notation.
public static merge ( array[] $arrays ) : array
$arrays array[]
Résultat array

normalizeKey() public static méthode

Normalize key to dot notation valid format.
public static normalizeKey ( string $key ) : string
$key string
Résultat string

remove() public static méthode

Remove the value stored under given key from the array with dot notation support.
public static remove ( &$array, string $key ) : boolean
$key string
Résultat boolean

replace() public static méthode

Merge several arrays.
public static replace ( array[] $arrays ) : array
$arrays array[]
Résultat array

set() public static méthode

Set the value for given key in the array with dot notation support.
public static set ( &$array, string $key, mixed $value ) : array
$key string
$value mixed
Résultat array