# \nre\requestsWebRequest

Representation of a web-request.

## Summary

Methods
Properties
Constants
getParam()
getParams()
__construct()
getGetParam()
getGetParams()
getPostParam()
getPostParams()
getRequestMethod()
addRoute()
addReverseRoute()
applyReverseRoutes()
revalidate()
getServerParam()
No public properties found
No constants found
No protected methods found
$params
N/A
detectRequest()
loadGetParams()
loadPostParams()
detectAjax()
newRoute()
applyRoutes()
$getParams
$postParams
$routes
$reverseRoutes
N/A

File
  requests/WebRequest.inc
Package
  Default
Class hierarchy
  \nre\core\Request
  \nre\requests\WebRequest

## Tags

author | coderkun olli@coderkun.de

## Properties

### $params

    $params : array

Passed parameters

#### Type

array

#

Inherited from
  \nre\core\Request

## Tags

None found

### $getParams

    $getParams : array

Passed GET-parameters

#### Type

array

#

## Tags

None found

### $postParams

    $postParams : array

Passed POST-parameters

#### Type

array

#

## Tags

None found

### $routes

    $routes : array

Stored routes

#### Type

array

#

## Tags

None found

### $reverseRoutes

    $reverseRoutes : array

Stored reverse-routes

#### Type

array

#

## Tags

None found

## Methods

### getParam()

    getParam(integer  $index, string  $defaultIndex = null) : string

Get a parameter.

#### Parameters

integer | $index | Index of parameter
string | $defaultIndex | Index of default configuration value for this parameter

#### Returns

string —

Value of parameter

#

## Tags

None found

### getParams()

    getParams(integer  $offset) : array

Get all parameters from index on.

#### Parameters

integer | $offset | Offset-index

#### Returns

array —

Parameters

#

## Tags

None found

### __construct()

    __construct()

Construct a new web-request.

#

## Tags

None found

### getGetParam()

    getGetParam(string  $key, string  $defaultIndex = null) : string

Get a GET-parameter.

#### Parameters

string | $key | Key of GET-parameter
string | $defaultIndex | Index of default configuration value for this parameter

#### Returns

string —

Value of GET-parameter

#

## Tags

None found

### getGetParams()

    getGetParams() : array

Get all GET-parameters.

#### Returns

array —

GET-Parameters

#

## Tags

None found

### getPostParam()

    getPostParam(string  $key, string  $defaultValue = null) : string

Get a POST-parameter.

#### Parameters

string | $key | Key of POST-parameter
string | $defaultValue | Default value for this parameter

#### Returns

string —

Value of POST-parameter

#

## Tags

None found

### getPostParams()

    getPostParams() : array

Get all POST-parameters.

#### Returns

array —

POST-parameters

#

## Tags

None found

### getRequestMethod()

    getRequestMethod() : string

Get the method of the current request.

#### Returns

string —

Current request method

#

## Tags

None found

### addRoute()

    addRoute(string  $pattern, string  $replacement, boolean  $isLast = false)

Add a URL-route.

#### Parameters

string | $pattern | Regex-Pattern that defines the routing
string | $replacement | Regex-Pattern for replacement
boolean | $isLast | Stop after that rule

#

## Tags

None found

### addReverseRoute()

    addReverseRoute(string  $pattern, string  $replacement, boolean  $isLast = false)

Add a reverse URL-route.

#### Parameters

string | $pattern | Regex-Pattern that defines the reverse routing
string | $replacement | Regex-Pattern for replacement
boolean | $isLast | Stop after that rule

#

## Tags

None found

### applyReverseRoutes()

    applyReverseRoutes(string  $url) : string

Apply stored reverse-routes to an URL

#### Parameters

string | $url | URL to apply reverse-routes to

#### Returns

string —

Reverse-routed URL

#

## Tags

None found

### revalidate()

    revalidate()

Revalidate the current request

#

## Tags

None found

### getServerParam()

    getServerParam(string  $key) : string

Get a SERVER-parameter.

#### Parameters

string | $key | Key of SERVER-parameter

#### Returns

string —

Value of SERVER-parameter

#

## Tags

None found

### detectRequest()

    detectRequest()

Detect the current HTTP-request.

#

## Tags

None found

### loadGetParams()

    loadGetParams()

Determine parameters passed by GET.

#

## Tags

None found

### loadPostParams()

    loadPostParams()

Determine parameters passed by POST.

#

## Tags

None found

### detectAjax()

    detectAjax()

Detect an AJAX-request by checking the X-Requested-With header and set the layout to 'ajax' in this case.

#

## Tags

None found

### newRoute()

    newRoute(string  $pattern, string  $replacement, boolean  $isLast = false) : array

Create a new URL-route.

#### Parameters

string | $pattern | Regex-Pattern that defines the reverse routing
string | $replacement | Regex-Pattern for replacement
boolean | $isLast | Stop after that rule

#### Returns

array —

New URL-route

#

## Tags

None found

### applyRoutes()

    applyRoutes(string  $url, array  $routes) : string

Apply given routes to an URL

#### Parameters

string | $url | URL to apply routes to
array | $routes | Routes to apply

#### Returns

string —

Routed URL

#

## Tags

None found

### WebRequest.inc