public function case_distribute_arguments() { $this->given($callable = new SUT(function ($x, $y, $z) { return [$x, $y, $z]; }))->when($result = $callable->distributeArguments([7, [4.2], 'foo']))->then->array($result)->isEqualTo([7, [4.2], 'foo']); }
/** * Memoization algorithm. * * @param ... ... Arguments. * @return mixed */ public function __invoke() { $arguments = func_get_args(); $id = md5(serialize($arguments)); if (!isset($this->_arguments[$id])) { $this->_arguments[$id] = $this->_callable->distributeArguments($arguments); } return $this->_arguments[$id]; }