1<?php
2
3/**
4 * Swift Mailer Connection Interface
5 * All connection handlers extend this abstract class
6 * Please read the LICENSE file
7 * @author Chris Corbyn <chris@w3style.co.uk>
8 * @package Swift_Connection
9 * @license GNU Lesser General Public License
10 */
11
12/**
13 * Swift Connection Interface
14 * Lists methods which are required by any connections
15 * @package Swift_Connection
16 * @author Chris Corbyn <chris@w3style.co.uk>
17 */
18interface Swift_Connection
19{
20  /**
21   * Try to start the connection
22   * @throws Swift_ConnectionException If the connection cannot be started
23   */
24  public function start();
25  /**
26   * Return the contents of the buffer
27   * @return string
28   * @throws Swift_ConnectionException If the buffer cannot be read
29   */
30  public function read();
31  /**
32   * Write a command to the buffer
33   * @param string The command to send
34   * @throws Swift_ConnectionException If the write fails
35   */
36  public function write($command, $end="\r\n");
37  /**
38   * Try to stop the connection
39   * @throws Swift_ConnectionException If the connection cannot be closed/stopped
40   */
41  public function stop();
42  /**
43   * Check if the connection is up or not
44   * @return boolean
45   */
46  public function isAlive();
47  /**
48   * Add an extension which is available on this connection
49   * @param string The name of the extension
50   * @param array The list of attributes for the extension
51   */
52  public function setExtension($name, $list=array());
53  /**
54   * Check if an extension exists by the name $name
55   * @param string The name of the extension
56   * @return boolean
57   */
58  public function hasExtension($name);
59  /**
60   * Get the list of attributes for the extension $name
61   * @param string The name of the extension
62   * @return array
63   * @throws Swift_ConnectionException If no such extension can be found
64   */
65  public function getAttributes($name);
66  /**
67   * Execute logic needed after SMTP greetings
68   * @param Swift An instance of Swift
69   */
70  public function postConnect(Swift $instance);
71  /**
72   * Returns TRUE if the connection needs a EHLO greeting.
73   * @return boolean
74   */
75  public function getRequiresEHLO();
76  /**
77   * Set if the connection needs a EHLO greeting.
78   * @param boolean
79   */
80  public function setRequiresEHLO($set);
81}
82