ConfigurableSpool.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. *
  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. *
  23. * @param int $limit
  24. */
  25. public function setMessageLimit($limit)
  26. {
  27. $this->_message_limit = (int) $limit;
  28. }
  29. /**
  30. * Gets the maximum number of messages to send per flush.
  31. *
  32. * @return int The limit
  33. */
  34. public function getMessageLimit()
  35. {
  36. return $this->_message_limit;
  37. }
  38. /**
  39. * Sets the time limit (in seconds) per flush.
  40. *
  41. * @param int $limit The limit
  42. */
  43. public function setTimeLimit($limit)
  44. {
  45. $this->_time_limit = (int) $limit;
  46. }
  47. /**
  48. * Gets the time limit (in seconds) per flush.
  49. *
  50. * @return int The limit
  51. */
  52. public function getTimeLimit()
  53. {
  54. return $this->_time_limit;
  55. }
  56. }