Request::withData( $data ): self

In this article

Returns a new instance with the specified data.

Parameters

mixed> $data The request data.

Return

self A new instance with the data.

Source

public function withData($data): self
{
    $new = clone $this;
    if (is_string($data)) {
        $new->body = $data;
        $new->data = null;
    } elseif (is_array($data)) {
        $new->data = $data;
        $new->body = null;
    } else {
        $new->data = null;
        $new->body = null;
    }
    return $new;
}

Changelog

VersionDescription
0.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.