43 $this->method = strtoupper(
$method);
52 if ($body !==
'' && $body !== null) {
59 if ($this->requestTarget !== null) {
63 $target = $this->uri->getPath();
67 if ($this->uri->getQuery() !=
'') {
68 $target .=
'?' . $this->uri->getQuery();
78 'Invalid request target provided; cannot contain whitespace' 106 if ($uri === $this->uri) {
113 if (!$preserveHost) {
114 $new->updateHostFromUri();
122 $host = $this->uri->getHost();
128 if (($port = $this->uri->getPort()) !== null) {
129 $host .=
':' . $port;
132 if (isset($this->headerNames[
'host'])) {
133 $header = $this->headerNames[
'host'];
136 $this->headerNames[
'host'] =
'Host';
140 $this->headers = [
$header => [$host]] + $this->headers;
getUri()
Retrieves the URI instance.
withUri(UriInterface $uri, $preserveHost=false)
Returns an instance with the provided URI.
Value object representing a URI.
__construct( $method, $uri, array $headers=[], $body=null, $version='1.1')
PSR-7 URI implementation.
setHeaders(array $headers)
withRequestTarget($requestTarget)
Return an instance with the specific request-target.
getRequestTarget()
Retrieves the message's request target.
stream_for($resource='', array $options=[])
Create a new stream based on the input type.
PSR-7 request implementation.
trait MessageTrait
Trait implementing functionality common to requests and responses.
getMethod()
Retrieves the HTTP method of the request.
Create styles array
The data for the language used.
Representation of an outgoing, client-side request.
withMethod($method)
Return an instance with the provided HTTP method.
hasHeader($name)
Checks if a header exists by the given case-insensitive name.