1<?php
2
3/**
4 * Swift Mailer Command Event
5 * Please read the LICENSE file
6 * @copyright Chris Corbyn <chris@w3style.co.uk>
7 * @author Chris Corbyn <chris@w3style.co.uk>
8 * @package Swift_Events
9 * @license GNU Lesser General Public License
10 */
11
12
13/**
14 * Generated when Swift is sending a command
15 * @package Swift_Events
16 * @author Chris Corbyn <chris@w3style.co.uk>
17 */
18class Swift_Events_CommandEvent extends Swift_Events
19{
20  /**
21   * Contains the command being sent
22   * @var string
23   */
24  protected $string = null;
25  /**
26   * Contains the expected response code (or null)
27   * @var int
28   */
29  protected $code = null;
30
31  /**
32   * Constructor
33   * @param string The command being sent
34   * @param int The expected code
35   */
36  public function __construct($string, $code=null)
37  {
38    $this->setString($string);
39    $this->setCode($code);
40  }
41  /**
42   * Set the command being sent (without CRLF)
43   * @param string The command being sent
44   */
45  public function setString($string)
46  {
47    $this->string = (string) $string;
48  }
49  /**
50   * Get the command being sent
51   * @return string
52   */
53  public function getString()
54  {
55    return $this->string;
56  }
57  /**
58   * Set response code which is expected
59   * @param int The response code
60   */
61  public function setCode($code)
62  {
63    if ($code === null) $this->code = null;
64    else $this->code = (int) $code;
65  }
66  /**
67   * Get the expected response code
68   * @return int
69   */
70  public function getCode()
71  {
72    return $this->code;
73  }
74}
75