/** * Filters a value through a set of functions. * * @param mixed $value Value. * @param array $filters Filters. * @return mixed Filtered value. */ private function filter($value, array $filters) { return Traverse::reduce($filters, new Execute(), $value); }
/** * */ public function testReduce() { $data = [1, 2]; $closure = $this->closure([[0, 1, 0, 1], [1, 2, 1, 3]]); $expected = 3; $this->assertEquals($expected, Traverse::reduce($data, $closure, 0)); }