Adventure Documentation

Request extends PlatformUtility
in package

Provides access to information about the request.

Tags
link
https://yari-demos.prod.mdn.mozit.cloud/en-US/docs/Web/API/Location/_sample_.anatomy_of_location.html

Table of Contents

getBodyParam()  : mixed|null
Get a body param by name from the current request, HTML-encoded for safe output in an HTML context.
getBodyPayload()  : array<string|int, mixed>
Get a body payload for the current request.
getHash()  : string|null
Get the current request hash.
getHost()  : string
Get the current request host.
getHostname()  : string
Get the current request hostname.
getHref()  : string
Get the current request href.
getObfuscatedSessionId()  : string|null
Get an obfuscated representation of the current session identifier.
getOrigin()  : string
Get the current request origin.
getPathname()  : string|null
Get the current request pathname.
getPathnameAsArray()  : array<string|int, mixed>|null
Get the current request pathname as an array.
getPort()  : int|null
Get the current request port.
getProtocol()  : string
Get the current request protocol.
getRawBodyParam()  : mixed|null
Get a body param by name from the current request without any escaping.
getRemoteAddress()  : string
Get the current request remote address (IP).
getSearch()  : string|null
Get the current request search.
getSearchParam()  : mixed|null
Get a search param by name from the current request.
getType()  : string
Get the current request type as string
getUrl()  : string
Get the current request URL.
isCrawler()  : bool
isDesignPreviewMode()  : bool
redirect()  : void
Make redirection to particular URL address.
redirectTo404()  : void
Make redirection to not-found(404) page.

Methods

getBodyParam()

Get a body param by name from the current request, HTML-encoded for safe output in an HTML context.

public getBodyParam(string $key[, mixed $fallback = null ]) : mixed|null

If the body param does not exists, this function will return the provided default argument instead.

Every current consumer renders the value into HTML, so encoding here protects them all. For a non-HTML context (e.g. JavaScript) use getRawBodyParam() and escape it appropriately for that context.

Parameters
$key : string
$fallback : mixed = null
Tags
Return values
mixed|null

getBodyPayload()

Get a body payload for the current request.

public getBodyPayload() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

getHash()

Get the current request hash.

public getHash() : string|null
Tags
throws
InvalidArgumentException
Return values
string|null

getHost()

Get the current request host.

public getHost() : string
Tags
throws
InvalidArgumentException
Return values
string

getHostname()

Get the current request hostname.

public getHostname() : string
Tags
throws
InvalidArgumentException
Return values
string

getHref()

Get the current request href.

public getHref() : string
Tags
Return values
string

getObfuscatedSessionId()

Get an obfuscated representation of the current session identifier.

public getObfuscatedSessionId() : string|null
Tags
Return values
string|null

getOrigin()

Get the current request origin.

public getOrigin() : string
Tags
throws
InvalidArgumentException
Return values
string

getPathname()

Get the current request pathname.

public getPathname() : string|null
Tags
throws
InvalidArgumentException
Return values
string|null

getPathnameAsArray()

Get the current request pathname as an array.

public getPathnameAsArray() : array<string|int, mixed>|null
Tags
throws
InvalidArgumentException
Return values
array<string|int, mixed>|null

getPort()

Get the current request port.

public getPort() : int|null
Tags
throws
InvalidArgumentException
Return values
int|null

getProtocol()

Get the current request protocol.

public getProtocol() : string
Tags
throws
InvalidArgumentException
Return values
string

getRawBodyParam()

Get a body param by name from the current request without any escaping.

public getRawBodyParam(string $key[, mixed $fallback = null ]) : mixed|null

If the body param does not exists, this function will return the provided default argument instead.

The value is returned as-is (not HTML-encoded, magic quotes not reversed); the caller is responsible for escaping it for whatever context it is used in. Use getBodyParam() for HTML output.

Parameters
$key : string
$fallback : mixed = null
Tags
Return values
mixed|null

getRemoteAddress()

Get the current request remote address (IP).

public getRemoteAddress() : string
Tags
Return values
string

getSearch()

Get the current request search.

public getSearch() : string|null
Tags
throws
InvalidArgumentException
Return values
string|null

getSearchParam()

Get a search param by name from the current request.

public getSearchParam(string $key[, mixed $fallback = null ]) : mixed|null

If the search param does not exists, this function will return the provided default argument instead.

Parameters
$key : string
$fallback : mixed = null
Tags
Return values
mixed|null

getType()

Get the current request type as string

public getType() : string
Tags
Return values
string

getUrl()

Get the current request URL.

public getUrl() : string
Tags
Return values
string

isCrawler()

public isCrawler() : bool
Tags
Return values
bool

isDesignPreviewMode()

public isDesignPreviewMode() : bool
Tags
Return values
bool

redirect()

Make redirection to particular URL address.

public redirect([string $url = null ]) : void
Parameters
$url : string = null
Tags
Return values
void

redirectTo404()

Make redirection to not-found(404) page.

public redirectTo404() : void
Tags
Return values
void

        

Search results