Méthode | Description | |
---|---|---|
keymap ( Traversable $traversable, Closure $key, Closure $value = null ) : array | Creates an associative array from iterator which doesn't return proper keys. | |
range ( mixed $low, mixed $high, Closure $step, Closure $compare = null ) : array | Creates an array containing item range. Similar to range() but with closures. |
$data = \Jyxo\Spl\ArrayUtil::keymap($iterator, function(Object $object) {
return $object->getId();
});
public static keymap ( Traversable $traversable, Closure $key, Closure $value = null ) : array | ||
$traversable | Traversable | Iterator |
$key | Closure | Closure for generating keys |
$value | Closure | Closure for modifying data (Optional) |
Résultat | array |
public static range ( mixed $low, mixed $high, Closure $step, Closure $compare = null ) : array | ||
$low | mixed | Minimal value |
$high | mixed | Maximal value |
$step | Closure | Closure which creates next value from current |
$compare | Closure | comparing closure for detecting if we're at the end of the range (Optional) |
Résultat | array |