Bitrix API

HttpHeaders implements IteratorAggregate

Table of Contents

Interfaces

IteratorAggregate

Constants

DEFAULT_HTTP_STATUS  = 0

Methods

__construct()  : mixed
add()  : mixed
Adds a header value.
clear()  : mixed
Clears all headers.
createFromString()  : HttpHeaders
Creates an object from a http response string.
delete()  : void
Deletes a header or headers by its name.
get()  : null|string|array<string|int, string>
Returns a header value by its name. If $returnArray is true then an array with multiple values is returned.
getBoundary()  : null|string
Returns the boundary value of the Content-Type header.
getCharset()  : null|string
Returns the charset part of the Content-Type header.
getContentDisposition()  : null|string
Returns disposition-type part of the Content-Disposition header
getContentType()  : null|string
Returns the content type part of the Content-Type header in lower case.
getContentTypeAttribute()  : null|string
Returns the specified attribute part of the Content-Type header.
getCookies()  : HttpCookies
Returns parsed cookies from 'set-cookie' headers.
getFilename()  : string|null
Returns a filename from the Content-disposition header.
getHeaders()  : array<string|int, array<string|int, string>>
Retuns the headers as a two-dimentional array ('name' => values).
getIterator()  : Traversable
Retrieve an external iterator
getReasonPhrase()  : string
getStatus()  : int
getVersion()  : string|null
has()  : bool
Returns true if a header is set.
parseStatus()  : $this
set()  : mixed
Sets (replaces) a header value.
setStatus()  : $this
Sets HTTP status code and prase.
setVersion()  : HttpHeaders
toArray()  : array<string|int, mixed>
Returns headers as a raw array.
toString()  : string
Returns the string representation for an HTTP request.

Constants

DEFAULT_HTTP_STATUS

public mixed DEFAULT_HTTP_STATUS = 0

Methods

__construct()

public __construct([array<string|int, string>|array<string|int, array<string|int, string>>|null $headers = null ]) : mixed
Parameters
$headers : array<string|int, string>|array<string|int, array<string|int, string>>|null = null

add()

Adds a header value.

public add(string $name, string|array<string|int, mixed> $value) : mixed
Parameters
$name : string
$value : string|array<string|int, mixed>
Tags
throws
InvalidArgumentException

createFromString()

Creates an object from a http response string.

public static createFromString(string $response) : HttpHeaders
Parameters
$response : string
Return values
HttpHeaders

delete()

Deletes a header or headers by its name.

public delete(string $name) : void
Parameters
$name : string

get()

Returns a header value by its name. If $returnArray is true then an array with multiple values is returned.

public get(string $name[, bool $returnArray = false ]) : null|string|array<string|int, string>
Parameters
$name : string
$returnArray : bool = false
Return values
null|string|array<string|int, string>

getBoundary()

Returns the boundary value of the Content-Type header.

public getBoundary() : null|string
Return values
null|string

getCharset()

Returns the charset part of the Content-Type header.

public getCharset() : null|string
Return values
null|string

getContentDisposition()

Returns disposition-type part of the Content-Disposition header

public getContentDisposition() : null|string
Return values
null|string

Disposition-type part of the Content-Disposition header if found or null otherwise.

getContentType()

Returns the content type part of the Content-Type header in lower case.

public getContentType() : null|string
Return values
null|string

getContentTypeAttribute()

Returns the specified attribute part of the Content-Type header.

public getContentTypeAttribute(string $attribute) : null|string
Parameters
$attribute : string
Return values
null|string

getFilename()

Returns a filename from the Content-disposition header.

public getFilename() : string|null
Return values
string|null

Filename if it was found in the Content-disposition header or null otherwise.

getHeaders()

Retuns the headers as a two-dimentional array ('name' => values).

public getHeaders() : array<string|int, array<string|int, string>>
Return values
array<string|int, array<string|int, string>>

getReasonPhrase()

public getReasonPhrase() : string
Return values
string

getStatus()

public getStatus() : int
Return values
int

getVersion()

public getVersion() : string|null
Return values
string|null

has()

Returns true if a header is set.

public has(string $name) : bool
Parameters
$name : string
Return values
bool

parseStatus()

public parseStatus(string $status) : $this
Parameters
$status : string
Return values
$this

set()

Sets (replaces) a header value.

public set(string $name, string|array<string|int, string> $value) : mixed
Parameters
$name : string
$value : string|array<string|int, string>

setStatus()

Sets HTTP status code and prase.

public setStatus(int $status[, string|null $reasonPhrase = null ]) : $this
Parameters
$status : int
$reasonPhrase : string|null = null
Return values
$this

toArray()

Returns headers as a raw array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toString()

Returns the string representation for an HTTP request.

public toString() : string
Return values
string

        
On this page

Search results