WordPress\AiClient\Providers\Http\DTO

Request::withData │ public │ WP 0.1.0

Returns a new instance with the specified data.

Метод класса: Request{}

Хуков нет.

Возвращает

self. A new instance with the data.

Использование

$Request = new Request();
$Request->withData( $data ): self;
$data(обязательный)
.

Список изменений

С версии 0.1.0 Введена.

Код Request::withData() WP 7.1.2

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