Documentation

Request
in package

Request

parses request parameters and provides helper functions for routing

Table of Contents

Constants

MIME_HTML  = 'text/html'
MIME type for HTML
MIME_JSON  = 'application/json'
MIME type for JSON
MIME_XHTML  = 'application/xhtml+xml'
MIME type for XHTML

Properties

$_inputStream  : string
Input stream to use for PUT parameter parsing
$_isJsonApi  : bool
If we are in a JSON API context
$_operation  : string
Operation to perform
$_params  : array<string|int, mixed>
Request parameters

Methods

__construct()  : mixed
Constructor
getData()  : array<string|int, mixed>
Get data of paste or comment
getHost()  : string
Get host as requested by the client
getOperation()  : string
Get current operation
getParam()  : string
Get a request parameter
getRequestUri()  : string
Get request URI
isJsonApiCall()  : bool
If we are in a JSON API context
setInputStream()  : mixed
Override the default input stream source, used for unit testing
_detectJsonRequest()  : bool
Detect the clients supported media type and decide if its a JSON API call or not
getPasteId()  : string
Return the paste ID of the current paste.

Constants

MIME_HTML

MIME type for HTML

public mixed MIME_HTML = 'text/html'
Tags
const

string

MIME_JSON

MIME type for JSON

public mixed MIME_JSON = 'application/json'
Tags
const

string

MIME_XHTML

MIME type for XHTML

public mixed MIME_XHTML = 'application/xhtml+xml'
Tags
const

string

Properties

$_inputStream

Input stream to use for PUT parameter parsing

private static string $_inputStream = 'php://input'
Tags
access

private

$_isJsonApi

If we are in a JSON API context

private bool $_isJsonApi = false
Tags
access

private

$_operation

Operation to perform

private string $_operation = 'view'
Tags
access

private

$_params

Request parameters

private array<string|int, mixed> $_params = array()
Tags
access

private

Methods

__construct()

Constructor

public __construct() : mixed
Tags
access

public

getData()

Get data of paste or comment

public getData() : array<string|int, mixed>
Tags
access

public

Return values
array<string|int, mixed>

getHost()

Get host as requested by the client

public getHost() : string
Tags
access

public

Return values
string

getOperation()

Get current operation

public getOperation() : string
Tags
access

public

Return values
string

getParam()

Get a request parameter

public getParam(string $param[, string $default = '' ]) : string
Parameters
$param : string
$default : string = ''
Tags
access

public

Return values
string

getRequestUri()

Get request URI

public getRequestUri() : string
Tags
access

public

Return values
string

isJsonApiCall()

If we are in a JSON API context

public isJsonApiCall() : bool
Tags
access

public

Return values
bool

setInputStream()

Override the default input stream source, used for unit testing

public static setInputStream(string $input) : mixed
Parameters
$input : string

_detectJsonRequest()

Detect the clients supported media type and decide if its a JSON API call or not

private _detectJsonRequest() : bool

Adapted from: https://stackoverflow.com/questions/3770513/detect-browser-language-in-php#3771447

Tags
access

private

Return values
bool

getPasteId()

Return the paste ID of the current paste.

private getPasteId() : string
Tags
access

private

Return values
string

        
On this page

Search results