Bencodex

Decoder
in package

Table of Contents

$byteOrderMark  : bool
__construct()  : void
decode()  : mixed
Decodes Bencodex data from the source reader into a PHP value.
getTextEncoding()  : string
Determines what text encoding Bencodex text values are decoded to PHP strings in.
setTextEncoding()  : void
Determines what text encoding Bencodex text values are decoded to PHP strings in.

Properties

$byteOrderMark

public bool $byteOrderMark

Whether to prepend BOMs (byte order marks). If turned on, Bencodex text values are decoded to PHP strings with BOMs whether the original text has BOM or not. If turned off (default), BOM is added to the decoded PHP string if and only if the original Bencodex text has BOM.

Methods

__construct()

public __construct([string $textEncoding = 'utf-8' ][, bool $byteOrderMark = false ]) : void
Parameters
$textEncoding : string = 'utf-8'

Determines what text encoding Bencodex text values are decoded to PHP strings in.

$byteOrderMark : bool = false

Whether to prepend BOMs (byte order marks). If turned on, Bencodex text values are decoded to PHP strings with BOMs whether the original text has BOM or not. If turned off (default), BOM is added to the decoded PHP string if and only if the original Bencodex text has BOM.

Tags
throws
TextEncodingError

Thrown when the given text encoding is invalid or unsupported by iconv.

Return values
void

decode()

Decodes Bencodex data from the source reader into a PHP value.

public decode(Reader $reader) : mixed
Parameters
$reader : Reader

The source to read the Bencodex data to decode.

Return values
mixed

A decoded value.

getTextEncoding()

Determines what text encoding Bencodex text values are decoded to PHP strings in.

public getTextEncoding() : string
Return values
string

Determines what text encoding Bencodex text values are decoded to PHP strings in.

setTextEncoding()

Determines what text encoding Bencodex text values are decoded to PHP strings in.

public setTextEncoding(string $textEncoding) : void
Parameters
$textEncoding : string

The text encoding to be used for representing Unicode text in PHP.

Tags
throws
TextEncodingError

Thrown when the given text encoding is invalid or unsupported by iconv.

Return values
void

Search results