marshalUriFromServer() публичный статический Метод

Marshal the URI from the $_SERVER array and headers
public static marshalUriFromServer ( array $server, array $headers ) : Uri
$server array
$headers array
Результат Uri
Пример #1
0
 public static function fromGlobals(array $server = null, array $query = null, array $body = null, array $cookies = null, array $files = null)
 {
     $server = parent::normalizeServer($server);
     $files = parent::normalizeFiles($files);
     $headers = parent::marshalHeaders($server);
     return new ServerRequest($server, $files, parent::marshalUriFromServer($server, $headers), parent::get('REQUEST_METHOD', $server, 'GET'), 'php://input', $headers, $cookies, $query, $body, self::marshalProtocolVersion($server));
 }
Пример #2
0
 /**
  * Creates a PSR-7 compatible request
  *
  * @param \TYPO3\Flow\Http\Request $nativeRequest Flow request object
  * @param array $files List of uploaded files like in $_FILES
  * @param array $query List of uploaded files like in $_GET
  * @param array $post List of uploaded files like in $_POST
  * @param array $cookies List of uploaded files like in $_COOKIES
  * @param array $server List of uploaded files like in $_SERVER
  * @return \Psr\Http\Message\ServerRequestInterface PSR-7 request object
  */
 protected function createRequest(array $files, array $query, array $post, array $cookies, array $server)
 {
     if (!isset($server['HTTP_HOST'])) {
         $server['HTTP_HOST'] = 'localhost';
     }
     $files = ServerRequestFactory::normalizeFiles($files);
     $server = ServerRequestFactory::normalizeServer($server);
     $headers = ServerRequestFactory::marshalHeaders($server);
     $uri = ServerRequestFactory::marshalUriFromServer($server, $headers);
     $method = ServerRequestFactory::get('REQUEST_METHOD', $server, 'GET');
     return new ServerRequest($server, $files, $uri, $method, 'php://input', $headers, $cookies, $query, $post);
 }
Пример #3
0
 /**
  * Sapi constructor.
  *
  * @param EmitterInterface                $sapiEmitter
  * @param array|null                      $server
  * @param array|null                      $queryParams
  * @param array|object|null               $parsedBody
  * @param array|null                      $cookies
  * @param array|null                      $files
  * @param string|resource|StreamInterface $messageBody
  *
  * @SuppressWarnings(PHPMD.StaticAccess)
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function __construct(EmitterInterface $sapiEmitter, array $server = null, array $queryParams = null, array $parsedBody = null, array $cookies = null, array $files = null, $messageBody = 'php://input')
 {
     $this->sapiEmitter = $sapiEmitter;
     // returns value if not null or $fallback otherwise
     $get = function ($nullable, $fallback) {
         return $nullable !== null ? $nullable : $fallback;
     };
     // Code below based on ServerRequestFactory::fromGlobals
     $this->server = ServerRequestFactory::normalizeServer($get($server, $_SERVER));
     $this->files = ServerRequestFactory::normalizeFiles($get($files, $_FILES));
     $this->headers = ServerRequestFactory::marshalHeaders($this->server);
     $this->uri = ServerRequestFactory::marshalUriFromServer($this->server, $this->headers);
     $this->method = ServerRequestFactory::get('REQUEST_METHOD', $this->server, 'GET');
     $this->cookies = $get($cookies, $_COOKIE);
     $this->queryParams = $get($queryParams, $_GET);
     $this->parsedBody = $get($parsedBody, $_POST);
     $this->messageBody = $messageBody;
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 public function getServerRequest()
 {
     $query = $this->getQuery();
     $post = $this->getPost();
     $cookies = $this->getCookies();
     $server = ServerRequestFactory::normalizeServer($this->params);
     $headers = ServerRequestFactory::marshalHeaders($server);
     $uri = ServerRequestFactory::marshalUriFromServer($server, $headers);
     $method = ServerRequestFactory::get('REQUEST_METHOD', $server, 'GET');
     $request = new ServerRequest($server, [], $uri, $method, $this->stdin, $headers);
     return $request->withCookieParams($cookies)->withQueryParams($query)->withParsedBody($post);
 }