‪TYPO3CMS  10.4
TYPO3\CMS\Core\Http\ServerRequestFactory Class Reference
Inheritance diagram for TYPO3\CMS\Core\Http\ServerRequestFactory:

Public Member Functions

ServerRequestInterface createServerRequest (string $method, $uri, array $serverParams=[])
 

Static Public Member Functions

static ServerRequest fromGlobals ()
 

Static Protected Member Functions

static array prepareHeaders (array $server)
 
static array normalizeUploadedFiles (array $files)
 
static UploadedFileInterface[] UploadedFileInterface null createUploadedFile (array $value)
 

Detailed Description

Class ServerRequestFactory to create ServerRequest objects

Highly inspired by https://github.com/phly/http/

Note that this is not public API yet.

Definition at line 33 of file ServerRequestFactory.php.

Member Function Documentation

◆ createServerRequest()

ServerRequestInterface TYPO3\CMS\Core\Http\ServerRequestFactory::createServerRequest ( string  $method,
  $uri,
array  $serverParams = [] 
)

Create a new server request.

Note that server-params are taken precisely as given - no parsing/processing of the given values is performed, and, in particular, no attempt is made to determine the HTTP method or URI, which must be provided explicitly.

Parameters
string$method‪The HTTP method associated with the request.
UriInterface | string$uri‪The URI associated with the request.
array$serverParams‪Array of SAPI parameters with which to seed the generated request instance.
Returns
‪ServerRequestInterface

Definition at line 47 of file ServerRequestFactory.php.

◆ createUploadedFile()

static UploadedFileInterface [] UploadedFileInterface null TYPO3\CMS\Core\Http\ServerRequestFactory::createUploadedFile ( array  $value)
staticprotected

Create and return an UploadedFile instance from a $_FILES specification.

If the specification represents an array of values, this method will recursively resolve uploaded files.

Parameters
array$value‪$_FILES structure
Returns
‪UploadedFileInterface[]|UploadedFileInterface|null

Definition at line 168 of file ServerRequestFactory.php.

Referenced by TYPO3\CMS\Core\Http\ServerRequestFactory\normalizeUploadedFiles().

◆ fromGlobals()

static ServerRequest TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals ( )
static

◆ normalizeUploadedFiles()

static array TYPO3\CMS\Core\Http\ServerRequestFactory::normalizeUploadedFiles ( array  $files)
staticprotected

Normalize uploaded files

Transforms each value into an UploadedFileInterface instance, and ensures that nested arrays are normalized.

Parameters
array$files
Returns
‪array
Exceptions

Definition at line 137 of file ServerRequestFactory.php.

References TYPO3\CMS\Core\Http\ServerRequestFactory\createUploadedFile().

◆ prepareHeaders()

static array TYPO3\CMS\Core\Http\ServerRequestFactory::prepareHeaders ( array  $server)
staticprotected

Fetch headers from $_SERVER variables which are only the ones starting with HTTP_* and CONTENT_*

Parameters
array$server
Returns
‪array

Definition at line 100 of file ServerRequestFactory.php.