ResponseEvent.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  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. * Generated when a response is received on a SMTP connection.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. class Swift_Events_ResponseEvent extends Swift_Events_EventObject
  15. {
  16. /**
  17. * The overall result.
  18. *
  19. * @var bool
  20. */
  21. private $_valid;
  22. /**
  23. * The response received from the server.
  24. *
  25. * @var string
  26. */
  27. private $_response;
  28. /**
  29. * Create a new ResponseEvent for $source and $response.
  30. *
  31. * @param Swift_Transport $source
  32. * @param string $response
  33. * @param bool $valid
  34. */
  35. public function __construct(Swift_Transport $source, $response, $valid = false)
  36. {
  37. parent::__construct($source);
  38. $this->_response = $response;
  39. $this->_valid = $valid;
  40. }
  41. /**
  42. * Get the response which was received from the server.
  43. *
  44. * @return string
  45. */
  46. public function getResponse()
  47. {
  48. return $this->_response;
  49. }
  50. /**
  51. * Get the success status of this Event.
  52. *
  53. * @return bool
  54. */
  55. public function isValid()
  56. {
  57. return $this->_valid;
  58. }
  59. }