ConfigurableSpool.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Base class for Spools (implements time and message limits).
  11. * @package Swift
  12. * @author Fabien Potencier
  13. */
  14. abstract class Swift_ConfigurableSpool implements Swift_Spool
  15. {
  16. /** The maximum number of messages to send per flush */
  17. private $_message_limit;
  18. /** The time limit per flush */
  19. private $_time_limit;
  20. /**
  21. * Sets the maximum number of messages to send per flush.
  22. * @param int $limit The limit
  23. */
  24. public function setMessageLimit($limit)
  25. {
  26. $this->_message_limit = (int) $limit;
  27. }
  28. /**
  29. * Gets the maximum number of messages to send per flush.
  30. * @return int The limit
  31. */
  32. public function getMessageLimit()
  33. {
  34. return $this->_message_limit;
  35. }
  36. /**
  37. * Sets the time limit (in seconds) per flush.
  38. * @param int $limit The limit
  39. */
  40. public function setTimeLimit($limit)
  41. {
  42. $this->_time_limit = (int) $limit;
  43. }
  44. /**
  45. * Gets the time limit (in seconds) per flush.
  46. * @return int The limit
  47. */
  48. public function getTimeLimit()
  49. {
  50. return $this->_time_limit;
  51. }
  52. }