BencodedContent
in package
implements
IHttpContent, IBencodeSerialisable
Represents Bencoded body content for a HTTP message.
Table of Contents
Interfaces
- IHttpContent
- Represents the body content for a HTTP message.
- IBencodeSerialisable
- Provides an interface for serialising objects for bencoding in a controlled manner.
Methods
- __construct() : mixed
- __toString() : string
- bencodeSerialise() : mixed
- Gets the data that should represent this object in a Bencode structure.
- encode() : string
- Encodes the content.
- fromEncoded() : BencodedContent
- Creates an instance from encoded content.
- fromFile() : BencodedContent
- Creates an instance from an encoded file.
- fromRequest() : BencodedContent
- Creates an instance from the raw request body.
- getContent() : mixed
- Retrieves unencoded content.
Methods
__construct()
public
__construct(mixed $content) : mixed
Parameters
- $content : mixed
-
Content to be bencoded.
__toString()
public
__toString() : string
Return values
stringbencodeSerialise()
Gets the data that should represent this object in a Bencode structure.
public
bencodeSerialise() : mixed
Return values
mixed —Representative data.
encode()
Encodes the content.
public
encode() : string
Return values
string —Bencoded string.
fromEncoded()
Creates an instance from encoded content.
public
static fromEncoded(mixed $encoded) : BencodedContent
Parameters
- $encoded : mixed
-
Bencoded content.
Return values
BencodedContent —Instance representing the provided content.
fromFile()
Creates an instance from an encoded file.
public
static fromFile(string $path) : BencodedContent
Parameters
- $path : string
-
Path to the bencoded file.
Return values
BencodedContent —Instance representing the provided path.
fromRequest()
Creates an instance from the raw request body.
public
static fromRequest() : BencodedContent
Return values
BencodedContent —Instance representing the request body.
getContent()
Retrieves unencoded content.
public
getContent() : mixed
Return values
mixed —Content.