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

Public Member Functions

 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 to create ServerRequest objects

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

Note that this is not public API yet.

Definition at line 34 of file ServerRequestFactory.php.

Member Function Documentation

◆ createServerRequest()

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.

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 175 of file ServerRequestFactory.php.

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

◆ fromGlobals()

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

Create a request from the original superglobal variables.

Returns
ServerRequest
Exceptions

Definition at line 59 of file ServerRequestFactory.php.

References $_SERVER, and TYPO3\CMS\Core\Core\Environment\isCli().

Referenced by TYPO3\CMS\Backend\Routing\UriBuilder\buildUri(), TYPO3\CMS\Backend\Security\EmailLoginNotification\emailAtLogin(), TYPO3\CMS\Core\Tests\Unit\Http\ServerRequestFactoryTest\handlesNumericKeys(), TYPO3\CMS\FrontendLogin\Tests\Unit\Validation\RedirectUrlValidatorTest\isInCurrentDomainIgnoresScheme(), TYPO3\CMS\FrontendLogin\Tests\Unit\Validation\RedirectUrlValidatorTest\isInCurrentDomainReturnsFalseIfDomainsAreDifferent(), TYPO3\CMS\Extbase\Tests\Functional\Mvc\Web\RequestBuilderTest\multipleUploadedFileCanBeRetrievedFromRequest(), TYPO3\CMS\Frontend\Tests\Unit\Http\RequestHandlerTest\resetGlobalsToCurrentRequestDoesNotModifyAnything(), TYPO3\CMS\Frontend\Tests\Unit\Http\RequestHandlerTest\resetGlobalsToCurrentRequestWithModifiedRequestOverridesGlobals(), TYPO3\CMS\Core\Http\AbstractApplication\run(), TYPO3\CMS\FrontendLogin\Tests\Unit\Validation\RedirectUrlValidatorTest\setUpFakeSitePathAndHost(), TYPO3\CMS\Extbase\Tests\Functional\Mvc\Web\RequestBuilderTest\uploadedFileCanBeRetrievedFromRequest(), TYPO3\CMS\Core\Tests\Unit\Http\ServerRequestFactoryTest\uploadedFilesAreNormalizedFromFilesSuperGlobal(), TYPO3\CMS\Core\Tests\Unit\Http\ServerRequestFactoryTest\uploadedFilesAreNotCreatedForEmptyFilesArray(), and TYPO3\CMS\Core\Tests\Unit\Http\ServerRequestFactoryTest\uploadedFilesAreNotCreatedIfTmpNameIsEmpty().

◆ 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 144 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_*

Returns
‪array

Definition at line 107 of file ServerRequestFactory.php.

References $name.