public function testCall() { $sum = function ($one, $two) { return $one + $two; }; $this->assertEqualsMatrix([[11, Std::call($sum, 5, 6)], [[1, 2, 4, 5, 6], Std::call('array_merge', [1, 2], [4, 5], [6])]]); }
/** * Combine all the elements in the traversable using a combining operation. * * @param callable|Closure $closure * @param mixed $initial * * @return mixed */ public function foldlWithKey(callable $closure, $initial) { $accumulator = $initial; foreach ($this->value as $key => $value) { $accumulator = Std::call($closure, $accumulator, $value, $key); } return $accumulator; }
/** * Execute the transform. * * @param array $input * * @return array */ public function run(array $input) { return Std::call($this->inner, $input); }