public function RequestTrait::withRequestTarget in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-diactoros/src/RequestTrait.php \Zend\Diactoros\RequestTrait::withRequestTarget()
Create a new instance with a specific request-target.
If the request needs a non-origin-form request-target — e.g., for specifying an absolute-form, authority-form, or asterisk-form — this method may be used to create an instance with the specified request-target, verbatim.
This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return a new instance that has the changed request target.
@link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various request-target forms allowed in request messages)
Parameters
mixed $requestTarget:
Return value
static
Throws
InvalidArgumentException if the request target is invalid.
File
- vendor/
zendframework/ zend-diactoros/ src/ RequestTrait.php, line 148
Class
- RequestTrait
- Trait with common request behaviors.
Namespace
Zend\DiactorosCode
public function withRequestTarget($requestTarget) {
if (preg_match('#\\s#', $requestTarget)) {
throw new InvalidArgumentException('Invalid request target provided; cannot contain whitespace');
}
$new = clone $this;
$new->requestTarget = $requestTarget;
return $new;
}