Skip to content

Request

OAuth2\Request This class is taken from the Symfony2 Framework and is part of the Symfony package.

See Symfony\Component\HttpFoundation\Request (https://github.com/symfony/symfony)

Properties

attributes

public $attributes

request

public $request

query

public $query

server

public $server

files

public $files

cookies

public $cookies

headers

public $headers

content

public $content

Methods

__construct

Constructor.

public __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null, array $headers = null): mixed

Parameters:

Parameter Type Description
$query array - The GET parameters
$request array - The POST parameters
$attributes array - The request attributes (parameters parsed from the PATH_INFO, ...)
$cookies array - The COOKIE parameters
$files array - The FILES parameters
$server array - The SERVER parameters
$content string - The raw body data
$headers array - The headers

initialize

Sets the parameters for this request.

public initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null, array $headers = null): mixed

This method also re-initializes all properties.

Parameters:

Parameter Type Description
$query array - The GET parameters
$request array - The POST parameters
$attributes array - The request attributes (parameters parsed from the PATH_INFO, ...)
$cookies array - The COOKIE parameters
$files array - The FILES parameters
$server array - The SERVER parameters
$content string - The raw body data
$headers array - The headers

query

public query(string $name, mixed $default = null): mixed

Parameters:

Parameter Type Description
$name string
$default mixed

request

public request(string $name, mixed $default = null): mixed

Parameters:

Parameter Type Description
$name string
$default mixed

server

public server(string $name, mixed $default = null): mixed

Parameters:

Parameter Type Description
$name string
$default mixed

headers

public headers(string $name, mixed $default = null): mixed

Parameters:

Parameter Type Description
$name string
$default mixed

getAllQueryParameters

public getAllQueryParameters(): array

getContent

Returns the request body content.

public getContent(bool $asResource = false): string|resource

Parameters:

Parameter Type Description
$asResource bool - If true, a resource will be returned

Return Value:

  • The request body content or a resource to read the body stream.

Throws:


getHeadersFromServer

private getHeadersFromServer(array $server): array

Parameters:

Parameter Type Description
$server array

createFromGlobals

Creates a new request with values from PHP's super globals.

public static createFromGlobals(): \OAuth2\Request
  • This method is static.

Return Value:

  • A new request


Automatically generated on 2025-03-18