@@ -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 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $s = $this->headerFactory->getNormalizedHeaderName($name); |
90 | 90 | if (isset($this->headerMap[$s])) { |
91 | 91 | $self = $this; |
92 | - $filtered = array_filter($this->headerMap[$s], function ($h) use ($name, $self) { |
|
92 | + $filtered = array_filter($this->headerMap[$s], function($h) use ($name, $self) { |
|
93 | 93 | return (strcasecmp($self->headers[$h][0], $name) === 0); |
94 | 94 | }); |
95 | 95 | return (!empty($filtered)) ? $filtered : $this->headerMap[$s]; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $a = $this->getAllWithOriginalHeaderNameIfSet($name); |
129 | 129 | if (!empty($a)) { |
130 | 130 | $self = $this; |
131 | - return array_map(function ($index) use ($self) { |
|
131 | + return array_map(function($index) use ($self) { |
|
132 | 132 | return $self->getByIndex($index); |
133 | 133 | }, $a); |
134 | 134 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | public function add($name, $value) |
208 | 208 | { |
209 | 209 | $s = $this->headerFactory->getNormalizedHeaderName($name); |
210 | - $this->headers[$this->nextIndex] = [ $name, $value ]; |
|
210 | + $this->headers[$this->nextIndex] = [$name, $value]; |
|
211 | 211 | $this->headerObjects[$this->nextIndex] = null; |
212 | 212 | if (!isset($this->headerMap[$s])) { |
213 | 213 | $this->headerMap[$s] = []; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | return; |
236 | 236 | } |
237 | 237 | $i = $this->headerMap[$s][$offset]; |
238 | - $this->headers[$i] = [ $name, $value ]; |
|
238 | + $this->headers[$i] = [$name, $value]; |
|
239 | 239 | $this->headerObjects[$i] = null; |
240 | 240 | } |
241 | 241 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getHeaderObjects() |
249 | 249 | { |
250 | - return array_filter(array_map([ $this, 'getByIndex' ], array_keys($this->headers))); |
|
250 | + return array_filter(array_map([$this, 'getByIndex'], array_keys($this->headers))); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -88,15 +88,13 @@ |
||
88 | 88 | public function getStream() |
89 | 89 | { |
90 | 90 | return ($this->parent !== null) ? |
91 | - $this->parent->getStream() : |
|
92 | - $this->messageStream; |
|
91 | + $this->parent->getStream() : $this->messageStream; |
|
93 | 92 | } |
94 | 93 | |
95 | 94 | public function getMessageResourceHandle() |
96 | 95 | { |
97 | 96 | return ($this->parent !== null) ? |
98 | - $this->parent->getMessageResourceHandle() : |
|
99 | - $this->messageHandle; |
|
97 | + $this->parent->getMessageResourceHandle() : $this->messageHandle; |
|
100 | 98 | } |
101 | 99 | |
102 | 100 | public function getMessageResourceHandlePos() |
@@ -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) |