class Response implements ResponseInterface

The global HTTP response class

Properties

static array $content_types

Methods

__construct( string|null $content = null, string|null $charset = null)

Constructor : defines the current URL and gets the routes

string
__toString()

No description

$this
setProtocol($value)

No description

string
getProtocol()

No description

$this
setStatus($flag)

No description

mixed
getStatus()

No description

$this
setCharset($string)

No description

string
getCharset()

No description

$this
addContent( string $name, mixed $content)

No description

$this
setContents( array $contents)

No description

null
getContent($name, null $default = null)

No description

array
getContents()

No description

string
getContentsAsString()

No description

setContentType( string $type)

No description

object
getContentType()

No description

guessContentType()

No description

setHeaders( array $params)

No description

addHeader( string $name, string $value = null)

No description

array
getHeaders()

No description

string|null
getHeader( string $name)

No description

bool
hasHeader( string $name)

No description

void
renderHeaders()

No description

static 
header( string $str)

Writes a header string if headers had not been sent

mixed
send( null $content = null, null $type = null, bool $return_string = false)

Send the response to the device

download( null $file = null, null $type = null, null $file_name = null)

Force client to download a file

flush( null $file_content = null, null $type = null)

Flush (display) a file content

redirect( string $url, bool $permanent = false)

No description

Details

at line 84
__construct( string|null $content = null, string|null $charset = null)

Constructor : defines the current URL and gets the routes

Parameters

string|null $content
string|null $charset

at line 101
string __toString()

Return Value

string

at line 114
$this setProtocol($value)

Parameters

$value

Return Value

$this

at line 123
string getProtocol()

Return Value

string

at line 132
$this setStatus($flag)

Parameters

$flag

Return Value

$this

at line 141
mixed getStatus()

Return Value

mixed

at line 150
$this setCharset($string)

Parameters

$string

Return Value

$this

at line 159
string getCharset()

Return Value

string

at line 169
$this addContent( string $name, mixed $content)

Parameters

string $name
mixed $content

Return Value

$this

at line 183
$this setContents( array $contents)

Parameters

array $contents

Return Value

$this

at line 194
null getContent($name, null $default = null)

Parameters

$name
null $default

Return Value

null

at line 202
array getContents()

Return Value

array

at line 210
string getContentsAsString()

Return Value

string

at line 223
Response setContentType( string $type)

Parameters

string $type

Return Value

Response

at line 232
object getContentType()

Return Value

object

at line 240
Response guessContentType()

Return Value

Response

at line 254
Response setHeaders( array $params)

Parameters

array $params

Return Value

Response

at line 265
Response addHeader( string $name, string $value = null)

Parameters

string $name
string $value

Return Value

Response

at line 274
array getHeaders()

Return Value

array

at line 283
string|null getHeader( string $name)

Parameters

string $name

Return Value

string|null

at line 294
bool hasHeader( string $name)

Parameters

string $name

Return Value

bool

at line 306
void renderHeaders()

Return Value

void

at line 319
static header( string $str)

Writes a header string if headers had not been sent

Parameters

string $str The header string

at line 334
mixed send( null $content = null, null $type = null, bool $return_string = false)

Send the response to the device

Parameters

null $content
null $type
bool $return_string

Return Value

mixed

at line 362
download( null $file = null, null $type = null, null $file_name = null)

Force client to download a file

Parameters

null $file
null $type
null $file_name

at line 389
flush( null $file_content = null, null $type = null)

Flush (display) a file content

Parameters

null $file_content
null $type

at line 408
redirect( string $url, bool $permanent = false)

Parameters

string $url
bool $permanent