@@ -70,7 +70,7 @@ |
||
70 | 70 | * |
71 | 71 | * This method returns a UNIX timestamp. |
72 | 72 | * |
73 | - * @return mixed |
|
73 | + * @return integer|null |
|
74 | 74 | */ |
75 | 75 | public function getFieldBodyModel() |
76 | 76 | { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | foreach ($this->_params as $name => $value) { |
133 | 133 | if (null !== $value) { |
134 | 134 | // Add the parameter |
135 | - $body .= '; ' . $this->_createParameter($name, $value); |
|
135 | + $body .= '; '.$this->_createParameter($name, $value); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $tokens[count($tokens) - 1] .= ';'; |
161 | 161 | $tokens = array_merge( |
162 | 162 | $tokens, |
163 | - $this->generateTokenLines(' ' . $this->_createParameter($name, $value)) |
|
163 | + $this->generateTokenLines(' '.$this->_createParameter($name, $value)) |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | } |
@@ -182,19 +182,19 @@ discard block |
||
182 | 182 | |
183 | 183 | $encoded = false; |
184 | 184 | // Allow room for parameter name, indices, "=" and DQUOTEs |
185 | - $maxValueLength = $this->getMaxLineLength() - strlen($name . '=*N"";') - 1; |
|
185 | + $maxValueLength = $this->getMaxLineLength() - strlen($name.'=*N"";') - 1; |
|
186 | 186 | $firstLineOffset = 0; |
187 | 187 | |
188 | 188 | // If it's not already a valid parameter value ... |
189 | - if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) { |
|
189 | + if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { |
|
190 | 190 | // TODO: text, or something else?? |
191 | 191 | // ... and it's not ascii |
192 | 192 | if (!preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $value)) { |
193 | 193 | $encoded = true; |
194 | 194 | |
195 | 195 | // Allow space for the indices, charset and language. |
196 | - $maxValueLength = $this->getMaxLineLength() - strlen($name . '*N*="";') - 1; |
|
197 | - $firstLineOffset = strlen($this->getCharset() . "'" . $this->getLanguage() . "'"); |
|
196 | + $maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*="";') - 1; |
|
197 | + $firstLineOffset = strlen($this->getCharset()."'".$this->getLanguage()."'"); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | if (count($valueLines) > 1) { |
225 | 225 | $paramLines = array(); |
226 | 226 | foreach ($valueLines as $i => $line) { |
227 | - $paramLines[] = $name . '*' . $i . $this->_getEndOfParameterValue($line, true, $i === 0); |
|
227 | + $paramLines[] = $name.'*'.$i.$this->_getEndOfParameterValue($line, true, $i === 0); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | return implode(";\r\n ", $paramLines); |
231 | 231 | } |
232 | 232 | |
233 | - return $name . $this->_getEndOfParameterValue( |
|
233 | + return $name.$this->_getEndOfParameterValue( |
|
234 | 234 | $valueLines[0], |
235 | 235 | $encoded, |
236 | 236 | true |
@@ -248,18 +248,18 @@ discard block |
||
248 | 248 | */ |
249 | 249 | private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false) |
250 | 250 | { |
251 | - if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) { |
|
252 | - $value = '"' . $value . '"'; |
|
251 | + if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) { |
|
252 | + $value = '"'.$value.'"'; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | $prepend = '='; |
256 | 256 | if ($encoded) { |
257 | 257 | $prepend = '*='; |
258 | 258 | if ($firstLine) { |
259 | - $prepend = '*=' . $this->getCharset() . "'" . $this->getLanguage() . "'"; |
|
259 | + $prepend = '*='.$this->getCharset()."'".$this->getLanguage()."'"; |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - return $prepend . $value; |
|
263 | + return $prepend.$value; |
|
264 | 264 | } |
265 | 265 | } |
@@ -202,7 +202,7 @@ |
||
202 | 202 | * |
203 | 203 | * @see getNameAddresses() |
204 | 204 | * |
205 | - * @return string[] |
|
205 | + * @return integer[] |
|
206 | 206 | */ |
207 | 207 | public function getAddresses() |
208 | 208 | { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function setNameAddresses($mailboxes) |
111 | 111 | { |
112 | - $this->_mailboxes = $this->normalizeMailboxes((array)$mailboxes); |
|
112 | + $this->_mailboxes = $this->normalizeMailboxes((array) $mailboxes); |
|
113 | 113 | $this->setCachedValue(null); //Clear any cached value |
114 | 114 | } |
115 | 115 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function setAddresses($addresses) |
196 | 196 | { |
197 | - $this->setNameAddresses(array_values((array)$addresses)); |
|
197 | + $this->setNameAddresses(array_values((array) $addresses)); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function removeAddresses($addresses) |
218 | 218 | { |
219 | 219 | $this->setCachedValue(null); |
220 | - foreach ((array)$addresses as $address) { |
|
220 | + foreach ((array) $addresses as $address) { |
|
221 | 221 | unset($this->_mailboxes[$address]); |
222 | 222 | } |
223 | 223 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $mailboxStr = $email; |
338 | 338 | if ($name) { |
339 | 339 | $nameStr = $this->createDisplayNameString($name, 0 === count($strings)); |
340 | - $mailboxStr = $nameStr . ' <' . $mailboxStr . '>'; |
|
340 | + $mailboxStr = $nameStr.' <'.$mailboxStr.'>'; |
|
341 | 341 | } |
342 | 342 | $strings[] = $mailboxStr; |
343 | 343 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | private function _assertValidAddress($address) |
356 | 356 | { |
357 | 357 | if ($this->_emailValidator->isValidWrapper($address) === false) { |
358 | - throw new Swift_RfcComplianceException('Address in mailbox given [' . $address . '] does not comply with RFC 2822, 3.6.2.'); |
|
358 | + throw new Swift_RfcComplianceException('Address in mailbox given ['.$address.'] does not comply with RFC 2822, 3.6.2.'); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setPort($port) |
93 | 93 | { |
94 | - $this->_params['port'] = (int)$port; |
|
94 | + $this->_params['port'] = (int) $port; |
|
95 | 95 | |
96 | 96 | return $this; |
97 | 97 | } |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function setTimeout($timeout) |
117 | 117 | { |
118 | - $this->_params['timeout'] = (int)$timeout; |
|
119 | - $this->_buffer->setParam('timeout', (int)$timeout); |
|
118 | + $this->_params['timeout'] = (int) $timeout; |
|
119 | + $this->_buffer->setParam('timeout', (int) $timeout); |
|
120 | 120 | |
121 | 121 | return $this; |
122 | 122 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function executeCommand($command, $codes = array(), &$failures = null) |
258 | 258 | { |
259 | - $failures = (array)$failures; |
|
259 | + $failures = (array) $failures; |
|
260 | 260 | $stopSignal = false; |
261 | 261 | $response = null; |
262 | 262 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | $inArray = in_array( |
289 | 289 | Swift::strtolowerWithStaticCache($method), |
290 | - array_map(array('Swift', 'strtolowerWithStaticCache'), (array)$handler->exposeMixinMethods()), |
|
290 | + array_map(array('Swift', 'strtolowerWithStaticCache'), (array) $handler->exposeMixinMethods()), |
|
291 | 291 | true |
292 | 292 | ); |
293 | 293 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | } |
307 | 307 | } |
308 | 308 | } |
309 | - trigger_error('Call to undefined method ' . $method, E_USER_ERROR); |
|
309 | + trigger_error('Call to undefined method '.$method, E_USER_ERROR); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** Get the params to initialize the buffer */ |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | |
373 | 373 | $params = array(); |
374 | 374 | foreach ($handlers as $handler) { |
375 | - $params = array_merge($params, (array)$handler->getMailParams()); |
|
375 | + $params = array_merge($params, (array) $handler->getMailParams()); |
|
376 | 376 | } |
377 | 377 | |
378 | - $paramStr = !empty($params) ? ' ' . implode(' ', $params) : ''; |
|
378 | + $paramStr = !empty($params) ? ' '.implode(' ', $params) : ''; |
|
379 | 379 | $this->executeCommand( |
380 | 380 | sprintf("MAIL FROM:<%s>%s\r\n", $address, $paramStr), array(250) |
381 | 381 | ); |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | |
393 | 393 | $params = array(); |
394 | 394 | foreach ($handlers as $handler) { |
395 | - $params = array_merge($params, (array)$handler->getRcptParams()); |
|
395 | + $params = array_merge($params, (array) $handler->getRcptParams()); |
|
396 | 396 | } |
397 | 397 | |
398 | - $paramStr = !empty($params) ? ' ' . implode(' ', $params) : ''; |
|
398 | + $paramStr = !empty($params) ? ' '.implode(' ', $params) : ''; |
|
399 | 399 | $this->executeCommand( |
400 | 400 | sprintf("RCPT TO:<%s>%s\r\n", $address, $paramStr), array(250, 251, 252) |
401 | 401 | ); |
@@ -167,6 +167,6 @@ |
||
167 | 167 | } |
168 | 168 | $extension = Swift::strtolowerWithStaticCache($extension); |
169 | 169 | |
170 | - return (string)$extension; |
|
170 | + return (string) $extension; |
|
171 | 171 | } |
172 | 172 | } |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | public function queueMessage(Swift_Mime_Message $message) |
97 | 97 | { |
98 | 98 | $ser = serialize($message); |
99 | - $fileName = $this->_path . '/' . $this->getRandomString(); |
|
99 | + $fileName = $this->_path.'/'.$this->getRandomString(); |
|
100 | 100 | for ($i = 0; $i < $this->_retryLimit; ++$i) { |
101 | 101 | /* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */ |
102 | - $fp = @fopen($fileName . '.message', 'x'); |
|
102 | + $fp = @fopen($fileName.'.message', 'x'); |
|
103 | 103 | if (false !== $fp) { |
104 | 104 | if (false === fwrite($fp, $ser)) { |
105 | 105 | return false; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - $failedRecipients = (array)$failedRecipients; |
|
159 | + $failedRecipients = (array) $failedRecipients; |
|
160 | 160 | $count = 0; |
161 | 161 | $time = time(); |
162 | 162 | foreach ($directoryIterator as $file) { |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | /* We try a rename, it's an atomic operation, and avoid locking the file */ |
170 | - if (rename($file, $file . '.sending')) { |
|
171 | - $message = unserialize(file_get_contents($file . '.sending')); |
|
170 | + if (rename($file, $file.'.sending')) { |
|
171 | + $message = unserialize(file_get_contents($file.'.sending')); |
|
172 | 172 | |
173 | 173 | $count += $transport->send($message, $failedRecipients); |
174 | 174 | |
175 | - unlink($file . '.sending'); |
|
175 | + unlink($file.'.sending'); |
|
176 | 176 | } else { |
177 | 177 | /* This message has just been catched by another process */ |
178 | 178 | continue; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $ret = ''; |
210 | 210 | $strlen = strlen($base) - 1; |
211 | 211 | for ($i = 0; $i < $count; ++$i) { |
212 | - $ret .= $base[(int)mt_rand(0, $strlen)]; |
|
212 | + $ret .= $base[(int) mt_rand(0, $strlen)]; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | return $ret; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function send(Swift_Mime_Message $message, &$failedRecipients = null) |
132 | 132 | { |
133 | - $failedRecipients = (array)$failedRecipients; |
|
133 | + $failedRecipients = (array) $failedRecipients; |
|
134 | 134 | |
135 | 135 | $evt = $this->_eventDispatcher->createSendEvent($this, $message); |
136 | 136 | if ($evt) { |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | $count = ( |
145 | - count((array)$message->getTo()) |
|
146 | - + count((array)$message->getCc()) |
|
147 | - + count((array)$message->getBcc()) |
|
145 | + count((array) $message->getTo()) |
|
146 | + + count((array) $message->getCc()) |
|
147 | + + count((array) $message->getBcc()) |
|
148 | 148 | ); |
149 | 149 | |
150 | 150 | /* |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | |
178 | 178 | // Separate headers from body |
179 | 179 | if (false !== $endHeaders = strpos($messageStr, "\r\n\r\n")) { |
180 | - $headers = substr($messageStr, 0, $endHeaders) . "\r\n"; // Keep last EOL |
|
180 | + $headers = substr($messageStr, 0, $endHeaders)."\r\n"; // Keep last EOL |
|
181 | 181 | $body = substr($messageStr, $endHeaders + 4); |
182 | 182 | } else { |
183 | - $headers = $messageStr . "\r\n"; |
|
183 | + $headers = $messageStr."\r\n"; |
|
184 | 184 | $body = ''; |
185 | 185 | } |
186 | 186 | |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | } else { |
208 | 208 | $failedRecipients = array_merge( |
209 | 209 | $failedRecipients, |
210 | - array_keys((array)$message->getTo()), |
|
211 | - array_keys((array)$message->getCc()), |
|
212 | - array_keys((array)$message->getBcc()) |
|
210 | + array_keys((array) $message->getTo()), |
|
211 | + array_keys((array) $message->getCc()), |
|
212 | + array_keys((array) $message->getBcc()) |
|
213 | 213 | ); |
214 | 214 | |
215 | 215 | if ($evt) { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $count = 0; |
222 | 222 | } |
223 | 223 | |
224 | - $message->generateId(); // Make sure a new Message ID is used |
|
224 | + $message->generateId(); // Make sure a new Message ID is used |
|
225 | 225 | |
226 | 226 | return $count; |
227 | 227 | } |
@@ -147,7 +147,7 @@ |
||
147 | 147 | $messageStr = $message->toString(); |
148 | 148 | |
149 | 149 | if ($toHeader) { |
150 | - $message->getHeaders()->set($toHeader); |
|
150 | + $message->getHeaders()->set($toHeader); |
|
151 | 151 | } |
152 | 152 | $message->getHeaders()->set($subjectHeader); |
153 | 153 |
@@ -262,7 +262,7 @@ |
||
262 | 262 | * |
263 | 263 | * @param Swift_Mime_Message $message |
264 | 264 | * |
265 | - * @return mixed|null|string |
|
265 | + * @return string|null |
|
266 | 266 | */ |
267 | 267 | private function _getReversePath(Swift_Mime_Message $message) |
268 | 268 | { |
@@ -260,7 +260,7 @@ |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | if ($tmpRet !== '=00') { |
263 | - $ret .= $tmpRet; |
|
263 | + $ret .= $tmpRet; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 |
@@ -641,7 +641,7 @@ |
||
641 | 641 | * |
642 | 642 | * @param string $field |
643 | 643 | * |
644 | - * @return null|string[]|string |
|
644 | + * @return string |
|
645 | 645 | */ |
646 | 646 | protected function _getHeaderFieldModel($field) |
647 | 647 | { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function getId() |
243 | 243 | { |
244 | - $tmp = (array)$this->_getHeaderFieldModel($this->_getIdField()); |
|
244 | + $tmp = (array) $this->_getHeaderFieldModel($this->_getIdField()); |
|
245 | 245 | |
246 | 246 | return $this->_headers->has($this->_getIdField()) ? current($tmp) : $this->_id; |
247 | 247 | } |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | public function getBoundary() |
469 | 469 | { |
470 | 470 | if (!isset($this->_boundary)) { |
471 | - $this->_boundary = '_=_swift_v5_' . time() . '_' . md5(getmypid() . mt_rand() . uniqid('', true)) . '_=_'; |
|
471 | + $this->_boundary = '_=_swift_v5_'.time().'_'.md5(getmypid().mt_rand().uniqid('', true)).'_=_'; |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | return $this->_boundary; |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | if ($this->_cache->hasKey($this->_cacheKey, 'body')) { |
544 | 544 | $body = $this->_cache->getString($this->_cacheKey, 'body'); |
545 | 545 | } else { |
546 | - $body = "\r\n" . $this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); |
|
546 | + $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); |
|
547 | 547 | $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE); |
548 | 548 | } |
549 | 549 | $string .= $body; |
@@ -551,10 +551,10 @@ discard block |
||
551 | 551 | |
552 | 552 | if (!empty($this->_immediateChildren)) { |
553 | 553 | foreach ($this->_immediateChildren as $child) { |
554 | - $string .= "\r\n\r\n--" . $this->getBoundary() . "\r\n"; |
|
554 | + $string .= "\r\n\r\n--".$this->getBoundary()."\r\n"; |
|
555 | 555 | $string .= $child->toString(); |
556 | 556 | } |
557 | - $string .= "\r\n\r\n--" . $this->getBoundary() . "--\r\n"; |
|
557 | + $string .= "\r\n\r\n--".$this->getBoundary()."--\r\n"; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | return $string; |
@@ -621,10 +621,10 @@ discard block |
||
621 | 621 | |
622 | 622 | if (!empty($this->_immediateChildren)) { |
623 | 623 | foreach ($this->_immediateChildren as $child) { |
624 | - $is->write("\r\n\r\n--" . $this->getBoundary() . "\r\n"); |
|
624 | + $is->write("\r\n\r\n--".$this->getBoundary()."\r\n"); |
|
625 | 625 | $child->toByteStream($is); |
626 | 626 | } |
627 | - $is->write("\r\n\r\n--" . $this->getBoundary() . "--\r\n"); |
|
627 | + $is->write("\r\n\r\n--".$this->getBoundary()."--\r\n"); |
|
628 | 628 | } |
629 | 629 | } |
630 | 630 | |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | */ |
754 | 754 | private function _generateNewCacheKey() |
755 | 755 | { |
756 | - return md5(getmypid() . '.' . time() . '.' . uniqid(mt_rand(), true)); |
|
756 | + return md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true)); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | /** |
@@ -849,10 +849,10 @@ discard block |
||
849 | 849 | $lowercaseType = Swift::strtolowerWithStaticCache($child->getContentType()); |
850 | 850 | |
851 | 851 | if (isset($filter[$realLevel], $filter[$realLevel][$lowercaseType])) { |
852 | - return (int)$filter[$realLevel][$lowercaseType]; |
|
852 | + return (int) $filter[$realLevel][$lowercaseType]; |
|
853 | 853 | } |
854 | 854 | |
855 | - return (int)$realLevel; |
|
855 | + return (int) $realLevel; |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -903,8 +903,7 @@ discard block |
||
903 | 903 | foreach ($this->_immediateChildren as $child) { |
904 | 904 | $type = $child->getContentType(); |
905 | 905 | $level = array_key_exists($type, $this->_alternativePartOrder) ? |
906 | - $this->_alternativePartOrder[$type] : |
|
907 | - max($this->_alternativePartOrder) + 1; |
|
906 | + $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1; |
|
908 | 907 | |
909 | 908 | if (empty($sorted[$level])) { |
910 | 909 | $sorted[$level] = array(); |