Eloquent\Phony\Stub\StubData::returns PHP Метод

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

Add an answer that returns a value.
public returns ( mixed $value = null )
$value mixed The return value.
    public function returns($value = null)
    {
        if (0 === func_num_args()) {
            $callback = $this->callback;
            $invocableInspector = $this->invocableInspector;
            $emptyValueFactory = $this->emptyValueFactory;
            $value = null;
            $valueIsSet = false;
            return $this->doesWith(function () use(&$value, &$valueIsSet, $callback, $invocableInspector, $emptyValueFactory) {
                if (!$valueIsSet) {
                    if ($type = $invocableInspector->callbackReturnType($callback)) {
                        $value = $emptyValueFactory->fromType($type);
                    } else {
                        $value = null;
                    }
                    $valueIsSet = true;
                }
                return $value;
            }, array(), false, false, false);
        }
        foreach (func_get_args() as $value) {
            if ($value instanceof InstanceHandle) {
                $value = $value->get();
            }
            $this->doesWith(function () use($value) {
                return $value;
            }, array(), false, false, false);
        }
        return $this;
    }