\app\framework\Component\Route\KleinRequest

Request

Summary

Methods
Properties
Constants
__construct()
createFromGlobals()
id()
paramsGet()
paramsPost()
paramsNamed()
cookies()
server()
headers()
files()
body()
params()
param()
__isset()
__get()
__set()
__unset()
isSecure()
ip()
userAgent()
uri()
pathname()
method()
query()
No public properties found
No constants found
No protected methods found
$id
$params_get
$params_post
$params_named
$cookies
$server
$headers
$files
$body
N/A
No private methods found
No private properties found
N/A

Properties

$id

$id : 

Unique identifier for the request

Type

$params_get

$params_get : 

GET (query) parameters

Type

$params_post

$params_post : 

POST parameters

Type

$params_named

$params_named : 

Named parameters

Type

$cookies

$cookies : 

Client cookie data

Type

$server

$server : 

Server created attributes

Type

$headers

$headers : 

HTTP request headers

Type

$files

$files : 

Uploaded temporary files

Type

$body

$body : 

The request body

Type

Methods

__construct()

__construct(array  $params_get = array(), array  $params_post = array(), array  $cookies = array(), array  $server = array(), array  $files = array(), string  $body = null) 

Constructor

Create a new Request object and define all of its request data

Parameters

array $params_get
array $params_post
array $cookies
array $server
array $files
string $body

id()

id(boolean  $hash = true) : string

Gets a unique ID for the request

Generates one on the first call

Parameters

boolean $hash

Whether or not to hash the ID on creation

Returns

string

body()

body() : string

Gets the request body

Returns

string

params()

params(array  $mask = null, boolean  $fill_with_nulls = true) : array

Returns all parameters (GET, POST, named, and cookies) that match the mask

Takes an optional mask param that contains the names of any params you'd like this method to exclude in the returned array

Parameters

array $mask

The parameter mask array

boolean $fill_with_nulls

Whether or not to fill the returned array with null values to match the given mask

Returns

array

param()

param(string  $key, mixed  $default = null) : mixed

Return a request parameter, or $default if it doesn't exist

Parameters

string $key

The name of the parameter to return

mixed $default

The default value of the parameter if it contains no value

Returns

mixed

__isset()

__isset(string  $param) : boolean

Magic "__isset" method

Allows the ability to arbitrarily check the existence of a parameter from this instance while treating it as an instance property

Parameters

string $param

The name of the parameter

Returns

boolean

__get()

__get(string  $param) : mixed

Magic "__get" method

Allows the ability to arbitrarily request a parameter from this instance while treating it as an instance property

Parameters

string $param

The name of the parameter

Returns

mixed

__set()

__set(string  $param, mixed  $value) : void

Magic "__set" method

Allows the ability to arbitrarily set a parameter from this instance while treating it as an instance property

NOTE: This currently sets the "named" parameters, since that's the one collection that we have the most sane control over

Parameters

string $param

The name of the parameter

mixed $value

The value of the parameter

__unset()

__unset(string  $param) : void

Magic "__unset" method

Allows the ability to arbitrarily remove a parameter from this instance while treating it as an instance property

Parameters

string $param

The name of the parameter

isSecure()

isSecure() : boolean

Is the request secure?

Returns

boolean

ip()

ip() : string

Gets the request IP address

Returns

string

userAgent()

userAgent() : string

Gets the request user agent

Returns

string

uri()

uri() : string

Gets the request URI

Returns

string

pathname()

pathname() : string

Get the request's pathname

Returns

string

method()

method(string  $is = null, boolean  $allow_override = true) : string|boolean

Gets the request method, or checks it against $is

// POST request example $request->method() // returns 'POST' $request->method('post') // returns true $request->method('get') // returns false

Parameters

string $is

The method to check the current request method against

boolean $allow_override

Whether or not to allow HTTP method overriding via header or params

Returns

string|boolean

query()

query(string  $key, mixed  $value = null) : string

Adds to or modifies the current query string

Parameters

string $key

The name of the query param

mixed $value

The value of the query param

Returns

string