コード例 #1
0
ファイル: ArrTest.php プロジェクト: Acidburn0zzz/OEM
 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));
 }
コード例 #2
0
ファイル: ArrObject.php プロジェクト: Acidburn0zzz/OEM
 /**
  * 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));
 }