Eloquent\Phony\Spy\SpyData::invokeWith PHP Метод

invokeWith() публичный Метод

This method supports reference parameters.
public invokeWith ( Arguments | array $arguments = [] ) : mixed
$arguments Eloquent\Phony\Call\Arguments | array The arguments.
Результат mixed The result of invocation.
    public function invokeWith($arguments = array())
    {
        if (!$arguments instanceof Arguments) {
            $arguments = new Arguments($arguments);
        }
        if (!$this->isRecording) {
            return $this->invoker->callWith($this->callback, $arguments);
        }
        $call = $this->callFactory->record($this->callback, $arguments, $this);
        $responseEvent = $call->responseEvent();
        if ($responseEvent instanceof ThrewEvent) {
            $call->setEndEvent($responseEvent);
            throw $responseEvent->exception();
        }
        $returnValue = $responseEvent->value();
        if ($this->useGeneratorSpies && $returnValue instanceof Generator) {
            return $this->generatorSpyFactory->create($call, $returnValue);
        }
        if ($this->useIterableSpies && (is_array($returnValue) || $returnValue instanceof Traversable)) {
            return $this->iterableSpyFactory->create($call, $returnValue);
        }
        $call->setEndEvent($call->responseEvent());
        return $returnValue;
    }