WordPress\AiClient\Providers\Http\DTO

Request::getUri │ public │ WP 0.1.0

Gets the request URI.

For GET requests with array data, appends the data as query parameters.

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

Хуков нет.

Возвращает

string. The URI.

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

$Request = new Request();
$Request->getUri(): string;

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

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

Код Request::getUri() WP 7.1.2

public function getUri(): string
{
    // If GET request with data, append as query parameters
    if ($this->method === HttpMethodEnum::GET() && $this->data !== null && !empty($this->data)) {
        $separator = str_contains($this->uri, '?') ? '&' : '?';
        return $this->uri . $separator . http_build_query($this->data);
    }
    return $this->uri;
}