You are here

private static function Serializer::createUriFromRequestTarget in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-diactoros/src/Request/Serializer.php \Zend\Diactoros\Request\Serializer::createUriFromRequestTarget()

Create and return a Uri instance based on the provided request target.

If the request target is of authority or asterisk form, an empty Uri instance is returned; otherwise, the value is used to create and return a new Uri instance.

Parameters

string $requestTarget:

Return value

Uri

1 call to Serializer::createUriFromRequestTarget()
Serializer::fromStream in vendor/zendframework/zend-diactoros/src/Request/Serializer.php
Deserialize a request stream to a request instance.

File

vendor/zendframework/zend-diactoros/src/Request/Serializer.php, line 135

Class

Serializer
Serialize (cast to string) or deserialize (cast string to Request) messages.

Namespace

Zend\Diactoros\Request

Code

private static function createUriFromRequestTarget($requestTarget) {
  if (preg_match('#^https?://#', $requestTarget)) {
    return new Uri($requestTarget);
  }
  if (preg_match('#^(\\*|[^/])#', $requestTarget)) {
    return new Uri();
  }
  return new Uri($requestTarget);
}