Documentation

BufferInterface
in

SMTP buffer interface

Tags
category

Pop

author

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

version
4.0.0

Table of Contents

Constants

TYPE_PROCESS  = 0x10
A process buffer with I/O support
TYPE_SOCKET  = 0x1
A socket buffer over TCP

Methods

bind()  : void
Attach $is to this stream.
commit()  : void
For any bytes that are currently buffered inside the stream, force them off the buffer.
flushBuffers()  : void
Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
initialize()  : void
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()  : void
Set an individual param on the buffer (e.g. switching to SSL).
setReadPointer()  : void
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()  : void
Perform any shutdown logic needed.
unbind()  : void
Remove an already bound stream.
write()  : mixed
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) : void

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

Parameters
$is : InputInterface

commit()

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

public commit() : void
Tags
throws
Exception

flushBuffers()

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

public flushBuffers() : void
Tags
throws
Exception

initialize()

Perform any initialization needed, using the given $params.

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

Parameters will vary depending upon the type of IoBuffer used.

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

read()

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

public read(int|string $length) : string|bool

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

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

readLine()

Get a line of output (including any CRLF).

public readLine(int|string $sequence) : string

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

Parameters
$sequence : int|string

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) : void
Parameters
$param : string
$value : mixed

setReadPointer()

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

public setReadPointer(int|string $byteOffset) : void
Parameters
$byteOffset : int|string
Tags
throws
Exception

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>

terminate()

Perform any shutdown logic needed.

public terminate() : void

unbind()

Remove an already bound stream.

public unbind(InputInterface $is) : void

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

write()

Writes $bytes to the end of the stream.

public write(string $bytes) : mixed

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

        
On this page

Search results