Index Documentation

JsonContent
in package
implements IHttpContent, JsonSerializable

Represents JSON body content for a HTTP message.

Table of Contents

Interfaces

IHttpContent
Represents the body content for a HTTP message.
JsonSerializable

Methods

__construct()  : mixed
__toString()  : string
encode()  : string
Encodes the content.
fromEncoded()  : JsonContent
Creates an instance from encoded content.
fromFile()  : JsonContent
Creates an instance from an encoded file.
fromRequest()  : JsonContent
Creates an instance from the raw request body.
getContent()  : mixed
Retrieves unencoded content.
jsonSerialize()  : mixed

Methods

__construct()

public __construct(mixed $content) : mixed
Parameters
$content : mixed

Content to be JSON encoded.

__toString()

public __toString() : string
Return values
string

encode()

Encodes the content.

public encode() : string
Return values
string

JSON encoded string.

fromEncoded()

Creates an instance from encoded content.

public static fromEncoded(string $encoded) : JsonContent
Parameters
$encoded : string

JSON encoded content.

Return values
JsonContent

Instance representing the provided content.

fromFile()

Creates an instance from an encoded file.

public static fromFile(string $path) : JsonContent
Parameters
$path : string

Path to the JSON encoded file.

Return values
JsonContent

Instance representing the provided path.

fromRequest()

Creates an instance from the raw request body.

public static fromRequest() : JsonContent
Return values
JsonContent

Instance representing the request body.

getContent()

Retrieves unencoded content.

public getContent() : mixed
Return values
mixed

Content.


        
On this page

Search results