@@ -50,11 +50,11 @@ |
||
| 50 | 50 | |
| 51 | 51 | $this->setRawHeader( |
| 52 | 52 | 'Content-Type', |
| 53 | - 'application/octet-stream; name="' . addcslashes($filename, '"') . '"' |
|
| 53 | + 'application/octet-stream; name="'.addcslashes($filename, '"').'"' |
|
| 54 | 54 | ); |
| 55 | 55 | $this->setRawHeader( |
| 56 | 56 | 'Content-Disposition', |
| 57 | - 'attachment; filename="' . addcslashes($filename, '"') . '"' |
|
| 57 | + 'attachment; filename="'.addcslashes($filename, '"').'"' |
|
| 58 | 58 | ); |
| 59 | 59 | $this->setRawHeader('Content-Transfer-Encoding', 'x-uuencode'); |
| 60 | 60 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->addRawHeaderToPart($header, $part); |
| 97 | 97 | $header = ''; |
| 98 | 98 | } else { |
| 99 | - $line = "\r\n" . $line; |
|
| 99 | + $line = "\r\n".$line; |
|
| 100 | 100 | } |
| 101 | 101 | $header .= rtrim($line, "\r\n"); |
| 102 | 102 | } while ($header !== ''); |
@@ -177,8 +177,7 @@ discard block |
||
| 177 | 177 | private function getParentBoundary($curBoundary, MimePart $parent = null) |
| 178 | 178 | { |
| 179 | 179 | return $parent !== null ? |
| 180 | - $parent->getHeaderParameter('Content-Type', 'boundary') : |
|
| 181 | - $curBoundary; |
|
| 180 | + $parent->getHeaderParameter('Content-Type', 'boundary') : $curBoundary; |
|
| 182 | 181 | } |
| 183 | 182 | |
| 184 | 183 | /** |
@@ -481,7 +481,7 @@ |
||
| 481 | 481 | $first = false; |
| 482 | 482 | $read = ltrim($read, "\r\n"); |
| 483 | 483 | } |
| 484 | - $read = $lastChars . $read; |
|
| 484 | + $read = $lastChars.$read; |
|
| 485 | 485 | $read = preg_replace('/\r\n|\r|\n/', "\r\n", $read); |
| 486 | 486 | $lastChars = ''; |
| 487 | 487 | $matches = null; |
@@ -63,6 +63,6 @@ |
||
| 63 | 63 | protected function getTokenSplitPattern() |
| 64 | 64 | { |
| 65 | 65 | $sChars = implode('|', $this->getAllTokenSeparators()); |
| 66 | - return '~(' . $sChars . ')~'; |
|
| 66 | + return '~('.$sChars.')~'; |
|
| 67 | 67 | } |
| 68 | 68 | } |
@@ -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 | } |