ResponseEvent.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. * @package Swift
  13. * @subpackage Events
  14. * @author Chris Corbyn
  15. */
  16. class Swift_Events_ResponseEvent extends Swift_Events_EventObject
  17. {
  18. /**
  19. * The overall result.
  20. *
  21. * @var boolean
  22. */
  23. private $_valid;
  24. /**
  25. * The response received from the server.
  26. *
  27. * @var string
  28. */
  29. private $_response;
  30. /**
  31. * Create a new ResponseEvent for $source and $response.
  32. *
  33. * @param Swift_Transport $source
  34. * @param string $response
  35. * @param boolean $valid
  36. */
  37. public function __construct(Swift_Transport $source, $response, $valid = false)
  38. {
  39. parent::__construct($source);
  40. $this->_response = $response;
  41. $this->_valid = $valid;
  42. }
  43. /**
  44. * Get the response which was received from the server.
  45. *
  46. * @return string
  47. */
  48. public function getResponse()
  49. {
  50. return $this->_response;
  51. }
  52. /**
  53. * Get the success status of this Event.
  54. *
  55. * @return boolean
  56. */
  57. public function isValid()
  58. {
  59. return $this->_valid;
  60. }
  61. }