/**
  * (non-PHPdoc)
  * @see mock/LimeMockBehaviour#invoke($invocation)
  */
 public function invoke(LimeMockInvocation $invocation)
 {
     if (array_key_exists($this->cursor, $this->invocations)) {
         $invocationExpectation = $this->invocations[$this->cursor];
         if ($invocationExpectation->matches($invocation) && $invocationExpectation->isInvokable()) {
             return $invocationExpectation->invoke($invocation);
         } else {
             if ($invocationExpectation->isSatisfied()) {
                 $this->cursor++;
                 return $this->invoke($invocation);
             }
         }
     }
     parent::invoke($invocation);
 }
 /**
  * (non-PHPdoc)
  * @see mock/LimeMockBehaviour#invoke($invocation)
  */
 public function invoke(LimeMockInvocation $invocation)
 {
     $exceptionStack = new LimeMockInvocationExceptionStack();
     foreach ($this->invocations as $invocationExpectation) {
         try {
             if ($invocationExpectation->matches($invocation)) {
                 return $invocationExpectation->invoke($invocation);
             }
         } catch (LimeMockInvocationException $e) {
             // make sure to test all expectations
             $exceptionStack->add($e);
         }
     }
     // no invocation matched and at least one exception was thrown
     if (!$exceptionStack->isEmpty()) {
         throw $exceptionStack;
     }
     parent::invoke($invocation);
 }