@@ -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(10); |
|
99 | + $fileName = $this->_path.'/'.$this->getRandomString(10); |
|
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; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $ret = ''; |
205 | 205 | $strlen = strlen($base); |
206 | 206 | for ($i = 0; $i < $count; ++$i) { |
207 | - $ret .= $base[((int)mt_rand(0, $strlen - 1))]; |
|
207 | + $ret .= $base[((int) mt_rand(0, $strlen - 1))]; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | return $ret; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function setTimeout($timeout) |
141 | 141 | { |
142 | - $this->_timeout = (int)$timeout; |
|
142 | + $this->_timeout = (int) $timeout; |
|
143 | 143 | |
144 | 144 | return $this; |
145 | 145 | } |
@@ -306,11 +306,11 @@ discard block |
||
306 | 306 | $host = $this->_host; |
307 | 307 | switch (strtolower($this->_crypto)) { |
308 | 308 | case 'ssl': |
309 | - $host = 'ssl://' . $host; |
|
309 | + $host = 'ssl://'.$host; |
|
310 | 310 | break; |
311 | 311 | |
312 | 312 | case 'tls': |
313 | - $host = 'tls://' . $host; |
|
313 | + $host = 'tls://'.$host; |
|
314 | 314 | break; |
315 | 315 | } |
316 | 316 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | return false; |
48 | 48 | } |
49 | 49 | |
50 | - foreach ((array)$this->_search as $needle) { |
|
50 | + foreach ((array) $this->_search as $needle) { |
|
51 | 51 | if ( |
52 | 52 | $needle |
53 | 53 | && |
@@ -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; |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | if ($this->_cache->hasKey($this->_cacheKey, 'body')) { |
540 | 540 | $body = $this->_cache->getString($this->_cacheKey, 'body'); |
541 | 541 | } else { |
542 | - $body = "\r\n" . $this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); |
|
542 | + $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); |
|
543 | 543 | $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE); |
544 | 544 | } |
545 | 545 | $string .= $body; |
@@ -547,10 +547,10 @@ discard block |
||
547 | 547 | |
548 | 548 | if (!empty($this->_immediateChildren)) { |
549 | 549 | foreach ($this->_immediateChildren as $child) { |
550 | - $string .= "\r\n\r\n--" . $this->getBoundary() . "\r\n"; |
|
550 | + $string .= "\r\n\r\n--".$this->getBoundary()."\r\n"; |
|
551 | 551 | $string .= $child->toString(); |
552 | 552 | } |
553 | - $string .= "\r\n\r\n--" . $this->getBoundary() . "--\r\n"; |
|
553 | + $string .= "\r\n\r\n--".$this->getBoundary()."--\r\n"; |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | return $string; |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | |
618 | 618 | if (!empty($this->_immediateChildren)) { |
619 | 619 | foreach ($this->_immediateChildren as $child) { |
620 | - $is->write("\r\n\r\n--" . $this->getBoundary() . "\r\n"); |
|
620 | + $is->write("\r\n\r\n--".$this->getBoundary()."\r\n"); |
|
621 | 621 | $child->toByteStream($is); |
622 | 622 | } |
623 | - $is->write("\r\n\r\n--" . $this->getBoundary() . "--\r\n"); |
|
623 | + $is->write("\r\n\r\n--".$this->getBoundary()."--\r\n"); |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | { |
752 | 752 | $idLeft = $this->_generateNewCacheKey(); |
753 | 753 | $idRight = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated'; |
754 | - $id = $idLeft . '@' . $idRight; |
|
754 | + $id = $idLeft.'@'.$idRight; |
|
755 | 755 | |
756 | 756 | try { |
757 | 757 | $this->_assertValidId($id); |
758 | 758 | } catch (Swift_RfcComplianceException $e) { |
759 | - $id = $idLeft . '@swift.generated'; |
|
759 | + $id = $idLeft.'@swift.generated'; |
|
760 | 760 | } |
761 | 761 | |
762 | 762 | return $id; |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | */ |
770 | 770 | private function _generateNewCacheKey() |
771 | 771 | { |
772 | - return md5(getmypid() . '.' . time() . '.' . uniqid(mt_rand(), true)); |
|
772 | + return md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true)); |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | private function _readStream(Swift_OutputByteStream $os) |
@@ -852,10 +852,10 @@ discard block |
||
852 | 852 | $lowercaseType = Swift::strtolowerWithStaticCache($child->getContentType()); |
853 | 853 | |
854 | 854 | if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) { |
855 | - return (int)$filter[$realLevel][$lowercaseType]; |
|
855 | + return (int) $filter[$realLevel][$lowercaseType]; |
|
856 | 856 | } |
857 | 857 | |
858 | - return (int)$realLevel; |
|
858 | + return (int) $realLevel; |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | /** |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | private function _assertValidId($id) |
950 | 950 | { |
951 | 951 | if ($this->_emailValidator->isValidWrapper($id) === false) { |
952 | - throw new Swift_RfcComplianceException('Invalid ID given <' . $id . '>'); |
|
952 | + throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>'); |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 |
@@ -228,6 +228,6 @@ |
||
228 | 228 | */ |
229 | 229 | protected function _convertString($string) |
230 | 230 | { |
231 | - return UTF8::encode($this->getCharset(),$string, false); |
|
231 | + return UTF8::encode($this->getCharset(), $string, false); |
|
232 | 232 | } |
233 | 233 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | if ($lang && $this->_lang !== $lang) { |
108 | 108 | $this->clearCachedValue(); |
109 | - $this->_lang = (string)$lang; |
|
109 | + $this->_lang = (string) $lang; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | if ($lineLength && $this->_lineLength !== $lineLength) { |
166 | 166 | $this->clearCachedValue(); |
167 | 167 | |
168 | - $this->_lineLength = (int)$lineLength; |
|
168 | + $this->_lineLength = (int) $lineLength; |
|
169 | 169 | |
170 | 170 | return true; |
171 | 171 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $phraseStr = $string; |
230 | 230 | |
231 | 231 | // If it's not valid ... |
232 | - if (!preg_match('/^' . self::PHRASE_PATTERN . '$/D', $phraseStr)) { |
|
232 | + if (!preg_match('/^'.self::PHRASE_PATTERN.'$/D', $phraseStr)) { |
|
233 | 233 | |
234 | 234 | if (preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $phraseStr)) { |
235 | 235 | // ... but it is just ascii text, try escaping some characters |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // ... and make it a quoted-string. |
243 | - $phraseStr = '"' . $phraseStr . '"'; |
|
243 | + $phraseStr = '"'.$phraseStr.'"'; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | return $phraseStr; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | protected function escapeSpecials($token, array $include = array()) |
258 | 258 | { |
259 | 259 | foreach (array_merge(array('\\'), $include) as $char) { |
260 | - $token = str_replace($char, '\\' . $char, $token); |
|
260 | + $token = str_replace($char, '\\'.$char, $token); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | return $token; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $token = substr($token, 1); |
290 | 290 | } |
291 | 291 | |
292 | - $usedLength = strlen($header->getFieldName() . ': ') + strlen($value); |
|
292 | + $usedLength = strlen($header->getFieldName().': ') + strlen($value); |
|
293 | 293 | $value .= $this->getTokenAsEncodedWord($token, $usedLength); |
294 | 294 | |
295 | 295 | $header->setMaxLineLength(74); // Forcefully override (we need to save two chars for quoting) |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | $charsetDecl = $this->_charset; |
365 | 365 | |
366 | 366 | if ($this->_lang) { |
367 | - $charsetDecl .= '*' . $this->_lang; |
|
367 | + $charsetDecl .= '*'.$this->_lang; |
|
368 | 368 | } |
369 | 369 | |
370 | - $encodingWrapperLength = strlen('=?' . $charsetDecl . '?' . $this->_encoder->getName() . '??='); |
|
370 | + $encodingWrapperLength = strlen('=?'.$charsetDecl.'?'.$this->_encoder->getName().'??='); |
|
371 | 371 | |
372 | 372 | if ($firstLineOffset >= 75) { |
373 | 373 | // Does this logic need to be here? |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | if (Swift::strtolowerWithStaticCache($this->_charset) !== 'iso-2022-jp') { |
384 | 384 | // special encoding for iso-2022-jp using mb_encode_mimeheader |
385 | 385 | foreach ($encodedTextLines as $lineNum => $line) { |
386 | - $encodedTextLines[$lineNum] = '=?' . $charsetDecl . '?' . $this->_encoder->getName() . '?' . $line . '?='; |
|
386 | + $encodedTextLines[$lineNum] = '=?'.$charsetDecl.'?'.$this->_encoder->getName().'?'.$line.'?='; |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | { |
478 | 478 | $lineCount = 0; |
479 | 479 | $headerLines = array(); |
480 | - $headerLines[] = $this->_name . ': '; |
|
480 | + $headerLines[] = $this->_name.': '; |
|
481 | 481 | $currentLine = &$headerLines[$lineCount++]; |
482 | 482 | |
483 | 483 | // Build all tokens back into compliant header |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | ( |
493 | 493 | $i > 0 |
494 | 494 | && |
495 | - strlen($currentLine . $token) > $this->_lineLength |
|
495 | + strlen($currentLine.$token) > $this->_lineLength |
|
496 | 496 | ) |
497 | 497 | ) |
498 | 498 | ) { |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | } |
508 | 508 | |
509 | 509 | // Implode with FWS (RFC 2822, 2.2.3) |
510 | - return implode("\r\n", $headerLines) . "\r\n"; |
|
510 | + return implode("\r\n", $headerLines)."\r\n"; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -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 | } |