/var/www/cobraambalaj/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins
Edit: /var/www/cobraambalaj/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php (3018B)
setThreshold($threshold);
$this->setSleepTime($sleep);
$this->sleeper = $sleeper;
}
/**
* Set the number of emails to send before restarting.
*
* @param int $threshold
*/
public function setThreshold($threshold)
{
$this->threshold = $threshold;
}
/**
* Get the number of emails to send before restarting.
*
* @return int
*/
public function getThreshold()
{
return $this->threshold;
}
/**
* Set the number of seconds to sleep for during a restart.
*
* @param int $sleep time
*/
public function setSleepTime($sleep)
{
$this->sleep = $sleep;
}
/**
* Get the number of seconds to sleep for during a restart.
*
* @return int
*/
public function getSleepTime()
{
return $this->sleep;
}
/**
* Invoked immediately before the Message is sent.
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
}
/**
* Invoked immediately after the Message is sent.
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
++$this->counter;
if ($this->counter >= $this->threshold) {
$transport = $evt->getTransport();
$transport->stop();
if ($this->sleep) {
$this->sleep($this->sleep);
}
$transport->start();
$this->counter = 0;
}
}
/**
* Sleep for $seconds.
*
* @param int $seconds
*/
public function sleep($seconds)
{
if (isset($this->sleeper)) {
$this->sleeper->sleep($seconds);
} else {
sleep($seconds);
}
}
}