@@ -15,51 +15,51 @@ |
||
15 | 15 | */ |
16 | 16 | class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener |
17 | 17 | { |
18 | - /** |
|
19 | - * The sender to impersonate. |
|
20 | - * |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - private $sender; |
|
18 | + /** |
|
19 | + * The sender to impersonate. |
|
20 | + * |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + private $sender; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Create a new ImpersonatePlugin to impersonate $sender. |
|
27 | - * |
|
28 | - * @param string $sender address |
|
29 | - */ |
|
30 | - public function __construct($sender) |
|
31 | - { |
|
32 | - $this->sender = $sender; |
|
33 | - } |
|
25 | + /** |
|
26 | + * Create a new ImpersonatePlugin to impersonate $sender. |
|
27 | + * |
|
28 | + * @param string $sender address |
|
29 | + */ |
|
30 | + public function __construct($sender) |
|
31 | + { |
|
32 | + $this->sender = $sender; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Invoked immediately before the Message is sent. |
|
37 | - */ |
|
38 | - public function beforeSendPerformed(Swift_Events_SendEvent $evt) |
|
39 | - { |
|
40 | - $message = $evt->getMessage(); |
|
41 | - $headers = $message->getHeaders(); |
|
35 | + /** |
|
36 | + * Invoked immediately before the Message is sent. |
|
37 | + */ |
|
38 | + public function beforeSendPerformed(Swift_Events_SendEvent $evt) |
|
39 | + { |
|
40 | + $message = $evt->getMessage(); |
|
41 | + $headers = $message->getHeaders(); |
|
42 | 42 | |
43 | - // save current recipients |
|
44 | - $headers->addPathHeader('X-Swift-Return-Path', $message->getReturnPath()); |
|
43 | + // save current recipients |
|
44 | + $headers->addPathHeader('X-Swift-Return-Path', $message->getReturnPath()); |
|
45 | 45 | |
46 | - // replace them with the one to send to |
|
47 | - $message->setReturnPath($this->sender); |
|
48 | - } |
|
46 | + // replace them with the one to send to |
|
47 | + $message->setReturnPath($this->sender); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Invoked immediately after the Message is sent. |
|
52 | - */ |
|
53 | - public function sendPerformed(Swift_Events_SendEvent $evt) |
|
54 | - { |
|
55 | - $message = $evt->getMessage(); |
|
50 | + /** |
|
51 | + * Invoked immediately after the Message is sent. |
|
52 | + */ |
|
53 | + public function sendPerformed(Swift_Events_SendEvent $evt) |
|
54 | + { |
|
55 | + $message = $evt->getMessage(); |
|
56 | 56 | |
57 | - // restore original headers |
|
58 | - $headers = $message->getHeaders(); |
|
57 | + // restore original headers |
|
58 | + $headers = $message->getHeaders(); |
|
59 | 59 | |
60 | - if ($headers->has('X-Swift-Return-Path')) { |
|
61 | - $message->setReturnPath($headers->get('X-Swift-Return-Path')->getAddress()); |
|
62 | - $headers->removeAll('X-Swift-Return-Path'); |
|
63 | - } |
|
64 | - } |
|
60 | + if ($headers->has('X-Swift-Return-Path')) { |
|
61 | + $message->setReturnPath($headers->get('X-Swift-Return-Path')->getAddress()); |
|
62 | + $headers->removeAll('X-Swift-Return-Path'); |
|
63 | + } |
|
64 | + } |
|
65 | 65 | } |
@@ -15,17 +15,17 @@ |
||
15 | 15 | */ |
16 | 16 | interface Swift_Plugins_Decorator_Replacements |
17 | 17 | { |
18 | - /** |
|
19 | - * Return the array of replacements for $address. |
|
20 | - * |
|
21 | - * This method is invoked once for every single recipient of a message. |
|
22 | - * |
|
23 | - * If no replacements can be found, an empty value (NULL) should be returned |
|
24 | - * and no replacements will then be made on the message. |
|
25 | - * |
|
26 | - * @param string $address |
|
27 | - * |
|
28 | - * @return array |
|
29 | - */ |
|
30 | - public function getReplacementsFor($address); |
|
18 | + /** |
|
19 | + * Return the array of replacements for $address. |
|
20 | + * |
|
21 | + * This method is invoked once for every single recipient of a message. |
|
22 | + * |
|
23 | + * If no replacements can be found, an empty value (NULL) should be returned |
|
24 | + * and no replacements will then be made on the message. |
|
25 | + * |
|
26 | + * @param string $address |
|
27 | + * |
|
28 | + * @return array |
|
29 | + */ |
|
30 | + public function getReplacementsFor($address); |
|
31 | 31 | } |
@@ -15,58 +15,58 @@ |
||
15 | 15 | */ |
16 | 16 | class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger |
17 | 17 | { |
18 | - /** |
|
19 | - * The log contents. |
|
20 | - * |
|
21 | - * @var array |
|
22 | - */ |
|
23 | - private $log = []; |
|
18 | + /** |
|
19 | + * The log contents. |
|
20 | + * |
|
21 | + * @var array |
|
22 | + */ |
|
23 | + private $log = []; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Max size of the log. |
|
27 | - * |
|
28 | - * @var int |
|
29 | - */ |
|
30 | - private $size = 0; |
|
25 | + /** |
|
26 | + * Max size of the log. |
|
27 | + * |
|
28 | + * @var int |
|
29 | + */ |
|
30 | + private $size = 0; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Create a new ArrayLogger with a maximum of $size entries. |
|
34 | - * |
|
35 | - * @var int |
|
36 | - */ |
|
37 | - public function __construct($size = 50) |
|
38 | - { |
|
39 | - $this->size = $size; |
|
40 | - } |
|
32 | + /** |
|
33 | + * Create a new ArrayLogger with a maximum of $size entries. |
|
34 | + * |
|
35 | + * @var int |
|
36 | + */ |
|
37 | + public function __construct($size = 50) |
|
38 | + { |
|
39 | + $this->size = $size; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Add a log entry. |
|
44 | - * |
|
45 | - * @param string $entry |
|
46 | - */ |
|
47 | - public function add($entry) |
|
48 | - { |
|
49 | - $this->log[] = $entry; |
|
50 | - while (\count($this->log) > $this->size) { |
|
51 | - array_shift($this->log); |
|
52 | - } |
|
53 | - } |
|
42 | + /** |
|
43 | + * Add a log entry. |
|
44 | + * |
|
45 | + * @param string $entry |
|
46 | + */ |
|
47 | + public function add($entry) |
|
48 | + { |
|
49 | + $this->log[] = $entry; |
|
50 | + while (\count($this->log) > $this->size) { |
|
51 | + array_shift($this->log); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Clear the log contents. |
|
57 | - */ |
|
58 | - public function clear() |
|
59 | - { |
|
60 | - $this->log = []; |
|
61 | - } |
|
55 | + /** |
|
56 | + * Clear the log contents. |
|
57 | + */ |
|
58 | + public function clear() |
|
59 | + { |
|
60 | + $this->log = []; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Get this log as a string. |
|
65 | - * |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - public function dump() |
|
69 | - { |
|
70 | - return implode(PHP_EOL, $this->log); |
|
71 | - } |
|
63 | + /** |
|
64 | + * Get this log as a string. |
|
65 | + * |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + public function dump() |
|
69 | + { |
|
70 | + return implode(PHP_EOL, $this->log); |
|
71 | + } |
|
72 | 72 | } |
@@ -15,44 +15,44 @@ |
||
15 | 15 | */ |
16 | 16 | class Swift_Plugins_Loggers_EchoLogger implements Swift_Plugins_Logger |
17 | 17 | { |
18 | - /** Whether or not HTML should be output */ |
|
19 | - private $isHtml; |
|
18 | + /** Whether or not HTML should be output */ |
|
19 | + private $isHtml; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Create a new EchoLogger. |
|
23 | - * |
|
24 | - * @param bool $isHtml |
|
25 | - */ |
|
26 | - public function __construct($isHtml = true) |
|
27 | - { |
|
28 | - $this->isHtml = $isHtml; |
|
29 | - } |
|
21 | + /** |
|
22 | + * Create a new EchoLogger. |
|
23 | + * |
|
24 | + * @param bool $isHtml |
|
25 | + */ |
|
26 | + public function __construct($isHtml = true) |
|
27 | + { |
|
28 | + $this->isHtml = $isHtml; |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Add a log entry. |
|
33 | - * |
|
34 | - * @param string $entry |
|
35 | - */ |
|
36 | - public function add($entry) |
|
37 | - { |
|
38 | - if ($this->isHtml) { |
|
39 | - printf('%s%s%s', htmlspecialchars($entry, ENT_QUOTES), '<br />', PHP_EOL); |
|
40 | - } else { |
|
41 | - printf('%s%s', $entry, PHP_EOL); |
|
42 | - } |
|
43 | - } |
|
31 | + /** |
|
32 | + * Add a log entry. |
|
33 | + * |
|
34 | + * @param string $entry |
|
35 | + */ |
|
36 | + public function add($entry) |
|
37 | + { |
|
38 | + if ($this->isHtml) { |
|
39 | + printf('%s%s%s', htmlspecialchars($entry, ENT_QUOTES), '<br />', PHP_EOL); |
|
40 | + } else { |
|
41 | + printf('%s%s', $entry, PHP_EOL); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Not implemented. |
|
47 | - */ |
|
48 | - public function clear() |
|
49 | - { |
|
50 | - } |
|
45 | + /** |
|
46 | + * Not implemented. |
|
47 | + */ |
|
48 | + public function clear() |
|
49 | + { |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Not implemented. |
|
54 | - */ |
|
55 | - public function dump() |
|
56 | - { |
|
57 | - } |
|
52 | + /** |
|
53 | + * Not implemented. |
|
54 | + */ |
|
55 | + public function dump() |
|
56 | + { |
|
57 | + } |
|
58 | 58 | } |
@@ -15,22 +15,22 @@ |
||
15 | 15 | */ |
16 | 16 | interface Swift_Plugins_Logger |
17 | 17 | { |
18 | - /** |
|
19 | - * Add a log entry. |
|
20 | - * |
|
21 | - * @param string $entry |
|
22 | - */ |
|
23 | - public function add($entry); |
|
18 | + /** |
|
19 | + * Add a log entry. |
|
20 | + * |
|
21 | + * @param string $entry |
|
22 | + */ |
|
23 | + public function add($entry); |
|
24 | 24 | |
25 | - /** |
|
26 | - * Clear the log contents. |
|
27 | - */ |
|
28 | - public function clear(); |
|
25 | + /** |
|
26 | + * Clear the log contents. |
|
27 | + */ |
|
28 | + public function clear(); |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get this log as a string. |
|
32 | - * |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function dump(); |
|
30 | + /** |
|
31 | + * Get this log as a string. |
|
32 | + * |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function dump(); |
|
36 | 36 | } |
@@ -15,10 +15,10 @@ |
||
15 | 15 | */ |
16 | 16 | interface Swift_Plugins_Timer |
17 | 17 | { |
18 | - /** |
|
19 | - * Get the current UNIX timestamp. |
|
20 | - * |
|
21 | - * @return int |
|
22 | - */ |
|
23 | - public function getTimestamp(); |
|
18 | + /** |
|
19 | + * Get the current UNIX timestamp. |
|
20 | + * |
|
21 | + * @return int |
|
22 | + */ |
|
23 | + public function getTimestamp(); |
|
24 | 24 | } |
@@ -15,13 +15,13 @@ |
||
15 | 15 | */ |
16 | 16 | class Swift_Plugins_Pop_Pop3Exception extends Swift_IoException |
17 | 17 | { |
18 | - /** |
|
19 | - * Create a new Pop3Exception with $message. |
|
20 | - * |
|
21 | - * @param string $message |
|
22 | - */ |
|
23 | - public function __construct($message) |
|
24 | - { |
|
25 | - parent::__construct($message); |
|
26 | - } |
|
18 | + /** |
|
19 | + * Create a new Pop3Exception with $message. |
|
20 | + * |
|
21 | + * @param string $message |
|
22 | + */ |
|
23 | + public function __construct($message) |
|
24 | + { |
|
25 | + parent::__construct($message); |
|
26 | + } |
|
27 | 27 | } |
@@ -15,17 +15,17 @@ |
||
15 | 15 | */ |
16 | 16 | interface Swift_Plugins_Pop_Pop3Connection |
17 | 17 | { |
18 | - /** |
|
19 | - * Connect to the POP3 host and throw an Exception if it fails. |
|
20 | - * |
|
21 | - * @throws Swift_Plugins_Pop_Pop3Exception |
|
22 | - */ |
|
23 | - public function connect(); |
|
18 | + /** |
|
19 | + * Connect to the POP3 host and throw an Exception if it fails. |
|
20 | + * |
|
21 | + * @throws Swift_Plugins_Pop_Pop3Exception |
|
22 | + */ |
|
23 | + public function connect(); |
|
24 | 24 | |
25 | - /** |
|
26 | - * Disconnect from the POP3 host and throw an Exception if it fails. |
|
27 | - * |
|
28 | - * @throws Swift_Plugins_Pop_Pop3Exception |
|
29 | - */ |
|
30 | - public function disconnect(); |
|
25 | + /** |
|
26 | + * Disconnect from the POP3 host and throw an Exception if it fails. |
|
27 | + * |
|
28 | + * @throws Swift_Plugins_Pop_Pop3Exception |
|
29 | + */ |
|
30 | + public function disconnect(); |
|
31 | 31 | } |
@@ -15,112 +15,112 @@ |
||
15 | 15 | */ |
16 | 16 | class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_Events_ResponseListener, Swift_Events_TransportChangeListener, Swift_Events_TransportExceptionListener, Swift_Plugins_Logger |
17 | 17 | { |
18 | - /** The logger which is delegated to */ |
|
19 | - private $logger; |
|
18 | + /** The logger which is delegated to */ |
|
19 | + private $logger; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Create a new LoggerPlugin using $logger. |
|
23 | - */ |
|
24 | - public function __construct(Swift_Plugins_Logger $logger) |
|
25 | - { |
|
26 | - $this->logger = $logger; |
|
27 | - } |
|
21 | + /** |
|
22 | + * Create a new LoggerPlugin using $logger. |
|
23 | + */ |
|
24 | + public function __construct(Swift_Plugins_Logger $logger) |
|
25 | + { |
|
26 | + $this->logger = $logger; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Add a log entry. |
|
31 | - * |
|
32 | - * @param string $entry |
|
33 | - */ |
|
34 | - public function add($entry) |
|
35 | - { |
|
36 | - $this->logger->add($entry); |
|
37 | - } |
|
29 | + /** |
|
30 | + * Add a log entry. |
|
31 | + * |
|
32 | + * @param string $entry |
|
33 | + */ |
|
34 | + public function add($entry) |
|
35 | + { |
|
36 | + $this->logger->add($entry); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Clear the log contents. |
|
41 | - */ |
|
42 | - public function clear() |
|
43 | - { |
|
44 | - $this->logger->clear(); |
|
45 | - } |
|
39 | + /** |
|
40 | + * Clear the log contents. |
|
41 | + */ |
|
42 | + public function clear() |
|
43 | + { |
|
44 | + $this->logger->clear(); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Get this log as a string. |
|
49 | - * |
|
50 | - * @return string |
|
51 | - */ |
|
52 | - public function dump() |
|
53 | - { |
|
54 | - return $this->logger->dump(); |
|
55 | - } |
|
47 | + /** |
|
48 | + * Get this log as a string. |
|
49 | + * |
|
50 | + * @return string |
|
51 | + */ |
|
52 | + public function dump() |
|
53 | + { |
|
54 | + return $this->logger->dump(); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Invoked immediately following a command being sent. |
|
59 | - */ |
|
60 | - public function commandSent(Swift_Events_CommandEvent $evt) |
|
61 | - { |
|
62 | - $command = $evt->getCommand(); |
|
63 | - $this->logger->add(sprintf('>> %s', $command)); |
|
64 | - } |
|
57 | + /** |
|
58 | + * Invoked immediately following a command being sent. |
|
59 | + */ |
|
60 | + public function commandSent(Swift_Events_CommandEvent $evt) |
|
61 | + { |
|
62 | + $command = $evt->getCommand(); |
|
63 | + $this->logger->add(sprintf('>> %s', $command)); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Invoked immediately following a response coming back. |
|
68 | - */ |
|
69 | - public function responseReceived(Swift_Events_ResponseEvent $evt) |
|
70 | - { |
|
71 | - $response = $evt->getResponse(); |
|
72 | - $this->logger->add(sprintf('<< %s', $response)); |
|
73 | - } |
|
66 | + /** |
|
67 | + * Invoked immediately following a response coming back. |
|
68 | + */ |
|
69 | + public function responseReceived(Swift_Events_ResponseEvent $evt) |
|
70 | + { |
|
71 | + $response = $evt->getResponse(); |
|
72 | + $this->logger->add(sprintf('<< %s', $response)); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Invoked just before a Transport is started. |
|
77 | - */ |
|
78 | - public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt) |
|
79 | - { |
|
80 | - $transportName = \get_class($evt->getSource()); |
|
81 | - $this->logger->add(sprintf('++ Starting %s', $transportName)); |
|
82 | - } |
|
75 | + /** |
|
76 | + * Invoked just before a Transport is started. |
|
77 | + */ |
|
78 | + public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt) |
|
79 | + { |
|
80 | + $transportName = \get_class($evt->getSource()); |
|
81 | + $this->logger->add(sprintf('++ Starting %s', $transportName)); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Invoked immediately after the Transport is started. |
|
86 | - */ |
|
87 | - public function transportStarted(Swift_Events_TransportChangeEvent $evt) |
|
88 | - { |
|
89 | - $transportName = \get_class($evt->getSource()); |
|
90 | - $this->logger->add(sprintf('++ %s started', $transportName)); |
|
91 | - } |
|
84 | + /** |
|
85 | + * Invoked immediately after the Transport is started. |
|
86 | + */ |
|
87 | + public function transportStarted(Swift_Events_TransportChangeEvent $evt) |
|
88 | + { |
|
89 | + $transportName = \get_class($evt->getSource()); |
|
90 | + $this->logger->add(sprintf('++ %s started', $transportName)); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Invoked just before a Transport is stopped. |
|
95 | - */ |
|
96 | - public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt) |
|
97 | - { |
|
98 | - $transportName = \get_class($evt->getSource()); |
|
99 | - $this->logger->add(sprintf('++ Stopping %s', $transportName)); |
|
100 | - } |
|
93 | + /** |
|
94 | + * Invoked just before a Transport is stopped. |
|
95 | + */ |
|
96 | + public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt) |
|
97 | + { |
|
98 | + $transportName = \get_class($evt->getSource()); |
|
99 | + $this->logger->add(sprintf('++ Stopping %s', $transportName)); |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Invoked immediately after the Transport is stopped. |
|
104 | - */ |
|
105 | - public function transportStopped(Swift_Events_TransportChangeEvent $evt) |
|
106 | - { |
|
107 | - $transportName = \get_class($evt->getSource()); |
|
108 | - $this->logger->add(sprintf('++ %s stopped', $transportName)); |
|
109 | - } |
|
102 | + /** |
|
103 | + * Invoked immediately after the Transport is stopped. |
|
104 | + */ |
|
105 | + public function transportStopped(Swift_Events_TransportChangeEvent $evt) |
|
106 | + { |
|
107 | + $transportName = \get_class($evt->getSource()); |
|
108 | + $this->logger->add(sprintf('++ %s stopped', $transportName)); |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Invoked as a TransportException is thrown in the Transport system. |
|
113 | - */ |
|
114 | - public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt) |
|
115 | - { |
|
116 | - $e = $evt->getException(); |
|
117 | - $message = $e->getMessage(); |
|
118 | - $code = $e->getCode(); |
|
119 | - $this->logger->add(sprintf('!! %s (code: %s)', $message, $code)); |
|
120 | - $message .= PHP_EOL; |
|
121 | - $message .= 'Log data:'.PHP_EOL; |
|
122 | - $message .= $this->logger->dump(); |
|
123 | - $evt->cancelBubble(); |
|
124 | - throw new Swift_TransportException($message, $code, $e->getPrevious()); |
|
125 | - } |
|
111 | + /** |
|
112 | + * Invoked as a TransportException is thrown in the Transport system. |
|
113 | + */ |
|
114 | + public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt) |
|
115 | + { |
|
116 | + $e = $evt->getException(); |
|
117 | + $message = $e->getMessage(); |
|
118 | + $code = $e->getCode(); |
|
119 | + $this->logger->add(sprintf('!! %s (code: %s)', $message, $code)); |
|
120 | + $message .= PHP_EOL; |
|
121 | + $message .= 'Log data:'.PHP_EOL; |
|
122 | + $message .= $this->logger->dump(); |
|
123 | + $evt->cancelBubble(); |
|
124 | + throw new Swift_TransportException($message, $code, $e->getPrevious()); |
|
125 | + } |
|
126 | 126 | } |