Example #1
0
 /**
  * @param mixed|null $context
  * @param array      $arguments
  * @return mixed|null
  */
 public function invoke($context, array $arguments)
 {
     $invocation = new Invocation($context, $arguments);
     $closure = $this->_getClosure($this->getInvocations()->getCount());
     $result = call_user_func_array($closure, $arguments);
     $invocation->setReturnValue($result);
     $this->getInvocations()->add($invocation);
     return $result;
 }
Example #2
0
 /**
  * @param mixed $context
  * @param array $arguments
  * @param mixed $returnValue
  */
 public function addInvocation($context, $arguments, $returnValue)
 {
     $invocation = new Invocation($context, $arguments);
     $invocation->setReturnValue($returnValue);
     $this->getInvocations()->add($invocation);
 }