PHP 클래스 Neos\Flow\Http\Request

상속: extends AbstractMessage
파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$arguments array
$attributes array PSR-7
$baseUri Uri
$inputStreamUri string URI for the "input" stream wrapper which can be modified for testing purposes
$method string
$server array Data similar to that which is typically provided by $_SERVER
$uri Uri

공개 메소드들

메소드 설명
__clone ( ) Creates a deep clone
__construct ( array $get, array $post, array $files, array $server ) Constructs a new Request object based on the given environment data.
__toString ( ) : string Cast the request to a string: return the content part of this response
create ( Uri $uri, string $method = 'GET', array $arguments = [], array $files = [], array $server = [] ) : Request Creates a new Request object from the given data.
createActionRequest ( ) : ActionRequest Creates a new Action Request request as a sub request to this HTTP request.
createFromEnvironment ( ) : Request Considers the environment information found in PHP's superglobals and Flow's environment configuration and creates a new instance of this Request class matching that data.
getAcceptedMediaTypes ( ) : array Returns an list of IANA media types defined in the Accept header.
getArgument ( string $name ) : mixed Returns the value of the specified GET / POST / PUT argument.
getArguments ( ) : array Returns the unified arguments of this request.
getAttribute ( string $name, mixed $default = null ) : mixed PSR-7
getAttributes ( ) : mixed[] PSR-7
getBaseUri ( ) : Uri Returns the detected base URI
getClientIpAddress ( ) : string Returns the best guess of the client's IP address.
getContent ( boolean $asResource = false ) : string | resource Returns the content of the request body
getMethod ( ) : string Returns the request method
getNegotiatedMediaType ( array $supportedMediaTypes, boolean $trim = true ) : string Returns the best fitting IANA media type after applying the content negotiation rules on a possible Accept header.
getPort ( ) : integer Returns the port used for this request
getRelativePath ( ) : string Returns the request's path relative to the $baseUri
getRequestLine ( ) : string Return the Request-Line of this Request Message, consisting of the method, the uri and the HTTP version Would be, for example, "GET /foo?bar=baz HTTP/1.1" Note that the URI part is, at the moment, only possible in the form "abs_path" since the actual requestUri of the Request cannot be determined during the creation of the Request.
getScriptRequestPath ( ) : string Returns the relative path (ie. relative to the web root) to the script as it was accessed through the web server.
getScriptRequestPathAndFilename ( ) : string Returns the relative path (ie. relative to the web root) and name of the script as it was accessed through the web server.
getServerParams ( ) : array PSR-7
getStartLine ( ) : string Returns the first line of this Request Message, which is the Request-Line in this case
getUri ( ) : Uri Returns the request URI
hasArgument ( string $name ) : boolean Checks if an argument of the given name exists in this request.
isMethodSafe ( ) : boolean Tells if the request method is "safe", that is, it is expected to not take any other action than retrieval. This should the case with "GET" and "HEAD" requests.
isSecure ( ) : boolean Indicates if this request has been received through a secure channel.
mediaRangeMatches ( string $mediaRange, string $mediaType ) : boolean Checks if the given media range and the media type match.
parseContentNegotiationQualityValues ( string $rawValues ) : array Parses a RFC 2616 content negotiation header field by evaluating the Quality Values and splitting the options into an array list, ordered by user preference.
parseMediaType ( string $rawMediaType ) : array Parses a RFC 2616 Media Type and returns its parts in an associative array.
renderHeaders ( ) : string Renders the HTTP headers - including the status header - of this request
setBaseUri ( Uri $baseUri )
setContent ( string | resource $content ) : void Explicitly sets the content of the request body
setMethod ( string $method ) : void Sets the request method
trimMediaType ( string $rawMediaType ) : string Strips off any parameters from the given media type and returns just the type and subtype in the format "type/subtype".
withAttribute ( string $name, mixed $value ) : self PSR-7
withoutAttribute ( string $name ) : self PSR-7

보호된 메소드들

메소드 설명
buildUnifiedArguments ( array $getArguments, array $postArguments, array $uploadArguments ) : array Takes the raw GET & POST arguments and maps them into the request object.
calculateFieldPaths ( array $structure, string $firstLevelFieldName = null ) : array Returns and array of all possibles "field paths" for the given array.
detectBaseUri ( ) : void Tries to detect the base URI of request.
setAttribute ( string $name, mixed $value )
unsetAttribute ( string $name )
untangleFilesArray ( array $convolutedFiles ) : array Transforms the convoluted _FILES superglobal into a manageable form.

메소드 상세

__clone() 공개 메소드

Creates a deep clone
public __clone ( )

__construct() 공개 메소드

Constructs a new Request object based on the given environment data.
또한 보기: create()
또한 보기: createFromEnvironment()
public __construct ( array $get, array $post, array $files, array $server )
$get array Data similar to that which is typically provided by $_GET
$post array Data similar to that which is typically provided by $_POST
$files array Data similar to that which is typically provided by $_FILES
$server array Data similar to that which is typically provided by $_SERVER

__toString() 공개 메소드

Cast the request to a string: return the content part of this response
public __toString ( ) : string
리턴 string The same as getContent()

buildUnifiedArguments() 보호된 메소드

Afterwards all mapped arguments can be retrieved by the getArgument(s) method, no matter if they have been GET, POST or PUT arguments before.
protected buildUnifiedArguments ( array $getArguments, array $postArguments, array $uploadArguments ) : array
$getArguments array Arguments as found in $_GET
$postArguments array Arguments as found in $_POST
$uploadArguments array Arguments as found in $_FILES
리턴 array the unified arguments

calculateFieldPaths() 보호된 메소드

Returns and array of all possibles "field paths" for the given array.
protected calculateFieldPaths ( array $structure, string $firstLevelFieldName = null ) : array
$structure array The array to walk through
$firstLevelFieldName string
리턴 array An array of paths (as strings) in the format "key1/key2/key3" ...

create() 공개 정적인 메소드

Creates a new Request object from the given data.
public static create ( Uri $uri, string $method = 'GET', array $arguments = [], array $files = [], array $server = [] ) : Request
$uri Uri The request URI
$method string Request method, for example "GET"
$arguments array Arguments to send in the request body
$files array
$server array
리턴 Request

createActionRequest() 공개 메소드

Maps the arguments of this request to the new Action Request.
사용 중단: since Flow 2.3. Create the ActionRequest manually instead: $actionRequest = new ActionRequest($httpRequest)
public createActionRequest ( ) : ActionRequest
리턴 Neos\Flow\Mvc\ActionRequest

createFromEnvironment() 공개 정적인 메소드

Considers the environment information found in PHP's superglobals and Flow's environment configuration and creates a new instance of this Request class matching that data.
public static createFromEnvironment ( ) : Request
리턴 Request

detectBaseUri() 보호된 메소드

Tries to detect the base URI of request.
protected detectBaseUri ( ) : void
리턴 void

getAcceptedMediaTypes() 공개 메소드

The list is ordered by user preference, after evaluating the Quality Values specified in the header field value. First items in the list are the most preferred. If no Accept header is present, the media type representing "any" media type is returned.
public getAcceptedMediaTypes ( ) : array
리턴 array A list of media types and sub types

getArgument() 공개 메소드

Returns the value of the specified GET / POST / PUT argument.
public getArgument ( string $name ) : mixed
$name string Name of the argument
리턴 mixed Value of the specified argument or NULL if it does not exist

getArguments() 공개 메소드

GET, POST and PUT arguments, as well es uploaded files, are merged into a whole array of arguments.
public getArguments ( ) : array
리턴 array

getAttribute() 공개 메소드

Retrieve a single derived request attribute. Retrieves a single derived request attribute as described in getAttributes(). If the attribute has not been previously set, returns the default value as provided. This method obviates the need for a hasAttribute() method, as it allows specifying a default value to return if the attribute is not found.
또한 보기: getAttributes()
public getAttribute ( string $name, mixed $default = null ) : mixed
$name string The attribute name.
$default mixed Default value to return if the attribute does not exist.
리턴 mixed

getAttributes() 공개 메소드

Retrieve attributes derived from the request. The request "attributes" may be used to allow injection of any parameters derived from the request: e.g., the results of path match operations; the results of decrypting cookies; the results of deserializing non-form-encoded message bodies; etc. Attributes will be application and request specific, and CAN be mutable.
public getAttributes ( ) : mixed[]
리턴 mixed[] Attributes derived from the request.

getBaseUri() 공개 메소드

Returns the detected base URI
public getBaseUri ( ) : Uri
리턴 Uri

getClientIpAddress() 공개 메소드

Note that, depending on the actual source used, IP addresses can be spoofed and may not be reliable. Although several kinds of proxy headers are taken into account, certain combinations of ISPs and proxies might still produce wrong results. Don't rely on the client IP address as the only security measure!
public getClientIpAddress ( ) : string
리턴 string The client's IP address

getContent() 공개 메소드

If the request body has not been set with setContent() previously, this method will try to retrieve it from the input stream. If $asResource was set to TRUE, the stream resource will be returned instead of a string. If the content which has been set by setContent() originally was a stream resource, that resource will be returned, no matter if $asResource is set.
public getContent ( boolean $asResource = false ) : string | resource
$asResource boolean If set, the content is returned as a resource pointing to PHP's input stream
리턴 string | resource

getMethod() 공개 메소드

Returns the request method
public getMethod ( ) : string
리턴 string The request method

getNegotiatedMediaType() 공개 메소드

Returns the best fitting IANA media type after applying the content negotiation rules on a possible Accept header.
public getNegotiatedMediaType ( array $supportedMediaTypes, boolean $trim = true ) : string
$supportedMediaTypes array A list of media types which are supported by the application / controller
$trim boolean If TRUE, only the type/subtype of the media type is returned. If FALSE, the full original media type string is returned.
리턴 string The media type and sub type which matched, NULL if none matched

getPort() 공개 메소드

Returns the port used for this request
public getPort ( ) : integer
리턴 integer

getRelativePath() 공개 메소드

Returns the request's path relative to the $baseUri
public getRelativePath ( ) : string
리턴 string

getRequestLine() 공개 메소드

Return the Request-Line of this Request Message, consisting of the method, the uri and the HTTP version Would be, for example, "GET /foo?bar=baz HTTP/1.1" Note that the URI part is, at the moment, only possible in the form "abs_path" since the actual requestUri of the Request cannot be determined during the creation of the Request.
또한 보기: http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1
public getRequestLine ( ) : string
리턴 string

getScriptRequestPath() 공개 메소드

Returns the relative path (ie. relative to the web root) to the script as it was accessed through the web server.
public getScriptRequestPath ( ) : string
리턴 string Relative path to the PHP script as accessed through the web

getScriptRequestPathAndFilename() 공개 메소드

Returns the relative path (ie. relative to the web root) and name of the script as it was accessed through the web server.
public getScriptRequestPathAndFilename ( ) : string
리턴 string Relative path and name of the PHP script as accessed through the web

getServerParams() 공개 메소드

Retrieve server parameters. Retrieves data related to the incoming request environment, typically derived from PHP's $_SERVER superglobal. The data IS NOT REQUIRED to originate from $_SERVER.
public getServerParams ( ) : array
리턴 array

getStartLine() 공개 메소드

Returns the first line of this Request Message, which is the Request-Line in this case
또한 보기: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html chapter 4.1 "Message Types"
public getStartLine ( ) : string
리턴 string The Request-Line of this Request

getUri() 공개 메소드

Returns the request URI
public getUri ( ) : Uri
리턴 Uri

hasArgument() 공개 메소드

Applies to GET, POST and PUT arguments similarly.
public hasArgument ( string $name ) : boolean
$name string Name of the argument
리턴 boolean

isMethodSafe() 공개 메소드

Tells if the request method is "safe", that is, it is expected to not take any other action than retrieval. This should the case with "GET" and "HEAD" requests.
public isMethodSafe ( ) : boolean
리턴 boolean

isSecure() 공개 메소드

Indicates if this request has been received through a secure channel.
public isSecure ( ) : boolean
리턴 boolean

mediaRangeMatches() 공개 정적인 메소드

Checks if the given media range and the media type match.
또한 보기: MediaTypes::mediaRangeMatches()
사용 중단: since Flow 2.1. Use \Neos\Utility\MediaTypes::mediaRangeMatches() instead
public static mediaRangeMatches ( string $mediaRange, string $mediaType ) : boolean
$mediaRange string The media range, for example "text/*"
$mediaType string The media type to match against, for example "text/html"
리턴 boolean TRUE if both match, FALSE if they don't match or either of them is invalid

parseContentNegotiationQualityValues() 공개 정적인 메소드

Parses a RFC 2616 content negotiation header field by evaluating the Quality Values and splitting the options into an array list, ordered by user preference.
public static parseContentNegotiationQualityValues ( string $rawValues ) : array
$rawValues string The raw Accept* Header field value
리턴 array The parsed list of field values, ordered by user preference

parseMediaType() 공개 정적인 메소드

Parses a RFC 2616 Media Type and returns its parts in an associative array.
또한 보기: MediaTypes::parseMediaType()
사용 중단: since Flow 2.1. Use \Neos\Utility\MediaTypes::parseMediaType() instead
public static parseMediaType ( string $rawMediaType ) : array
$rawMediaType string The raw media type, for example "application/json; charset=UTF-8"
리턴 array An associative array with parsed information

renderHeaders() 공개 메소드

Renders the HTTP headers - including the status header - of this request
public renderHeaders ( ) : string
리턴 string The HTTP headers, one per line, separated by \r\n as required by RFC 2616 sec 5

setAttribute() 보호된 메소드

protected setAttribute ( string $name, mixed $value )
$name string The attribute name.
$value mixed The value of the attribute.

setBaseUri() 공개 메소드

public setBaseUri ( Uri $baseUri )
$baseUri Uri

setContent() 공개 메소드

In most cases, content is just a string representation of the request body. In order to reduce memory consumption for uploads and other big data, it is also possible to pass a stream resource. The easies way to convert a local file into a stream resource is probably: $resource = fopen('file://path/to/file', 'rb');
public setContent ( string | resource $content ) : void
$content string | resource The body content, for example arguments of a PUT request, or a stream resource
리턴 void

setMethod() 공개 메소드

Sets the request method
public setMethod ( string $method ) : void
$method string The request method, for example "GET".
리턴 void

trimMediaType() 공개 정적인 메소드

Strips off any parameters from the given media type and returns just the type and subtype in the format "type/subtype".
또한 보기: Neos\Utility\MediaTypes::trimMediaType()
사용 중단: since Flow 2.1. Use \Neos\Utility\MediaTypes::trimMediaType() instead
public static trimMediaType ( string $rawMediaType ) : string
$rawMediaType string The full media type, for example "application/json; charset=UTF-8"
리턴 string Just the type and subtype, for example "application/json"

unsetAttribute() 보호된 메소드

protected unsetAttribute ( string $name )
$name string The attribute name.

untangleFilesArray() 보호된 메소드

Transforms the convoluted _FILES superglobal into a manageable form.
protected untangleFilesArray ( array $convolutedFiles ) : array
$convolutedFiles array The _FILES superglobal
리턴 array Untangled files

withAttribute() 공개 메소드

Return an instance with the specified derived request attribute. This method allows setting a single derived request attribute as described in getAttributes(). This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the updated attribute.
또한 보기: getAttributes()
public withAttribute ( string $name, mixed $value ) : self
$name string The attribute name.
$value mixed The value of the attribute.
리턴 self

withoutAttribute() 공개 메소드

Return an instance that removes the specified derived request attribute. This method allows removing a single derived request attribute as described in getAttributes(). This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that removes the attribute.
또한 보기: getAttributes()
public withoutAttribute ( string $name ) : self
$name string The attribute name.
리턴 self

프로퍼티 상세

$arguments 보호되어 있는 프로퍼티

protected array $arguments
리턴 array

$attributes 보호되어 있는 프로퍼티

PSR-7
protected array $attributes
리턴 array

$baseUri 보호되어 있는 프로퍼티

protected Uri,Neos\Flow\Http $baseUri
리턴 Uri

$inputStreamUri 보호되어 있는 프로퍼티

URI for the "input" stream wrapper which can be modified for testing purposes
protected string $inputStreamUri
리턴 string

$method 보호되어 있는 프로퍼티

protected string $method
리턴 string

$server 보호되어 있는 프로퍼티

Data similar to that which is typically provided by $_SERVER
protected array $server
리턴 array

$uri 보호되어 있는 프로퍼티

protected Uri,Neos\Flow\Http $uri
리턴 Uri