MediaWiki  master
DerivativeRequest Class Reference

Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base request for the remaining stuff (cookies, session and headers). More...

Inheritance diagram for DerivativeRequest:
Collaboration diagram for DerivativeRequest:

Public Member Functions

 __construct (WebRequest $base, $data, $wasPosted=false)
 
 getAcceptLang ()
 
 getAllHeaders ()
 
 getCookie ( $key, $prefix=null, $default=null)
 
 getElapsedTime ()
 
 getHeader ( $name, $flags=0)
 
 getIP ()
 
 getProtocol ()
 
 getSession ()
 
 getSessionData ( $key)
 
 setIP ( $ip)
 
 setSessionData ( $key, $data)
 
- Public Member Functions inherited from FauxRequest
 __construct ( $data=[], $wasPosted=false, $session=null, $protocol='http')
 
 checkUrlExtension ( $extWhitelist=[])
 
 getCookie ( $key, $prefix=null, $default=null)
 
 getMethod ()
 
 getProtocol ()
 
 getQueryValues ()
 
 getRawInput ()
 FauxRequests shouldn't depend on raw request data (but that could be implemented here) More...
 
 getRawPostString ()
 FauxRequests shouldn't depend on raw request data (but that could be implemented here) More...
 
 getRawQueryString ()
 FauxRequests shouldn't depend on raw request data (but that could be implemented here) More...
 
 getRequestURL ()
 
 getSessionArray ()
 
 getText ( $name, $default='')
 
 setCookie ( $key, $value, $prefix=null)
 
 setCookies ( $cookies, $prefix=null)
 
 setHeader ( $name, $val)
 
 setHeaders ( $headers)
 
 setRequestURL ( $url)
 
 wasPosted ()
 
- Public Member Functions inherited from WebRequest
 __construct ()
 
 appendQueryArray ( $array)
 Appends or replaces value of query variables. More...
 
 appendQueryValue ( $key, $value)
 
 checkUrlExtension ( $extWhitelist=[])
 Check if Internet Explorer will detect an incorrect cache extension in PATH_INFO or QUERY_STRING. More...
 
 getAcceptLang ()
 Parse the Accept-Language header sent by the client into an array. More...
 
 getAllHeaders ()
 Get an array containing all request headers. More...
 
 getArray ( $name, $default=null)
 Fetch an array from the input or return $default if it's not set. More...
 
 getBool ( $name, $default=false)
 Fetch a boolean value from the input or return $default if not set. More...
 
 getCheck ( $name)
 Return true if the named value is set in the input, whatever that value is (even "0"). More...
 
 getCookie ( $key, $prefix=null, $default=null)
 Get a cookie from the $_COOKIE jar. More...
 
 getElapsedTime ()
 Get the number of seconds to have elapsed since request start, in fractional seconds, with microsecond resolution. More...
 
 getFileName ( $key)
 Return the original filename of the uploaded file, as reported by the submitting user agent. More...
 
 getFileTempname ( $key)
 Return the path to the temporary file where PHP has stored the upload. More...
 
 getFloat ( $name, $default=0.0)
 Fetch a floating point value from the input or return $default if not set. More...
 
 getFullRequestURL ()
 Return the request URI with the canonical service and hostname, path, and query string. More...
 
 getFuzzyBool ( $name, $default=false)
 Fetch a boolean value from the input or return $default if not set. More...
 
 getHeader ( $name, $flags=0)
 Get a request header, or false if it isn't set. More...
 
 getInt ( $name, $default=0)
 Fetch an integer value from the input or return $default if not set. More...
 
 getIntArray ( $name, $default=null)
 Fetch an array of integers, or return $default if it's not set. More...
 
 getIntOrNull ( $name)
 Fetch an integer value from the input or return null if empty. More...
 
 getIP ()
 Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of the chain) More...
 
 getLimitOffset ( $deflimit=50, $optionname='rclimit')
 Check for limit and offset parameters on the input, and return sensible defaults if not given. More...
 
 getMethod ()
 Get the HTTP method used for this request. More...
 
 getPostValues ()
 Get the values passed via POST. More...
 
 getProtocol ()
 Get the current URL protocol (http or https) More...
 
 getQueryValues ()
 Get the values passed in the query string and the path router parameters. More...
 
 getQueryValuesOnly ()
 Get the values passed in the query string only, not including the path router parameters. More...
 
 getRawInput ()
 Return the raw request body, with no processing. More...
 
 getRawPostString ()
 Return the contents of the POST with no decoding. More...
 
 getRawQueryString ()
 Return the contents of the Query with no decoding. More...
 
 getRawVal ( $name, $default=null)
 Fetch a scalar from the input without normalization, or return $default if it's not set. More...
 
 getRequestURL ()
 Return the path and query string portion of the request URI. More...
 
 getSession ()
 Return the session for this request. More...
 
 getSessionData ( $key)
 Get data from the session. More...
 
 getSessionId ()
 Get the session id for this request, if any. More...
 
 getText ( $name, $default='')
 Fetch a text string from the given array or return $default if it's not set. More...
 
 getUpload ( $key)
 Return a WebRequestUpload object corresponding to the key. More...
 
 getUploadError ( $key)
 Return the upload error or 0. More...
 
 getVal ( $name, $default=null)
 Fetch a scalar from the input or return $default if it's not set. More...
 
 getValueNames ( $exclude=[])
 Returns the names of all input values excluding those in $exclude. More...
 
 getValues ()
 Extracts the given named values into an array. More...
 
 hasSafeMethod ()
 Check if this request uses a "safe" HTTP method. More...
 
 interpolateTitle ()
 Check for title, action, and/or variant data in the URL and interpolate it into the GET variables. More...
 
 isSafeRequest ()
 Whether this request should be identified as being "safe". More...
 
 markAsSafeRequest ()
 Mark this request as identified as being nullipotent even if it is a POST request. More...
 
 normalizeUnicode ( $data)
 Recursively normalizes UTF-8 strings in the given array. More...
 
 response ()
 Return a handle to WebResponse style object, for setting cookies, headers and other stuff, for Request being worked on. More...
 
 setIP ( $ip)
 
 setSessionData ( $key, $data)
 Set session data. More...
 
 setSessionId (SessionId $sessionId)
 Set the session for this request. More...
 
 setVal ( $key, $value)
 Set an arbitrary value into our get/post data. More...
 
 unsetVal ( $key)
 Unset an arbitrary value from our get/post data. More...
 
 wasPosted ()
 Returns true if the present request was reached by a POST operation, false otherwise (GET, HEAD, or command-line). More...
 

Private Attributes

 $base
 
 $ip
 

Additional Inherited Members

- Static Public Member Functions inherited from WebRequest
static detectProtocol ()
 Detect the protocol from $_SERVER. More...
 
static detectServer ()
 Work out an appropriate URL prefix containing scheme and host, based on information detected from $_SERVER. More...
 
static extractTitle ( $path, $bases, $key=false)
 URL rewriting function; tries to extract page title and, optionally, one other fixed parameter value from a URL path. More...
 
static getGlobalRequestURL ()
 Return the path and query string portion of the main request URI. More...
 
static getPathInfo ( $want='all')
 Extract relevant query arguments from the http request uri's path to be merged with the normal php provided query arguments. More...
 
static getRequestId ()
 Get the unique request ID. More...
 
static overrideRequestId ( $id)
 Override the unique request ID. More...
 
- Public Attributes inherited from WebRequest
const GETHEADER_LIST = 1
 Flag to make WebRequest::getHeader return an array of values. More...
 
- Protected Member Functions inherited from FauxRequest
 getRawIP ()
 
 initHeaders ()
 Initialise the header list. More...
 
- Protected Member Functions inherited from WebRequest
 doSecurityRedirect ( $url)
 Attempt to redirect to a URL with a QUERY_STRING that's not dangerous in IE 6. More...
 
 getRawIP ()
 Fetch the raw IP from the request. More...
 
 initHeaders ()
 Initialise the header list. More...
 
- Protected Attributes inherited from FauxRequest
 $cookies = []
 
- Protected Attributes inherited from WebRequest
array $data
 The parameters from $_GET, $_POST and the path router. More...
 
array $headers = []
 Lazy-initialized request headers indexed by upper-case header name. More...
 
bool $markedAsSafe = false
 Whether this HTTP request is "safe" (even if it is an HTTP post) More...
 
string $protocol
 Cached URL protocol. More...
 
array $queryAndPathParams
 The parameters from $_GET. More...
 
 $queryParams
 The parameters from $_GET only. More...
 
float $requestTime
 The timestamp of the start of the request, with microsecond precision. More...
 
SessionId null $sessionId = null
 Session ID to use for this request. More...
 

Detailed Description

Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base request for the remaining stuff (cookies, session and headers).

Since
1.19

Definition at line 34 of file DerivativeRequest.php.

Constructor & Destructor Documentation

◆ __construct()

DerivativeRequest::__construct ( WebRequest  $base,
  $data,
  $wasPosted = false 
)
Parameters
WebRequest$base
array$dataArray of non-urlencoded key => value pairs, the fake GET/POST values
bool$wasPostedWhether to treat the data as POST

Definition at line 44 of file DerivativeRequest.php.

References $base, WebRequest\$data, and FauxRequest\$wasPosted.

Member Function Documentation

◆ getAcceptLang()

DerivativeRequest::getAcceptLang ( )

Definition at line 73 of file DerivativeRequest.php.

◆ getAllHeaders()

DerivativeRequest::getAllHeaders ( )

Definition at line 57 of file DerivativeRequest.php.

◆ getCookie()

DerivativeRequest::getCookie (   $key,
  $prefix = null,
  $default = null 
)

Definition at line 49 of file DerivativeRequest.php.

◆ getElapsedTime()

DerivativeRequest::getElapsedTime ( )

Definition at line 89 of file DerivativeRequest.php.

◆ getHeader()

DerivativeRequest::getHeader (   $name,
  $flags = 0 
)

Definition at line 53 of file DerivativeRequest.php.

◆ getIP()

DerivativeRequest::getIP ( )

Definition at line 77 of file DerivativeRequest.php.

◆ getProtocol()

DerivativeRequest::getProtocol ( )

Definition at line 85 of file DerivativeRequest.php.

◆ getSession()

DerivativeRequest::getSession ( )

Definition at line 61 of file DerivativeRequest.php.

◆ getSessionData()

DerivativeRequest::getSessionData (   $key)

Definition at line 65 of file DerivativeRequest.php.

◆ setIP()

DerivativeRequest::setIP (   $ip)

Definition at line 81 of file DerivativeRequest.php.

References $ip.

◆ setSessionData()

DerivativeRequest::setSessionData (   $key,
  $data 
)

Definition at line 69 of file DerivativeRequest.php.

References WebRequest\$data.

Member Data Documentation

◆ $base

DerivativeRequest::$base
private

Definition at line 35 of file DerivativeRequest.php.

Referenced by __construct().

◆ $ip

DerivativeRequest::$ip
private

Definition at line 36 of file DerivativeRequest.php.

Referenced by setIP().


The documentation for this class was generated from the following file: