* @return static
*/
public function pluck($value, $key = null)
{
return new static(Arr::pluck($this->items, $value, $key));
}
/**
* Run a map over each of the items.
*
* @param callable $callback
* @return static
*/
public function map(callable $callback)
{
$keys = array_keys($this->items);
$items = array_map($callback, $this->items, $keys);
return new static(array_combine($keys, $items));
}
/**
* Run a dictionary map over the items.
*
* The callback should return an associative array with a single key/value pair.
*
* @param callable $callback
* @return static
*/
public function mapToDictionary(callable $callback)
{
$dictionary = [];
foreach ($this->items as $key => $item) {
$pair = $callback($item, $key);
$key = key($pair);
$value = reset($pair);
Arguments
"Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097160 bytes)"