@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $boundary = $part->getHeaderParameter(HeaderConsts::CONTENT_TYPE, 'boundary'); |
159 | 159 | if ($boundary === null) { |
160 | 160 | return array_map( |
161 | - function ($child) { |
|
161 | + function($child) { |
|
162 | 162 | return $child->getStream(); |
163 | 163 | }, |
164 | 164 | $part->getChildParts() |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $content = Psr7\Utils::streamFor(); |
189 | 189 | $this->writePartContentTo($content); |
190 | 190 | $content->rewind(); |
191 | - $streams = [ $this->streamFactory->newHeaderStream($this->part), $content ]; |
|
191 | + $streams = [$this->streamFactory->newHeaderStream($this->part), $content]; |
|
192 | 192 | |
193 | 193 | if ($this->part instanceof IMimePart && $this->part->getChildCount() > 0) { |
194 | 194 | $streams = array_merge($streams, $this->getBoundaryAndChildStreams($this->part)); |
@@ -123,8 +123,7 @@ discard block |
||
123 | 123 | public function getStream() |
124 | 124 | { |
125 | 125 | return ($this->parent !== null) ? |
126 | - $this->parent->getStream() : |
|
127 | - $this->messageStream; |
|
126 | + $this->parent->getStream() : $this->messageStream; |
|
128 | 127 | } |
129 | 128 | |
130 | 129 | /** |
@@ -136,8 +135,7 @@ discard block |
||
136 | 135 | public function getMessageResourceHandle() |
137 | 136 | { |
138 | 137 | return ($this->parent !== null) ? |
139 | - $this->parent->getMessageResourceHandle() : |
|
140 | - $this->messageHandle; |
|
138 | + $this->parent->getMessageResourceHandle() : $this->messageHandle; |
|
141 | 139 | } |
142 | 140 | |
143 | 141 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct(MimeParser $mimeParser, NonMimeParser $nonMimeParser) |
29 | 29 | { |
30 | - $this->setParsers([ $mimeParser, $nonMimeParser ]); |
|
30 | + $this->setParsers([$mimeParser, $nonMimeParser]); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -77,8 +77,7 @@ discard block |
||
77 | 77 | foreach ($this->parsers as $parser) { |
78 | 78 | if ($parser->canParse($partBuilder)) { |
79 | 79 | $factory = ($partBuilder->getParent() === null) ? |
80 | - $parser->getParserMessageProxyFactory() : |
|
81 | - $parser->getParserPartProxyFactory(); |
|
80 | + $parser->getParserMessageProxyFactory() : $parser->getParserPartProxyFactory(); |
|
82 | 81 | return $factory->newInstance($partBuilder, $parser); |
83 | 82 | } |
84 | 83 | } |
@@ -167,7 +167,7 @@ |
||
167 | 167 | public function getContentDisposition($default = 'inline') |
168 | 168 | { |
169 | 169 | $value = $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 strtolower($value); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function overwrite8bitContentEncoding(IMessage $message) |
102 | 102 | { |
103 | - $parts = $message->getAllParts(function (IMessagePart $part) { |
|
103 | + $parts = $message->getAllParts(function(IMessagePart $part) { |
|
104 | 104 | return strcasecmp($part->getContentTransferEncoding(), '8bit') === 0; |
105 | 105 | }); |
106 | 106 | foreach ($parts as $part) { |
@@ -108,8 +108,7 @@ discard block |
||
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 | } |
@@ -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 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function moveAllNonMultiPartsToMessageExcept(IMessage $message, IMimePart $from, $exceptMimeType) |
205 | 205 | { |
206 | - $parts = $from->getAllParts(function (IMessagePart $part) use ($exceptMimeType) { |
|
206 | + $parts = $from->getAllParts(function(IMessagePart $part) use ($exceptMimeType) { |
|
207 | 207 | if ($part instanceof IMimePart && $part->isMultiPart()) { |
208 | 208 | return false; |
209 | 209 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | public function createAndAddPartForAttachment(IMessage $message, $resource, $mimeType, $disposition, $filename = null, $encoding = 'base64') |
331 | 331 | { |
332 | 332 | if ($filename === null) { |
333 | - $filename = 'file' . uniqid(); |
|
333 | + $filename = 'file'.uniqid(); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | $safe = iconv('UTF-8', 'US-ASCII//translit//ignore', $filename); |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function fromAttachmentFilter() |
32 | 32 | { |
33 | - return function (IMessagePart $part) { |
|
33 | + return function(IMessagePart $part) { |
|
34 | 34 | $type = $part->getContentType(); |
35 | 35 | $disp = $part->getContentDisposition(); |
36 | - if (in_array($type, [ 'text/plain', 'text/html' ]) && $disp !== null && strcasecmp($disp, 'inline') === 0) { |
|
36 | + if (in_array($type, ['text/plain', 'text/html']) && $disp !== null && strcasecmp($disp, 'inline') === 0) { |
|
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | return !(($part instanceof IMimePart) |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public static function fromHeaderValue($name, $value, $excludeSignedParts = true) |
58 | 58 | { |
59 | - return function (IMessagePart $part) use ($name, $value, $excludeSignedParts) { |
|
59 | + return function(IMessagePart $part) use ($name, $value, $excludeSignedParts) { |
|
60 | 60 | if ($part instanceof IMimePart) { |
61 | 61 | if ($excludeSignedParts && $part->isSignaturePart()) { |
62 | 62 | return false; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public static function fromContentType($mimeType) |
78 | 78 | { |
79 | - return function (IMessagePart $part) use ($mimeType) { |
|
79 | + return function(IMessagePart $part) use ($mimeType) { |
|
80 | 80 | return strcasecmp($part->getContentType(), $mimeType) === 0; |
81 | 81 | }; |
82 | 82 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function fromInlineContentType($mimeType) |
92 | 92 | { |
93 | - return function (IMessagePart $part) use ($mimeType) { |
|
93 | + return function(IMessagePart $part) use ($mimeType) { |
|
94 | 94 | $disp = $part->getContentDisposition(); |
95 | 95 | return (strcasecmp($part->getContentType(), $mimeType) === 0) && ($disp === null |
96 | 96 | || strcasecmp($disp, 'attachment') !== 0); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function fromDisposition($disposition, $includeMultipart = false, $includeSignedParts = false) |
113 | 113 | { |
114 | - return function (IMessagePart $part) use ($disposition, $includeMultipart, $includeSignedParts) { |
|
114 | + return function(IMessagePart $part) use ($disposition, $includeMultipart, $includeSignedParts) { |
|
115 | 115 | if (($part instanceof IMimePart) && ((!$includeMultipart && $part->isMultiPart()) || (!$includeSignedParts && $part->isSignaturePart()))) { |
116 | 116 | return false; |
117 | 117 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | private function getAllPartsIterator() |
43 | 43 | { |
44 | 44 | $iter = new AppendIterator(); |
45 | - $iter->append(new ArrayIterator([ $this ])); |
|
45 | + $iter->append(new ArrayIterator([$this])); |
|
46 | 46 | $iter->append(new RecursiveIteratorIterator($this->partChildrenContainer, RecursiveIteratorIterator::SELF_FIRST)); |
47 | 47 | return $iter; |
48 | 48 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function getPartByContentId($contentId) |
130 | 130 | { |
131 | 131 | $sanitized = preg_replace('/^\s*<|>\s*$/', '', $contentId); |
132 | - return $this->getPart(0, function (IMessagePart $part) use ($sanitized) { |
|
132 | + return $this->getPart(0, function(IMessagePart $part) use ($sanitized) { |
|
133 | 133 | $cid = $part->getContentId(); |
134 | 134 | return ($cid !== null && strcasecmp($cid, $sanitized) === 0); |
135 | 135 | }); |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function autoRegister($class) |
55 | 55 | { |
56 | - $fn = function ($c) use ($class) { |
|
56 | + $fn = function($c) use ($class) { |
|
57 | 57 | $ref = new ReflectionClass($class); |
58 | 58 | $cargs = ($ref->getConstructor() !== null) ? $ref->getConstructor()->getParameters() : []; |
59 | 59 | $ap = []; |