Throttles the rate at which emails are sent.
Methods
Create a new ThrottlerPlugin.
__construct(int $rate, $mode, \Swift_Plugins_Sleeper $sleeper, \Swift_Plugins_Timer $timer)
Parameters
$rate
int
$mode
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
Not used.
flushBuffers()
Inherited
inherited_from |
\Swift_Plugins_BandwidthMonitorPlugin::flushBuffers() |
Exceptions
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
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
Sleep for $seconds.
sleep(int $seconds)
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
Returns
int
Get a number of seconds to sleep for.
_throttleBytesPerMinute(int $timePassed) : int
Parameters
$timePassed
int
Returns
int
Get a number of seconds to sleep for.
_throttleMessagesPerMinute(int $timePassed) : int
Parameters
$timePassed
int
Returns
int
Properties
$_in : int
Inherited
access |
private |
inherited_from |
\Swift_Plugins_BandwidthMonitorPlugin::$$_in |
$_mirrors
Inherited
inherited_from |
\Swift_Plugins_BandwidthMonitorPlugin::$$_mirrors |
$_out : int
Inherited
access |
private |
inherited_from |
\Swift_Plugins_BandwidthMonitorPlugin::$$_out |
Constants
Flag for throttling in bytes per minute
BYTES_PER_MINUTE
Flag for throttling in emails per minute
MESSAGES_PER_MINUTE