public function RequestTrait::getRequestTarget in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-diactoros/src/RequestTrait.php \Zend\Diactoros\RequestTrait::getRequestTarget()
Retrieves the message's request target.
Retrieves the message's request-target either as it will appear (for clients), as it appeared at request (for servers), or as it was specified for the instance (see withRequestTarget()).
In most cases, this will be the origin-form of the composed URI, unless a value was provided to the concrete implementation (see withRequestTarget() below).
If no URI is available, and no request-target has been specifically provided, this method MUST return the string "/".
Return value
string
File
- vendor/
zendframework/ zend-diactoros/ src/ RequestTrait.php, line 108
Class
- RequestTrait
- Trait with common request behaviors.
Namespace
Zend\DiactorosCode
public function getRequestTarget() {
if (null !== $this->requestTarget) {
return $this->requestTarget;
}
if (!$this->uri) {
return '/';
}
$target = $this->uri
->getPath();
if ($this->uri
->getQuery()) {
$target .= '?' . $this->uri
->getQuery();
}
if (empty($target)) {
$target = '/';
}
return $target;
}