示例#1
0
 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']);
 }
示例#2
0
文件: Memoize.php 项目: Jir4/Cache
 /**
  * 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];
 }