Documentation

Body
in package

MIME part body class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
3.0.0

Table of Contents

Properties

$content  : string|null
Content
$encoding  : Encoding|null
Encoding
$file  : string|null
Pending file path - set by setContentFromFile(), read lazily by render()/getContent(), never both this and $content set at once.
$isEncoded  : bool
Is encoded flag
$isFile  : bool
Is file flag
$split  : int|bool|null
Chunk split

Methods

__construct()  : mixed
Constructor
__toString()  : string
Render the body
getContent()  : string
Get the body content
getEncoding()  : Encoding|null
Get the encoding
getSplit()  : int|bool
Get the split
hasContent()  : bool
Has body content
hasEncoding()  : bool
Has encoding
hasSplit()  : bool
Has split
is7BitEncoding()  : bool
Is encoding 7bit
is8BitEncoding()  : bool
Is encoding 8bit
isBase64Encoding()  : bool
Is encoding base64
isBinaryEncoding()  : bool
Is encoding binary
isEncoded()  : bool
Is encoded
isFile()  : bool
Is file
isQuotedPrintableEncoding()  : bool
Is encoding quoted-printable
isRawUrlEncoding()  : bool
Is encoding raw URL
isUrlEncoding()  : bool
Is encoding URL
render()  : string
Render the body
setAsEncoded()  : Body
Set as encoded
setAsFile()  : Body
Set as file
setContent()  : Body
Set the body content
setContentFromFile()  : Body
Set the body content from file
setEncoding()  : Body
Set the encoding
setSplit()  : Body
Set the split
loadFileContent()  : void
Materialize a pending file's content, if one is set - lazy, so a Body that's never rendered or read never touches the filesystem.

Properties

$content

Content

protected string|null $content = null

$file

Pending file path - set by setContentFromFile(), read lazily by render()/getContent(), never both this and $content set at once.

protected string|null $file = null

$isEncoded

Is encoded flag

protected bool $isEncoded = false

$isFile

Is file flag

protected bool $isFile = false

$split

Chunk split

protected int|bool|null $split = null

Methods

__construct()

Constructor

public __construct([string|null $content = null ][, Encoding|null $encoding = null ][, int|bool|null $split = null ]) : mixed

Instantiate the body object

Parameters
$content : string|null = null
$encoding : Encoding|null = null
$split : int|bool|null = null

__toString()

Render the body

public __toString() : string
Return values
string

getContent()

Get the body content

public getContent() : string
Return values
string

getSplit()

Get the split

public getSplit() : int|bool
Return values
int|bool

hasContent()

Has body content

public hasContent() : bool
Return values
bool

hasEncoding()

Has encoding

public hasEncoding() : bool
Return values
bool

hasSplit()

Has split

public hasSplit() : bool
Return values
bool

is7BitEncoding()

Is encoding 7bit

public is7BitEncoding() : bool
Return values
bool

is8BitEncoding()

Is encoding 8bit

public is8BitEncoding() : bool
Return values
bool

isBase64Encoding()

Is encoding base64

public isBase64Encoding() : bool
Return values
bool

isBinaryEncoding()

Is encoding binary

public isBinaryEncoding() : bool
Return values
bool

isEncoded()

Is encoded

public isEncoded() : bool
Return values
bool

isFile()

Is file

public isFile() : bool
Return values
bool

isQuotedPrintableEncoding()

Is encoding quoted-printable

public isQuotedPrintableEncoding() : bool
Return values
bool

isRawUrlEncoding()

Is encoding raw URL

public isRawUrlEncoding() : bool
Return values
bool

isUrlEncoding()

Is encoding URL

public isUrlEncoding() : bool
Return values
bool

render()

Render the body

public render() : string
Return values
string

setAsEncoded()

Set as encoded

public setAsEncoded(bool $isEncoded) : Body
Parameters
$isEncoded : bool
Return values
Body

setAsFile()

Set as file

public setAsFile(bool $isFile) : Body
Parameters
$isFile : bool
Return values
Body

setContent()

Set the body content

public setContent(string $content) : Body
Parameters
$content : string
Return values
Body

setContentFromFile()

Set the body content from file

public setContentFromFile(string $file[, Encoding|null $encoding = null ][, int|bool|null $split = null ]) : Body
Parameters
$file : string
$encoding : Encoding|null = null
$split : int|bool|null = null
Tags
throws
Exception
Return values
Body

setSplit()

Set the split

public setSplit(int|bool $split) : Body
Parameters
$split : int|bool
Return values
Body

loadFileContent()

Materialize a pending file's content, if one is set - lazy, so a Body that's never rendered or read never touches the filesystem.

protected loadFileContent() : void
Tags
throws
Exception

        
On this page

Search results