ResponseEvent.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 string $response
  32. * @param bool $valid
  33. */
  34. public function __construct(Swift_Transport $source, $response, $valid = false)
  35. {
  36. parent::__construct($source);
  37. $this->response = $response;
  38. $this->valid = $valid;
  39. }
  40. /**
  41. * Get the response which was received from the server.
  42. *
  43. * @return string
  44. */
  45. public function getResponse()
  46. {
  47. return $this->response;
  48. }
  49. /**
  50. * Get the success status of this Event.
  51. *
  52. * @return bool
  53. */
  54. public function isValid()
  55. {
  56. return $this->valid;
  57. }
  58. }