Documentation

BufferInterface
in

SMTP buffer interface

Tags
category

Pop

author

Chris Corbyn, from the SwiftMailer library https://github.com/swiftmailer/swiftmailer

version
3.6.0

Table of Contents

TYPE_PROCESS  = 0x10
A process buffer with I/O support
TYPE_SOCKET  = 0x1
A socket buffer over TCP
bind()  : mixed
Attach $is to this stream.
commit()  : mixed
For any bytes that are currently buffered inside the stream, force them off the buffer.
flushBuffers()  : mixed
Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
initialize()  : mixed
Perform any initialization needed, using the given $params.
read()  : string|bool
Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.
readLine()  : string
Get a line of output (including any CRLF).
setParam()  : mixed
Set an individual param on the buffer (e.g. switching to SSL).
setReadPointer()  : bool
Move the internal read pointer to $byteOffset in the stream.
setWriteTranslations()  : mixed
Set an array of string replacements which should be made on data written to the buffer.
startTls()  : bool
Start TLS
terminate()  : mixed
Perform any shutdown logic needed.
unbind()  : mixed
Remove an already bound stream.
write()  : int
Writes $bytes to the end of the stream.

Constants

TYPE_PROCESS

A process buffer with I/O support

public mixed TYPE_PROCESS = 0x10

Methods

bind()

Attach $is to this stream.

public bind(InputInterface $is) : mixed

The stream acts as an observer, receiving all data that is written. All and operations will be mirrored.

Parameters
$is : InputInterface
Return values
mixed

commit()

For any bytes that are currently buffered inside the stream, force them off the buffer.

public commit() : mixed
Tags
throws
Exception
Return values
mixed

flushBuffers()

Flush the contents of the stream (empty it) and set the internal pointer to the beginning.

public flushBuffers() : mixed
Tags
throws
Exception
Return values
mixed

initialize()

Perform any initialization needed, using the given $params.

public initialize(array<string|int, mixed> $params) : mixed

Parameters will vary depending upon the type of IoBuffer used.

Parameters
$params : array<string|int, mixed>
Return values
mixed

read()

Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.

public read(int $length) : string|bool

If less bytes exist than are requested the remaining bytes are given instead. If no bytes are remaining at all, boolean false is returned.

Parameters
$length : int
Tags
throws
Exception
Return values
string|bool

readLine()

Get a line of output (including any CRLF).

public readLine(int $sequence) : string

The $sequence number comes from any writes and may or may not be used depending upon the implementation.

Parameters
$sequence : int

of last write to scan from

Return values
string

setParam()

Set an individual param on the buffer (e.g. switching to SSL).

public setParam(string $param, mixed $value) : mixed
Parameters
$param : string
$value : mixed
Return values
mixed

setReadPointer()

Move the internal read pointer to $byteOffset in the stream.

public setReadPointer(int $byteOffset) : bool
Parameters
$byteOffset : int
Tags
throws
Exception
Return values
bool

setWriteTranslations()

Set an array of string replacements which should be made on data written to the buffer.

public setWriteTranslations(array<string|int, mixed> $replacements) : mixed

This could replace LF with CRLF for example.

Parameters
$replacements : array<string|int, mixed>
Return values
mixed

startTls()

Start TLS

public startTls() : bool
Return values
bool

terminate()

Perform any shutdown logic needed.

public terminate() : mixed
Return values
mixed

unbind()

Remove an already bound stream.

public unbind(InputInterface $is) : mixed

If $is is not bound, no errors will be raised. If the stream currently has any buffered data it will be written to $is before unbinding occurs.

Parameters
$is : InputInterface
Return values
mixed

write()

Writes $bytes to the end of the stream.

public write(string $bytes) : int

Writing may not happen immediately if the stream chooses to buffer. If you want to write these bytes with immediate effect, call after calling write().

This method returns the sequence ID of the write (i.e. 1 for first, 2 for second, etc etc).

Parameters
$bytes : string
Tags
throws
Exception
Return values
int

Search results