1<?php
2
3/**
4 * Swift Mailer Mapper for Event Listeners
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 * Maps event listener names to the methods they implement
14 * @package Swift_Events
15 * @author Chris Corbyn <chris@w3style.co.uk>
16 */
17class Swift_Events_ListenerMapper
18{
19  /**
20   * Get the mapped names (Class => Method(s))
21   * @return array
22   */
23  public static function getMap()
24  {
25    $map = array(
26      "SendListener" => "sendPerformed",
27      "BeforeSendListener" => "beforeSendPerformed",
28      "CommandListener" => "commandSent",
29      "BeforeCommandListener" => "beforeCommandSent",
30      "ResponseListener" => "responseReceived",
31      "ConnectListener" => "connectPerformed",
32      "DisconnectListener" => "disconnectPerformed"
33    );
34    return $map;
35  }
36
37  /**
38   * Get the name of the method which needs running based upon the listener name
39   * @return string
40   */
41  public static function getNotifyMethod($listener)
42  {
43    $map = self::getMap();
44    if (isset($map[$listener])) return $map[$listener];
45    else return false;
46  }
47}
48