@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | private function getAllPartsIterator() |
| 52 | 52 | { |
| 53 | 53 | $iter = new AppendIterator(); |
| 54 | - $iter->append(new ArrayIterator([ $this ])); |
|
| 54 | + $iter->append(new ArrayIterator([$this])); |
|
| 55 | 55 | $iter->append(new RecursiveIteratorIterator($this->partChildrenContainer, RecursiveIteratorIterator::SELF_FIRST)); |
| 56 | 56 | return $iter; |
| 57 | 57 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public function getPartByContentId($contentId) |
| 139 | 139 | { |
| 140 | 140 | $sanitized = preg_replace('/^\s*<|>\s*$/', '', $contentId); |
| 141 | - return $this->getPart(0, function (IMessagePart $part) use ($sanitized) { |
|
| 141 | + return $this->getPart(0, function(IMessagePart $part) use ($sanitized) { |
|
| 142 | 142 | return strcasecmp($part->getContentId(), $sanitized) === 0; |
| 143 | 143 | }); |
| 144 | 144 | } |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | * |
| 108 | 108 | * @param IMimePart $part |
| 109 | 109 | * @return MimePart the newly-created MimePart |
| 110 | - */ |
|
| 110 | + */ |
|
| 111 | 111 | public function createNewContentPartFrom(IMimePart $part) |
| 112 | 112 | { |
| 113 | 113 | $mime = $this->mimePartFactory->newInstance(); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @var string[] non mime content fields that are not related to the content |
| 24 | 24 | * of a part. |
| 25 | 25 | */ |
| 26 | - private static $nonMimeContentFields = [ 'contentreturn', 'contentidentifier' ]; |
|
| 26 | + private static $nonMimeContentFields = ['contentreturn', 'contentidentifier']; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Returns true if the passed header's name is a Content-* header other than |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->copyHeader($from, $to, HeaderConsts::CONTENT_TRANSFER_ENCODING); |
| 97 | 97 | } |
| 98 | 98 | foreach ($from->getAllHeaders() as $header) { |
| 99 | - if ($this->isMimeContentField($header, [ 'contenttype', 'contenttransferencoding' ])) { |
|
| 99 | + if ($this->isMimeContentField($header, ['contenttype', 'contenttransferencoding'])) { |
|
| 100 | 100 | $this->copyHeader($from, $to, $header->getName()); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $this->addRawHeaderToPart($header, $container); |
| 49 | 49 | $header = ''; |
| 50 | 50 | } else { |
| 51 | - $line = "\r\n" . $line; |
|
| 51 | + $line = "\r\n".$line; |
|
| 52 | 52 | } |
| 53 | 53 | $header .= rtrim($line, "\r\n"); |
| 54 | 54 | } while ($header !== ''); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function getUniqueBoundary($mimeType) |
| 48 | 48 | { |
| 49 | 49 | $type = ltrim(strtoupper(preg_replace('/^(multipart\/(.{3}).*|.*)$/i', '$2-', $mimeType)), '-'); |
| 50 | - return uniqid('----=MMP-' . $type . '-', true); |
|
| 50 | + return uniqid('----=MMP-'.$type.'-', true); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $part->setRawHeader( |
| 63 | 63 | HeaderConsts::CONTENT_TYPE, |
| 64 | 64 | "$mimeType;\r\n\tboundary=\"" |
| 65 | - . $this->getUniqueBoundary($mimeType) . '"' |
|
| 65 | + . $this->getUniqueBoundary($mimeType).'"' |
|
| 66 | 66 | ); |
| 67 | 67 | $part->notify(); |
| 68 | 68 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | public function createAndAddPartForAttachment(IMessage $message, $resource, $mimeType, $disposition, $filename = null, $encoding = 'base64') |
| 332 | 332 | { |
| 333 | 333 | if ($filename === null) { |
| 334 | - $filename = 'file' . uniqid(); |
|
| 334 | + $filename = 'file'.uniqid(); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | $safe = iconv('UTF-8', 'US-ASCII//translit//ignore', $filename); |
@@ -108,8 +108,7 @@ |
||
| 108 | 108 | $part->setRawHeader( |
| 109 | 109 | HeaderConsts::CONTENT_TRANSFER_ENCODING, |
| 110 | 110 | ($contentType === 'text/plain' || $contentType === 'text/html') ? |
| 111 | - 'quoted-printable' : |
|
| 112 | - 'base64' |
|
| 111 | + 'quoted-printable' : 'base64' |
|
| 113 | 112 | ); |
| 114 | 113 | } |
| 115 | 114 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $this->children, |
| 103 | 103 | $index, |
| 104 | 104 | 0, |
| 105 | - [ $part ] |
|
| 105 | + [$part] |
|
| 106 | 106 | ); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | if (!$value instanceof IMessagePart) { |
| 139 | 139 | throw new InvalidArgumentException( |
| 140 | - get_class($value) . ' is not a ZBateson\MailMimeParser\Message\IMessagePart' |
|
| 140 | + get_class($value).' is not a ZBateson\MailMimeParser\Message\IMessagePart' |
|
| 141 | 141 | ); |
| 142 | 142 | } |
| 143 | 143 | $index = ($offset === null) ? count($this->children) : $offset; |
@@ -167,7 +167,7 @@ |
||
| 167 | 167 | public function getContentDisposition($default = 'inline') |
| 168 | 168 | { |
| 169 | 169 | $value = strtolower($this->getHeaderValue(HeaderConsts::CONTENT_DISPOSITION)); |
| 170 | - if ($value === null || !in_array($value, [ 'inline', 'attachment' ])) { |
|
| 170 | + if ($value === null || !in_array($value, ['inline', 'attachment'])) { |
|
| 171 | 171 | return $default; |
| 172 | 172 | } |
| 173 | 173 | return $value; |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public static function fromAttachmentFilter() |
| 32 | 32 | { |
| 33 | - return function (IMessagePart $part) { |
|
| 33 | + return function(IMessagePart $part) { |
|
| 34 | 34 | $type = strtolower($part->getContentType()); |
| 35 | - if (in_array($type, [ 'text/plain', 'text/html' ]) && strcasecmp($part->getContentDisposition(), 'inline') === 0) { |
|
| 35 | + if (in_array($type, ['text/plain', 'text/html']) && strcasecmp($part->getContentDisposition(), 'inline') === 0) { |
|
| 36 | 36 | return false; |
| 37 | 37 | } |
| 38 | 38 | return !(($part instanceof IMimePart) |
@@ -42,6 +42,6 @@ |
||
| 42 | 42 | foreach ($parts as $part) { |
| 43 | 43 | $strValue .= $part->getValue(); |
| 44 | 44 | } |
| 45 | - return [ $this->partFactory->newDatePart($strValue) ]; |
|
| 45 | + return [$this->partFactory->newDatePart($strValue)]; |
|
| 46 | 46 | } |
| 47 | 47 | } |