Eloquent\Phony\Stub\StubData::doesWith PHP Method

doesWith() public method

Add a callback as an answer.
public doesWith ( callable $callback, Arguments | array $arguments = [], boolean | null $prefixSelf = null, boolean $suffixArgumentsObject = false, boolean $suffixArguments = true )
$callback callable The callback.
$arguments Eloquent\Phony\Call\Arguments | array The arguments.
$prefixSelf boolean | null True if the self value should be prefixed.
$suffixArgumentsObject boolean True if the arguments object should be appended.
$suffixArguments boolean True if the arguments should be appended individually.
    public function doesWith($callback, $arguments = array(), $prefixSelf = null, $suffixArgumentsObject = false, $suffixArguments = true)
    {
        if (null === $prefixSelf) {
            $parameters = $this->invocableInspector->callbackReflector($callback)->getParameters();
            $prefixSelf = $parameters && 'phonySelf' === $parameters[0]->getName();
        }
        if (!$arguments instanceof Arguments) {
            $arguments = new Arguments($arguments);
        }
        $this->answers[] = new Answer(new CallRequest($callback, $arguments, $prefixSelf, $suffixArgumentsObject, $suffixArguments), $this->secondaryRequests);
        $this->secondaryRequests = array();
        return $this;
    }