WordPress\AiClient\Providers\Http\DTO

Request::withDatapublicWP 0.1.0

Returns a new instance with the specified data.

Method of the class: Request{}

No Hooks.

Returns

self. A new instance with the data.

Usage

$Request = new Request();
$Request->withData( $data ): self;
$data(required)
.

Changelog

Since 0.1.0 Introduced.

Request::withData() code WP 7.0.4

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;
}