public function testMap() { $expected = array('a' => 'A=IJ', 'b' => 'B=IJK', 'c' => 'C=', 'd' => 'D=IJK'); $callback = function ($value, $key) { return strtoupper($key . '=' . join(array_keys($value))); }; $this->assertEquals($expected, Arr::map($this->input, $callback)); }
/** * Pass each value in an array trough a callback function. It passes both * the value and the key to the callback, as opposed to array_map(). * @param callback $callback * @return Arr */ public function map($callback, $values_only = false) { return new self(Arr::map($this->data, $callback, $values_only)); }