\Pop\Mail\Transport\Smtp\StreamBufferInterface

SMTP buffer interface

Summary

Methods
Constants
initialize()
startTls()
setParam()
terminate()
setWriteTranslations()
readLine()
write()
commit()
bind()
unbind()
flushBuffers()
read()
setReadPointer()
TYPE_SOCKET
TYPE_PROCESS
No protected methods found
N/A
No private methods found
N/A

Constants

TYPE_SOCKET

TYPE_SOCKET

A socket buffer over TCP

TYPE_PROCESS

TYPE_PROCESS

A process buffer with I/O support

Methods

initialize()

initialize(array  $params) 

Perform any initialization needed, using the given $params.

Parameters will vary depending upon the type of IoBuffer used.

Parameters

array $params

startTls()

startTls() : boolean

Start TLS

Returns

boolean

setParam()

setParam(string  $param, mixed  $value) 

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

Parameters

string $param
mixed $value

terminate()

terminate() 

Perform any shutdown logic needed.

setWriteTranslations()

setWriteTranslations(array  $replacements) 

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

This could replace LF with CRLF for example.

Parameters

array $replacements

readLine()

readLine(integer  $sequence) : string

Get a line of output (including any CRLF).

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

Parameters

integer $sequence

of last write to scan from

Returns

string

write()

write(string  $bytes) : integer

Writes $bytes to the end of the stream.

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

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

Parameters

string $bytes

Throws

\Pop\Mail\Transport\Smtp\Stream\Exception

Returns

integer

commit()

commit() 

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

Throws

\Pop\Mail\Transport\Smtp\Stream\Exception

bind()

bind(\Pop\Mail\Transport\Smtp\Stream\Byte\InputInterface  $is) 

Attach $is to this stream.

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

Parameters

\Pop\Mail\Transport\Smtp\Stream\Byte\InputInterface $is

unbind()

unbind(\Pop\Mail\Transport\Smtp\Stream\Byte\InputInterface  $is) 

Remove an already bound stream.

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

\Pop\Mail\Transport\Smtp\Stream\Byte\InputInterface $is

flushBuffers()

flushBuffers() 

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

Throws

\Pop\Mail\Transport\Smtp\Stream\Exception

read()

read(integer  $length) : string|boolean

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

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

integer $length

Throws

\Pop\Mail\Transport\Smtp\Stream\Exception

Returns

string|boolean

setReadPointer()

setReadPointer(integer  $byteOffset) : boolean

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

Parameters

integer $byteOffset

Throws

\Pop\Mail\Transport\Smtp\Stream\Exception

Returns

boolean