Beispiel #1
0
 /**
  * @dataProvider dataMapProvider
  *
  * @param $callback
  * @param $array
  * @param $expect
  */
 public function testMap($callback, $array, $expect)
 {
     $actual = Arrays::map($array, $callback);
     $this->assertEquals($expect, $actual);
     $this->assertEquals(json_encode($expect), json_encode($actual));
 }
Beispiel #2
0
 /**
  * @param callable $callback
  * @param int $limit
  * @return $this
  */
 public function map(callable $callback, $limit = -1)
 {
     $items = $this->toArray();
     $array = Arrays::map($items, $callback, $limit);
     return $this->wrap($array);
 }