Completed
Branch develop (8f3b65)
by
unknown
27:06
created
htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -16,52 +16,52 @@
 block discarded – undo
16 16
  */
17 17
 interface Swift_CharacterReader
18 18
 {
19
-    const MAP_TYPE_INVALID = 0x01;
20
-    const MAP_TYPE_FIXED_LEN = 0x02;
21
-    const MAP_TYPE_POSITIONS = 0x03;
19
+	const MAP_TYPE_INVALID = 0x01;
20
+	const MAP_TYPE_FIXED_LEN = 0x02;
21
+	const MAP_TYPE_POSITIONS = 0x03;
22 22
 
23
-    /**
24
-     * Returns the complete character map.
25
-     *
26
-     * @param string $string
27
-     * @param int    $startOffset
28
-     * @param array  $currentMap
29
-     * @param mixed  $ignoredChars
30
-     *
31
-     * @return int
32
-     */
33
-    public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars);
23
+	/**
24
+	 * Returns the complete character map.
25
+	 *
26
+	 * @param string $string
27
+	 * @param int    $startOffset
28
+	 * @param array  $currentMap
29
+	 * @param mixed  $ignoredChars
30
+	 *
31
+	 * @return int
32
+	 */
33
+	public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars);
34 34
 
35
-    /**
36
-     * Returns the mapType, see constants.
37
-     *
38
-     * @return int
39
-     */
40
-    public function getMapType();
35
+	/**
36
+	 * Returns the mapType, see constants.
37
+	 *
38
+	 * @return int
39
+	 */
40
+	public function getMapType();
41 41
 
42
-    /**
43
-     * Returns an integer which specifies how many more bytes to read.
44
-     *
45
-     * A positive integer indicates the number of more bytes to fetch before invoking
46
-     * this method again.
47
-     *
48
-     * A value of zero means this is already a valid character.
49
-     * A value of -1 means this cannot possibly be a valid character.
50
-     *
51
-     * @param int[] $bytes
52
-     * @param int   $size
53
-     *
54
-     * @return int
55
-     */
56
-    public function validateByteSequence($bytes, $size);
42
+	/**
43
+	 * Returns an integer which specifies how many more bytes to read.
44
+	 *
45
+	 * A positive integer indicates the number of more bytes to fetch before invoking
46
+	 * this method again.
47
+	 *
48
+	 * A value of zero means this is already a valid character.
49
+	 * A value of -1 means this cannot possibly be a valid character.
50
+	 *
51
+	 * @param int[] $bytes
52
+	 * @param int   $size
53
+	 *
54
+	 * @return int
55
+	 */
56
+	public function validateByteSequence($bytes, $size);
57 57
 
58
-    /**
59
-     * Returns the number of bytes which should be read to start each character.
60
-     *
61
-     * For fixed width character sets this should be the number of octets-per-character.
62
-     * For multibyte character sets this will probably be 1.
63
-     *
64
-     * @return int
65
-     */
66
-    public function getInitialByteSize();
58
+	/**
59
+	 * Returns the number of bytes which should be read to start each character.
60
+	 *
61
+	 * For fixed width character sets this should be the number of octets-per-character.
62
+	 * For multibyte character sets this will probably be 1.
63
+	 *
64
+	 * @return int
65
+	 */
66
+	public function getInitialByteSize();
67 67
 }
Please login to merge, or discard this patch.
includes/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php 1 patch
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -15,140 +15,140 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener, Swift_Events_CommandListener, Swift_Events_ResponseListener, Swift_InputByteStream
17 17
 {
18
-    /**
19
-     * The outgoing traffic counter.
20
-     *
21
-     * @var int
22
-     */
23
-    private $out = 0;
24
-
25
-    /**
26
-     * The incoming traffic counter.
27
-     *
28
-     * @var int
29
-     */
30
-    private $in = 0;
31
-
32
-    /** Bound byte streams */
33
-    private $mirrors = [];
34
-
35
-    /**
36
-     * Not used.
37
-     */
38
-    public function beforeSendPerformed(Swift_Events_SendEvent $evt)
39
-    {
40
-    }
41
-
42
-    /**
43
-     * Invoked immediately after the Message is sent.
44
-     */
45
-    public function sendPerformed(Swift_Events_SendEvent $evt)
46
-    {
47
-        $message = $evt->getMessage();
48
-        $message->toByteStream($this);
49
-    }
50
-
51
-    /**
52
-     * Invoked immediately following a command being sent.
53
-     */
54
-    public function commandSent(Swift_Events_CommandEvent $evt)
55
-    {
56
-        $command = $evt->getCommand();
57
-        $this->out += \strlen($command);
58
-    }
59
-
60
-    /**
61
-     * Invoked immediately following a response coming back.
62
-     */
63
-    public function responseReceived(Swift_Events_ResponseEvent $evt)
64
-    {
65
-        $response = $evt->getResponse();
66
-        $this->in += \strlen($response);
67
-    }
68
-
69
-    /**
70
-     * Called when a message is sent so that the outgoing counter can be increased.
71
-     *
72
-     * @param string $bytes
73
-     */
74
-    public function write($bytes)
75
-    {
76
-        $this->out += \strlen($bytes);
77
-        foreach ($this->mirrors as $stream) {
78
-            $stream->write($bytes);
79
-        }
80
-    }
81
-
82
-    /**
83
-     * Not used.
84
-     */
85
-    public function commit()
86
-    {
87
-    }
88
-
89
-    /**
90
-     * Attach $is to this stream.
91
-     *
92
-     * The stream acts as an observer, receiving all data that is written.
93
-     * All {@link write()} and {@link flushBuffers()} operations will be mirrored.
94
-     */
95
-    public function bind(Swift_InputByteStream $is)
96
-    {
97
-        $this->mirrors[] = $is;
98
-    }
99
-
100
-    /**
101
-     * Remove an already bound stream.
102
-     *
103
-     * If $is is not bound, no errors will be raised.
104
-     * If the stream currently has any buffered data it will be written to $is
105
-     * before unbinding occurs.
106
-     */
107
-    public function unbind(Swift_InputByteStream $is)
108
-    {
109
-        foreach ($this->mirrors as $k => $stream) {
110
-            if ($is === $stream) {
111
-                unset($this->mirrors[$k]);
112
-            }
113
-        }
114
-    }
115
-
116
-    /**
117
-     * Not used.
118
-     */
119
-    public function flushBuffers()
120
-    {
121
-        foreach ($this->mirrors as $stream) {
122
-            $stream->flushBuffers();
123
-        }
124
-    }
125
-
126
-    /**
127
-     * Get the total number of bytes sent to the server.
128
-     *
129
-     * @return int
130
-     */
131
-    public function getBytesOut()
132
-    {
133
-        return $this->out;
134
-    }
135
-
136
-    /**
137
-     * Get the total number of bytes received from the server.
138
-     *
139
-     * @return int
140
-     */
141
-    public function getBytesIn()
142
-    {
143
-        return $this->in;
144
-    }
145
-
146
-    /**
147
-     * Reset the internal counters to zero.
148
-     */
149
-    public function reset()
150
-    {
151
-        $this->out = 0;
152
-        $this->in = 0;
153
-    }
18
+	/**
19
+	 * The outgoing traffic counter.
20
+	 *
21
+	 * @var int
22
+	 */
23
+	private $out = 0;
24
+
25
+	/**
26
+	 * The incoming traffic counter.
27
+	 *
28
+	 * @var int
29
+	 */
30
+	private $in = 0;
31
+
32
+	/** Bound byte streams */
33
+	private $mirrors = [];
34
+
35
+	/**
36
+	 * Not used.
37
+	 */
38
+	public function beforeSendPerformed(Swift_Events_SendEvent $evt)
39
+	{
40
+	}
41
+
42
+	/**
43
+	 * Invoked immediately after the Message is sent.
44
+	 */
45
+	public function sendPerformed(Swift_Events_SendEvent $evt)
46
+	{
47
+		$message = $evt->getMessage();
48
+		$message->toByteStream($this);
49
+	}
50
+
51
+	/**
52
+	 * Invoked immediately following a command being sent.
53
+	 */
54
+	public function commandSent(Swift_Events_CommandEvent $evt)
55
+	{
56
+		$command = $evt->getCommand();
57
+		$this->out += \strlen($command);
58
+	}
59
+
60
+	/**
61
+	 * Invoked immediately following a response coming back.
62
+	 */
63
+	public function responseReceived(Swift_Events_ResponseEvent $evt)
64
+	{
65
+		$response = $evt->getResponse();
66
+		$this->in += \strlen($response);
67
+	}
68
+
69
+	/**
70
+	 * Called when a message is sent so that the outgoing counter can be increased.
71
+	 *
72
+	 * @param string $bytes
73
+	 */
74
+	public function write($bytes)
75
+	{
76
+		$this->out += \strlen($bytes);
77
+		foreach ($this->mirrors as $stream) {
78
+			$stream->write($bytes);
79
+		}
80
+	}
81
+
82
+	/**
83
+	 * Not used.
84
+	 */
85
+	public function commit()
86
+	{
87
+	}
88
+
89
+	/**
90
+	 * Attach $is to this stream.
91
+	 *
92
+	 * The stream acts as an observer, receiving all data that is written.
93
+	 * All {@link write()} and {@link flushBuffers()} operations will be mirrored.
94
+	 */
95
+	public function bind(Swift_InputByteStream $is)
96
+	{
97
+		$this->mirrors[] = $is;
98
+	}
99
+
100
+	/**
101
+	 * Remove an already bound stream.
102
+	 *
103
+	 * If $is is not bound, no errors will be raised.
104
+	 * If the stream currently has any buffered data it will be written to $is
105
+	 * before unbinding occurs.
106
+	 */
107
+	public function unbind(Swift_InputByteStream $is)
108
+	{
109
+		foreach ($this->mirrors as $k => $stream) {
110
+			if ($is === $stream) {
111
+				unset($this->mirrors[$k]);
112
+			}
113
+		}
114
+	}
115
+
116
+	/**
117
+	 * Not used.
118
+	 */
119
+	public function flushBuffers()
120
+	{
121
+		foreach ($this->mirrors as $stream) {
122
+			$stream->flushBuffers();
123
+		}
124
+	}
125
+
126
+	/**
127
+	 * Get the total number of bytes sent to the server.
128
+	 *
129
+	 * @return int
130
+	 */
131
+	public function getBytesOut()
132
+	{
133
+		return $this->out;
134
+	}
135
+
136
+	/**
137
+	 * Get the total number of bytes received from the server.
138
+	 *
139
+	 * @return int
140
+	 */
141
+	public function getBytesIn()
142
+	{
143
+		return $this->in;
144
+	}
145
+
146
+	/**
147
+	 * Reset the internal counters to zero.
148
+	 */
149
+	public function reset()
150
+	{
151
+		$this->out = 0;
152
+		$this->in = 0;
153
+	}
154 154
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -15,56 +15,56 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
17 17
 {
18
-    /**
19
-     * @var Swift_Mime_SimpleMessage[]
20
-     */
21
-    private $messages;
18
+	/**
19
+	 * @var Swift_Mime_SimpleMessage[]
20
+	 */
21
+	private $messages;
22 22
 
23
-    public function __construct()
24
-    {
25
-        $this->messages = [];
26
-    }
23
+	public function __construct()
24
+	{
25
+		$this->messages = [];
26
+	}
27 27
 
28
-    /**
29
-     * Get the message list.
30
-     *
31
-     * @return Swift_Mime_SimpleMessage[]
32
-     */
33
-    public function getMessages()
34
-    {
35
-        return $this->messages;
36
-    }
28
+	/**
29
+	 * Get the message list.
30
+	 *
31
+	 * @return Swift_Mime_SimpleMessage[]
32
+	 */
33
+	public function getMessages()
34
+	{
35
+		return $this->messages;
36
+	}
37 37
 
38
-    /**
39
-     * Get the message count.
40
-     *
41
-     * @return int count
42
-     */
43
-    public function countMessages()
44
-    {
45
-        return \count($this->messages);
46
-    }
38
+	/**
39
+	 * Get the message count.
40
+	 *
41
+	 * @return int count
42
+	 */
43
+	public function countMessages()
44
+	{
45
+		return \count($this->messages);
46
+	}
47 47
 
48
-    /**
49
-     * Empty the message list.
50
-     */
51
-    public function clear()
52
-    {
53
-        $this->messages = [];
54
-    }
48
+	/**
49
+	 * Empty the message list.
50
+	 */
51
+	public function clear()
52
+	{
53
+		$this->messages = [];
54
+	}
55 55
 
56
-    /**
57
-     * Invoked immediately before the Message is sent.
58
-     */
59
-    public function beforeSendPerformed(Swift_Events_SendEvent $evt)
60
-    {
61
-        $this->messages[] = clone $evt->getMessage();
62
-    }
56
+	/**
57
+	 * Invoked immediately before the Message is sent.
58
+	 */
59
+	public function beforeSendPerformed(Swift_Events_SendEvent $evt)
60
+	{
61
+		$this->messages[] = clone $evt->getMessage();
62
+	}
63 63
 
64
-    /**
65
-     * Invoked immediately after the Message is sent.
66
-     */
67
-    public function sendPerformed(Swift_Events_SendEvent $evt)
68
-    {
69
-    }
64
+	/**
65
+	 * Invoked immediately after the Message is sent.
66
+	 */
67
+	public function sendPerformed(Swift_Events_SendEvent $evt)
68
+	{
69
+	}
70 70
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php 1 patch
Indentation   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -15,182 +15,182 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin implements Swift_Plugins_Sleeper, Swift_Plugins_Timer
17 17
 {
18
-    /** Flag for throttling in bytes per minute */
19
-    const BYTES_PER_MINUTE = 0x01;
20
-
21
-    /** Flag for throttling in emails per second (Amazon SES) */
22
-    const MESSAGES_PER_SECOND = 0x11;
23
-
24
-    /** Flag for throttling in emails per minute */
25
-    const MESSAGES_PER_MINUTE = 0x10;
26
-
27
-    /**
28
-     * The Sleeper instance for sleeping.
29
-     *
30
-     * @var Swift_Plugins_Sleeper
31
-     */
32
-    private $sleeper;
33
-
34
-    /**
35
-     * The Timer instance which provides the timestamp.
36
-     *
37
-     * @var Swift_Plugins_Timer
38
-     */
39
-    private $timer;
40
-
41
-    /**
42
-     * The time at which the first email was sent.
43
-     *
44
-     * @var int
45
-     */
46
-    private $start;
47
-
48
-    /**
49
-     * The rate at which messages should be sent.
50
-     *
51
-     * @var int
52
-     */
53
-    private $rate;
54
-
55
-    /**
56
-     * The mode for throttling.
57
-     *
58
-     * This is {@link BYTES_PER_MINUTE} or {@link MESSAGES_PER_MINUTE}
59
-     *
60
-     * @var int
61
-     */
62
-    private $mode;
63
-
64
-    /**
65
-     * An internal counter of the number of messages sent.
66
-     *
67
-     * @var int
68
-     */
69
-    private $messages = 0;
70
-
71
-    /**
72
-     * Create a new ThrottlerPlugin.
73
-     *
74
-     * @param int                   $rate
75
-     * @param int                   $mode    defaults to {@link BYTES_PER_MINUTE}
76
-     * @param Swift_Plugins_Sleeper $sleeper (only needed in testing)
77
-     * @param Swift_Plugins_Timer   $timer   (only needed in testing)
78
-     */
79
-    public function __construct($rate, $mode = self::BYTES_PER_MINUTE, Swift_Plugins_Sleeper $sleeper = null, Swift_Plugins_Timer $timer = null)
80
-    {
81
-        $this->rate = $rate;
82
-        $this->mode = $mode;
83
-        $this->sleeper = $sleeper;
84
-        $this->timer = $timer;
85
-    }
86
-
87
-    /**
88
-     * Invoked immediately before the Message is sent.
89
-     */
90
-    public function beforeSendPerformed(Swift_Events_SendEvent $evt)
91
-    {
92
-        $time = $this->getTimestamp();
93
-        if (!isset($this->start)) {
94
-            $this->start = $time;
95
-        }
96
-        $duration = $time - $this->start;
97
-
98
-        switch ($this->mode) {
99
-            case self::BYTES_PER_MINUTE:
100
-                $sleep = $this->throttleBytesPerMinute($duration);
101
-                break;
102
-            case self::MESSAGES_PER_SECOND:
103
-                $sleep = $this->throttleMessagesPerSecond($duration);
104
-                break;
105
-            case self::MESSAGES_PER_MINUTE:
106
-                $sleep = $this->throttleMessagesPerMinute($duration);
107
-                break;
108
-            default:
109
-                $sleep = 0;
110
-                break;
111
-        }
112
-
113
-        if ($sleep > 0) {
114
-            $this->sleep($sleep);
115
-        }
116
-    }
117
-
118
-    /**
119
-     * Invoked when a Message is sent.
120
-     */
121
-    public function sendPerformed(Swift_Events_SendEvent $evt)
122
-    {
123
-        parent::sendPerformed($evt);
124
-        ++$this->messages;
125
-    }
126
-
127
-    /**
128
-     * Sleep for $seconds.
129
-     *
130
-     * @param int $seconds
131
-     */
132
-    public function sleep($seconds)
133
-    {
134
-        if (isset($this->sleeper)) {
135
-            $this->sleeper->sleep($seconds);
136
-        } else {
137
-            sleep($seconds);
138
-        }
139
-    }
140
-
141
-    /**
142
-     * Get the current UNIX timestamp.
143
-     *
144
-     * @return int
145
-     */
146
-    public function getTimestamp()
147
-    {
148
-        if (isset($this->timer)) {
149
-            return $this->timer->getTimestamp();
150
-        }
151
-
152
-        return time();
153
-    }
154
-
155
-    /**
156
-     * Get a number of seconds to sleep for.
157
-     *
158
-     * @param int $timePassed
159
-     *
160
-     * @return int
161
-     */
162
-    private function throttleBytesPerMinute($timePassed)
163
-    {
164
-        $expectedDuration = $this->getBytesOut() / ($this->rate / 60);
165
-
166
-        return (int) ceil($expectedDuration - $timePassed);
167
-    }
168
-
169
-    /**
170
-     * Get a number of seconds to sleep for.
171
-     *
172
-     * @param int $timePassed
173
-     *
174
-     * @return int
175
-     */
176
-    private function throttleMessagesPerSecond($timePassed)
177
-    {
178
-        $expectedDuration = $this->messages / $this->rate;
179
-
180
-        return (int) ceil($expectedDuration - $timePassed);
181
-    }
182
-
183
-    /**
184
-     * Get a number of seconds to sleep for.
185
-     *
186
-     * @param int $timePassed
187
-     *
188
-     * @return int
189
-     */
190
-    private function throttleMessagesPerMinute($timePassed)
191
-    {
192
-        $expectedDuration = $this->messages / ($this->rate / 60);
193
-
194
-        return (int) ceil($expectedDuration - $timePassed);
195
-    }
18
+	/** Flag for throttling in bytes per minute */
19
+	const BYTES_PER_MINUTE = 0x01;
20
+
21
+	/** Flag for throttling in emails per second (Amazon SES) */
22
+	const MESSAGES_PER_SECOND = 0x11;
23
+
24
+	/** Flag for throttling in emails per minute */
25
+	const MESSAGES_PER_MINUTE = 0x10;
26
+
27
+	/**
28
+	 * The Sleeper instance for sleeping.
29
+	 *
30
+	 * @var Swift_Plugins_Sleeper
31
+	 */
32
+	private $sleeper;
33
+
34
+	/**
35
+	 * The Timer instance which provides the timestamp.
36
+	 *
37
+	 * @var Swift_Plugins_Timer
38
+	 */
39
+	private $timer;
40
+
41
+	/**
42
+	 * The time at which the first email was sent.
43
+	 *
44
+	 * @var int
45
+	 */
46
+	private $start;
47
+
48
+	/**
49
+	 * The rate at which messages should be sent.
50
+	 *
51
+	 * @var int
52
+	 */
53
+	private $rate;
54
+
55
+	/**
56
+	 * The mode for throttling.
57
+	 *
58
+	 * This is {@link BYTES_PER_MINUTE} or {@link MESSAGES_PER_MINUTE}
59
+	 *
60
+	 * @var int
61
+	 */
62
+	private $mode;
63
+
64
+	/**
65
+	 * An internal counter of the number of messages sent.
66
+	 *
67
+	 * @var int
68
+	 */
69
+	private $messages = 0;
70
+
71
+	/**
72
+	 * Create a new ThrottlerPlugin.
73
+	 *
74
+	 * @param int                   $rate
75
+	 * @param int                   $mode    defaults to {@link BYTES_PER_MINUTE}
76
+	 * @param Swift_Plugins_Sleeper $sleeper (only needed in testing)
77
+	 * @param Swift_Plugins_Timer   $timer   (only needed in testing)
78
+	 */
79
+	public function __construct($rate, $mode = self::BYTES_PER_MINUTE, Swift_Plugins_Sleeper $sleeper = null, Swift_Plugins_Timer $timer = null)
80
+	{
81
+		$this->rate = $rate;
82
+		$this->mode = $mode;
83
+		$this->sleeper = $sleeper;
84
+		$this->timer = $timer;
85
+	}
86
+
87
+	/**
88
+	 * Invoked immediately before the Message is sent.
89
+	 */
90
+	public function beforeSendPerformed(Swift_Events_SendEvent $evt)
91
+	{
92
+		$time = $this->getTimestamp();
93
+		if (!isset($this->start)) {
94
+			$this->start = $time;
95
+		}
96
+		$duration = $time - $this->start;
97
+
98
+		switch ($this->mode) {
99
+			case self::BYTES_PER_MINUTE:
100
+				$sleep = $this->throttleBytesPerMinute($duration);
101
+				break;
102
+			case self::MESSAGES_PER_SECOND:
103
+				$sleep = $this->throttleMessagesPerSecond($duration);
104
+				break;
105
+			case self::MESSAGES_PER_MINUTE:
106
+				$sleep = $this->throttleMessagesPerMinute($duration);
107
+				break;
108
+			default:
109
+				$sleep = 0;
110
+				break;
111
+		}
112
+
113
+		if ($sleep > 0) {
114
+			$this->sleep($sleep);
115
+		}
116
+	}
117
+
118
+	/**
119
+	 * Invoked when a Message is sent.
120
+	 */
121
+	public function sendPerformed(Swift_Events_SendEvent $evt)
122
+	{
123
+		parent::sendPerformed($evt);
124
+		++$this->messages;
125
+	}
126
+
127
+	/**
128
+	 * Sleep for $seconds.
129
+	 *
130
+	 * @param int $seconds
131
+	 */
132
+	public function sleep($seconds)
133
+	{
134
+		if (isset($this->sleeper)) {
135
+			$this->sleeper->sleep($seconds);
136
+		} else {
137
+			sleep($seconds);
138
+		}
139
+	}
140
+
141
+	/**
142
+	 * Get the current UNIX timestamp.
143
+	 *
144
+	 * @return int
145
+	 */
146
+	public function getTimestamp()
147
+	{
148
+		if (isset($this->timer)) {
149
+			return $this->timer->getTimestamp();
150
+		}
151
+
152
+		return time();
153
+	}
154
+
155
+	/**
156
+	 * Get a number of seconds to sleep for.
157
+	 *
158
+	 * @param int $timePassed
159
+	 *
160
+	 * @return int
161
+	 */
162
+	private function throttleBytesPerMinute($timePassed)
163
+	{
164
+		$expectedDuration = $this->getBytesOut() / ($this->rate / 60);
165
+
166
+		return (int) ceil($expectedDuration - $timePassed);
167
+	}
168
+
169
+	/**
170
+	 * Get a number of seconds to sleep for.
171
+	 *
172
+	 * @param int $timePassed
173
+	 *
174
+	 * @return int
175
+	 */
176
+	private function throttleMessagesPerSecond($timePassed)
177
+	{
178
+		$expectedDuration = $this->messages / $this->rate;
179
+
180
+		return (int) ceil($expectedDuration - $timePassed);
181
+	}
182
+
183
+	/**
184
+	 * Get a number of seconds to sleep for.
185
+	 *
186
+	 * @param int $timePassed
187
+	 *
188
+	 * @return int
189
+	 */
190
+	private function throttleMessagesPerMinute($timePassed)
191
+	{
192
+		$expectedDuration = $this->messages / ($this->rate / 60);
193
+
194
+		return (int) ceil($expectedDuration - $timePassed);
195
+	}
196 196
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -15,51 +15,51 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/swiftmailer/lib/classes/Swift/Plugins/Decorator/Replacements.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -15,58 +15,58 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -15,44 +15,44 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Logger.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.