Throttles the rate at which emails are sent.

package Swift
subpackage Plugins
author Chris Corbyn

 Methods

Create a new ThrottlerPlugin.

__construct(int $rate, $mode, \Swift_Plugins_Sleeper $sleeper, \Swift_Plugins_Timer $timer) 

Parameters

$rate

int

$mode

$sleeper

\Swift_Plugins_Sleeper

(only needed in testing)

$timer

\Swift_Plugins_Timer

(only needed in testing)

Invoked immediately before the Message is sent.

beforeSendPerformed(\Swift_Events_SendEvent $evt) 

Parameters

Attach $is to this stream.

bind(\Swift_InputByteStream $is) 
Inherited

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

inherited_from \Swift_Plugins_BandwidthMonitorPlugin::bind()

Parameters

Invoked immediately following a command being sent.

commandSent(\Swift_Events_CommandEvent $evt) 
Inherited
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::commandSent()

Parameters

Not used.

commit() 
Inherited
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::commit()

Exceptions

\Swift_IoException

Not used.

flushBuffers() 
Inherited
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::flushBuffers()

Exceptions

\Swift_IoException

Get the total number of bytes received from the server.

getBytesIn() : int
Inherited
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::getBytesIn()

Returns

int

Get the total number of bytes sent to the server.

getBytesOut() : int
Inherited
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::getBytesOut()

Returns

int

Get the current UNIX timestamp

getTimestamp() : int

Returns

int

Reset the internal counters to zero.

reset() 
Inherited
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::reset()

Invoked immediately following a response coming back.

responseReceived(\Swift_Events_ResponseEvent $evt) 
Inherited
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::responseReceived()

Parameters

Invoked when a Message is sent.

sendPerformed(\Swift_Events_SendEvent $evt) 

Parameters

Sleep for $seconds.

sleep(int $seconds) 

Parameters

$seconds

int

Remove an already bound stream.

unbind(\Swift_InputByteStream $is) 
Inherited

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.

inherited_from \Swift_Plugins_BandwidthMonitorPlugin::unbind()

Parameters

Called when a message is sent so that the outgoing counter can be increased.

write(string $bytes) : int
Inherited

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).

inherited_from \Swift_Plugins_BandwidthMonitorPlugin::write()

Parameters

$bytes

string

Exceptions

\Swift_IoException

Returns

int

Get a number of seconds to sleep for.

_throttleBytesPerMinute(int $timePassed) : int
access private

Parameters

$timePassed

int

Returns

int

Get a number of seconds to sleep for.

_throttleMessagesPerMinute(int $timePassed) : int
access private

Parameters

$timePassed

int

Returns

int

 Properties

 

$_in : int
Inherited
access private
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::$$_in
 

$_messages : int
access private
 

$_mirrors 
Inherited
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::$$_mirrors
 

$_mode : int
access private
 

$_out : int
Inherited
access private
inherited_from \Swift_Plugins_BandwidthMonitorPlugin::$$_out
 

$_rate : int
access private
 

$_sleeper : \Swift_Plugins_Sleeper
access private
 

$_start : int
access private
 

$_timer : \Swift_Plugins_Timer
access private

 Constants

 

Flag for throttling in bytes per minute

BYTES_PER_MINUTE 
 

Flag for throttling in emails per minute

MESSAGES_PER_MINUTE