ConfigurableSpool.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. * @package Swift
  13. * @author Fabien Potencier
  14. */
  15. abstract class Swift_ConfigurableSpool implements Swift_Spool
  16. {
  17. /** The maximum number of messages to send per flush */
  18. private $_message_limit;
  19. /** The time limit per flush */
  20. private $_time_limit;
  21. /**
  22. * Sets the maximum number of messages to send per flush.
  23. *
  24. * @param integer $limit
  25. */
  26. public function setMessageLimit($limit)
  27. {
  28. $this->_message_limit = (int) $limit;
  29. }
  30. /**
  31. * Gets the maximum number of messages to send per flush.
  32. *
  33. * @return integer The limit
  34. */
  35. public function getMessageLimit()
  36. {
  37. return $this->_message_limit;
  38. }
  39. /**
  40. * Sets the time limit (in seconds) per flush.
  41. *
  42. * @param integer $limit The limit
  43. */
  44. public function setTimeLimit($limit)
  45. {
  46. $this->_time_limit = (int) $limit;
  47. }
  48. /**
  49. * Gets the time limit (in seconds) per flush.
  50. *
  51. * @return integer The limit
  52. */
  53. public function getTimeLimit()
  54. {
  55. return $this->_time_limit;
  56. }
  57. }