CommandEvent.php 1.3 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 command is sent over an SMTP connection.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. class Swift_Events_CommandEvent extends Swift_Events_EventObject
  15. {
  16. /**
  17. * The command sent to the server.
  18. *
  19. * @var string
  20. */
  21. private $command;
  22. /**
  23. * An array of codes which a successful response will contain.
  24. *
  25. * @var int[]
  26. */
  27. private $successCodes = [];
  28. /**
  29. * Create a new CommandEvent for $source with $command.
  30. *
  31. * @param string $command
  32. * @param array $successCodes
  33. */
  34. public function __construct(Swift_Transport $source, $command, $successCodes = [])
  35. {
  36. parent::__construct($source);
  37. $this->command = $command;
  38. $this->successCodes = $successCodes;
  39. }
  40. /**
  41. * Get the command which was sent to the server.
  42. *
  43. * @return string
  44. */
  45. public function getCommand()
  46. {
  47. return $this->command;
  48. }
  49. /**
  50. * Get the numeric response codes which indicate success for this command.
  51. *
  52. * @return int[]
  53. */
  54. public function getSuccessCodes()
  55. {
  56. return $this->successCodes;
  57. }
  58. }