@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | * Removes the 'inline' part with the passed contentType, at the given index |
338 | 338 | * defaulting to the first |
339 | 339 | * |
340 | - * @param string $contentType |
|
341 | 340 | * @param int $index |
341 | + * @param string $mimeType |
|
342 | 342 | * @return boolean true on success |
343 | 343 | */ |
344 | 344 | protected function removePartByMimeType($mimeType, $index = 0) |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | * Otherwise searches for a text/plain part to return. |
646 | 646 | * |
647 | 647 | * @param string $mimeType |
648 | - * @return MimeType or null if not found |
|
648 | + * @return MimePart|null or null if not found |
|
649 | 649 | */ |
650 | 650 | private function findOtherContentPartFor($mimeType) |
651 | 651 | { |
@@ -451,7 +451,7 @@ |
||
451 | 451 | * |
452 | 452 | * @param MimePart $part |
453 | 453 | * @return MimePart the newly-created MimePart |
454 | - */ |
|
454 | + */ |
|
455 | 455 | private function createNewContentPartFromPart(MimePart $part) |
456 | 456 | { |
457 | 457 | $contPart = $this->mimePartFactory->newMimePart(); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | private function getUniqueBoundary($mimeType) |
187 | 187 | { |
188 | 188 | $type = ltrim(strtoupper(preg_replace('/^(multipart\/(.{3}).*|.*)$/i', '$2-', $mimeType)), '-'); |
189 | - return uniqid('----=MMP-' . $type . $this->objectId . '.', true); |
|
189 | + return uniqid('----=MMP-'.$type.$this->objectId.'.', true); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $part->setRawHeader( |
202 | 202 | 'Content-Type', |
203 | 203 | "$mimeType;\r\n\tboundary=\"" |
204 | - . $this->getUniqueBoundary($mimeType) . '"' |
|
204 | + . $this->getUniqueBoundary($mimeType).'"' |
|
205 | 205 | ); |
206 | 206 | } |
207 | 207 | |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | private function overwrite8bitContentEncoding() |
533 | 533 | { |
534 | 534 | $parts = $this->getAllParts(new PartFilter([ |
535 | - 'headers' => [ PartFilter::FILTER_INCLUDE => [ |
|
535 | + 'headers' => [PartFilter::FILTER_INCLUDE => [ |
|
536 | 536 | 'Content-Transfer-Encoding' => '8bit' |
537 | - ] ] |
|
537 | + ]] |
|
538 | 538 | ])); |
539 | 539 | foreach ($parts as $part) { |
540 | 540 | $contentType = strtolower($part->getHeaderValue('Content-Type', 'text/plain')); |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | */ |
599 | 599 | public function getSignaturePart() |
600 | 600 | { |
601 | - return $this->getChild(0, new PartFilter([ 'signedpart' => PartFilter::FILTER_INCLUDE ])); |
|
601 | + return $this->getChild(0, new PartFilter(['signedpart' => PartFilter::FILTER_INCLUDE])); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | /** |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | ); |
830 | 830 | return array_values(array_filter( |
831 | 831 | $parts, |
832 | - function ($part) { |
|
832 | + function($part) { |
|
833 | 833 | return !( |
834 | 834 | $part->isTextPart() |
835 | 835 | && $part->getHeaderValue('Content-Disposition', 'inline') === 'inline' |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | public function addAttachmentPart($stringOrHandle, $mimeType, $filename = null, $disposition = 'attachment') |
891 | 891 | { |
892 | 892 | if ($filename === null) { |
893 | - $filename = 'file' . uniqid(); |
|
893 | + $filename = 'file'.uniqid(); |
|
894 | 894 | } |
895 | 895 | $filename = iconv('UTF-8', 'US-ASCII//translit//ignore', $filename); |
896 | 896 | $part = $this->createPartForAttachment(); |
@@ -170,7 +170,7 @@ |
||
170 | 170 | * |
171 | 171 | * @param string $name Name of the member variable |
172 | 172 | * @param string $value The value to test |
173 | - * @param array $valid an array of valid values |
|
173 | + * @param integer[] $valid an array of valid values |
|
174 | 174 | * @throws InvalidArgumentException |
175 | 175 | */ |
176 | 176 | private function validateArgument($name, $value, array $valid) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function __construct(array $filter = []) |
158 | 158 | { |
159 | - $params = [ 'multipart', 'textpart', 'signedpart', 'headers' ]; |
|
159 | + $params = ['multipart', 'textpart', 'signedpart', 'headers']; |
|
160 | 160 | foreach ($params as $param) { |
161 | 161 | if (isset($filter[$param])) { |
162 | 162 | $this->__set($param, $filter[$param]); |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | if (!in_array($value, $valid)) { |
179 | 179 | $last = array_pop($valid); |
180 | 180 | throw new InvalidArgumentException( |
181 | - '$value parameter for ' . $name . ' must be one of ' |
|
182 | - . join(', ', $valid) . ' or ' . $last . ' - "' . $value |
|
181 | + '$value parameter for '.$name.' must be one of ' |
|
182 | + . join(', ', $valid).' or '.$last.' - "'.$value |
|
183 | 183 | . '" provided' |
184 | 184 | ); |
185 | 185 | } |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function setHeaders(array $headers) |
196 | 196 | { |
197 | - array_walk($headers, function ($v, $k) { |
|
197 | + array_walk($headers, function($v, $k) { |
|
198 | 198 | $this->validateArgument( |
199 | 199 | 'headers', |
200 | 200 | $k, |
201 | - [ static::FILTER_EXCLUDE, static::FILTER_INCLUDE ] |
|
201 | + [static::FILTER_EXCLUDE, static::FILTER_INCLUDE] |
|
202 | 202 | ); |
203 | 203 | if (!is_array($v)) { |
204 | 204 | throw new InvalidArgumentException( |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $this->validateArgument( |
226 | 226 | $name, |
227 | 227 | $value, |
228 | - [ static::FILTER_OFF, static::FILTER_EXCLUDE, static::FILTER_INCLUDE ] |
|
228 | + [static::FILTER_OFF, static::FILTER_EXCLUDE, static::FILTER_INCLUDE] |
|
229 | 229 | ); |
230 | 230 | $this->$name = $value; |
231 | 231 | } elseif ($name === 'headers') { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | if ($part !== $this) { |
94 | 94 | $part->setParent($this); |
95 | - array_splice($this->parts, ($position === null) ? count($this->parts) : $position, 0, [ $part ]); |
|
95 | + array_splice($this->parts, ($position === null) ? count($this->parts) : $position, 0, [$part]); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getAllParts(PartFilter $filter = null) |
169 | 169 | { |
170 | - $aParts = [ $this ]; |
|
170 | + $aParts = [$this]; |
|
171 | 171 | foreach ($this->parts as $part) { |
172 | 172 | $aParts = array_merge($aParts, $part->getAllParts(null, true)); |
173 | 173 | } |
174 | 174 | if (!empty($filter)) { |
175 | 175 | return array_values(array_filter( |
176 | 176 | $aParts, |
177 | - [ $filter, 'filter' ] |
|
177 | + [$filter, 'filter'] |
|
178 | 178 | )); |
179 | 179 | } |
180 | 180 | return $aParts; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | public function getChildParts(PartFilter $filter = null) |
223 | 223 | { |
224 | 224 | if ($filter !== null) { |
225 | - return array_values(array_filter($this->parts, [ $filter, 'filter' ])); |
|
225 | + return array_values(array_filter($this->parts, [$filter, 'filter'])); |
|
226 | 226 | } |
227 | 227 | return $this->parts; |
228 | 228 | } |
@@ -166,7 +166,7 @@ |
||
166 | 166 | { |
167 | 167 | $sChars = implode('|', $this->getAllTokenSeparators()); |
168 | 168 | $mimePartPattern = MimeLiteralPart::MIME_PART_PATTERN; |
169 | - return '~(' . $mimePartPattern . '|\\\\.|' . $sChars . ')~'; |
|
169 | + return '~('.$mimePartPattern.'|\\\\.|'.$sChars.')~'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | if ($this->partStreamRegistry === null) { |
206 | 206 | $this->registerStreamExtensions(); |
207 | 207 | } |
208 | - return $this->getInstance('partStreamRegistry', __NAMESPACE__ . '\Stream\PartStreamRegistry'); |
|
208 | + return $this->getInstance('partStreamRegistry', __NAMESPACE__.'\Stream\PartStreamRegistry'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function getHeaderPartFactory() |
217 | 217 | { |
218 | - return $this->getInstance('headerPartFactory', __NAMESPACE__ . '\Header\Part\HeaderPartFactory'); |
|
218 | + return $this->getInstance('headerPartFactory', __NAMESPACE__.'\Header\Part\HeaderPartFactory'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getMimeLiteralPartFactory() |
227 | 227 | { |
228 | - return $this->getInstance('mimeLiteralPartFactory', __NAMESPACE__ . '\Header\Part\MimeLiteralPartFactory'); |
|
228 | + return $this->getInstance('mimeLiteralPartFactory', __NAMESPACE__.'\Header\Part\MimeLiteralPartFactory'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | */ |
253 | 253 | protected function registerStreamExtensions() |
254 | 254 | { |
255 | - stream_filter_register(UUDecodeStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__ . '\Stream\UUDecodeStreamFilter'); |
|
256 | - stream_filter_register(UUEncodeStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__ . '\Stream\UUEncodeStreamFilter'); |
|
257 | - stream_filter_register(CharsetStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__ . '\Stream\CharsetStreamFilter'); |
|
258 | - stream_wrapper_register(PartStream::STREAM_WRAPPER_PROTOCOL, __NAMESPACE__ . '\Stream\PartStream'); |
|
255 | + stream_filter_register(UUDecodeStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__.'\Stream\UUDecodeStreamFilter'); |
|
256 | + stream_filter_register(UUEncodeStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__.'\Stream\UUEncodeStreamFilter'); |
|
257 | + stream_filter_register(CharsetStreamFilter::STREAM_FILTER_NAME, __NAMESPACE__.'\Stream\CharsetStreamFilter'); |
|
258 | + stream_wrapper_register(PartStream::STREAM_WRAPPER_PROTOCOL, __NAMESPACE__.'\Stream\PartStream'); |
|
259 | 259 | |
260 | 260 | // originally created for HHVM compatibility, but decided to use them |
261 | 261 | // instead of built-in stream filters for reliability -- it seems the |
@@ -269,19 +269,19 @@ discard block |
||
269 | 269 | // filters, so now they're all named mmp-convert.* |
270 | 270 | stream_filter_register( |
271 | 271 | 'mmp-convert.quoted-printable-decode', |
272 | - __NAMESPACE__ . '\Stream\ConvertStreamFilter' |
|
272 | + __NAMESPACE__.'\Stream\ConvertStreamFilter' |
|
273 | 273 | ); |
274 | 274 | stream_filter_register( |
275 | 275 | 'mmp-convert.quoted-printable-encode', |
276 | - __NAMESPACE__ . '\Stream\ConvertStreamFilter' |
|
276 | + __NAMESPACE__.'\Stream\ConvertStreamFilter' |
|
277 | 277 | ); |
278 | 278 | stream_filter_register( |
279 | 279 | Base64EncodeStreamFilter::STREAM_FILTER_NAME, |
280 | - __NAMESPACE__ . '\Stream\Base64EncodeStreamFilter' |
|
280 | + __NAMESPACE__.'\Stream\Base64EncodeStreamFilter' |
|
281 | 281 | ); |
282 | 282 | stream_filter_register( |
283 | 283 | Base64DecodeStreamFilter::STREAM_FILTER_NAME, |
284 | - __NAMESPACE__ . '\Stream\Base64DecodeStreamFilter' |
|
284 | + __NAMESPACE__.'\Stream\Base64DecodeStreamFilter' |
|
285 | 285 | ); |
286 | 286 | } |
287 | 287 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | $first = false; |
156 | 156 | $read = ltrim($read, "\r\n"); |
157 | 157 | } |
158 | - $read = $lastChars . $read; |
|
158 | + $read = $lastChars.$read; |
|
159 | 159 | $lastChars = ''; |
160 | 160 | $matches = null; |
161 | 161 | if (preg_match('/[\r\n]+$/', $read, $matches)) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $handle, |
140 | 140 | 'mailmimeparser-encode', |
141 | 141 | STREAM_FILTER_READ, |
142 | - [ 'charset' => $part->getHeaderParameter('Content-Type', 'charset') ] |
|
142 | + ['charset' => $part->getHeaderParameter('Content-Type', 'charset')] |
|
143 | 143 | ); |
144 | 144 | } |
145 | 145 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | if (empty($this->registeredHandles[$id])) { |
160 | 160 | return null; |
161 | 161 | } |
162 | - $handle = fopen('mmp-mime-message://' . $id . '?start=' . |
|
163 | - $start . '&end=' . $end, 'r'); |
|
162 | + $handle = fopen('mmp-mime-message://'.$id.'?start='. |
|
163 | + $start.'&end='.$end, 'r'); |
|
164 | 164 | |
165 | 165 | $this->attachEncodingFilterToStream($part, $handle); |
166 | 166 | $this->attachCharsetFilterToStream($part, $handle); |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | if (empty($this->registeredHandles[$id])) { |
183 | 183 | return null; |
184 | 184 | } |
185 | - $handle = fopen('mmp-mime-message://' . $id . '?start=' . |
|
186 | - $start . '&end=' . $end, 'r'); |
|
185 | + $handle = fopen('mmp-mime-message://'.$id.'?start='. |
|
186 | + $start.'&end='.$end, 'r'); |
|
187 | 187 | |
188 | 188 | $part->attachOriginalStreamHandle($handle); |
189 | 189 | } |