Пример #1
0
 /**
  * @dataProvider dataMapFilterProvider
  *
  * @param $map
  * @param $filter
  * @param $array
  * @param $expect
  */
 public function testMapFilter($map, $filter, $array, $expect)
 {
     $actual = Arrays::mapFilter($array, $map, $filter);
     $this->assertEquals($expect, $actual);
     $this->assertEquals(json_encode($expect), json_encode($actual));
 }
Пример #2
0
 /**
  * @param callable $map
  * @param callable $filter
  * @param int $limit
  * @return $this
  */
 public function mapFilter(callable $map, callable $filter, $limit = -1)
 {
     $items = $this->toArray();
     $array = Arrays::mapFilter($items, $map, $filter, $limit);
     return $this->wrap($array);
 }