@@ -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); |
@@ -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 = []; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | protected function getSubConsumers() |
78 | 78 | { |
79 | - return [ $this->consumerService->getCommentConsumer() ]; |
|
79 | + return [$this->consumerService->getCommentConsumer()]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function isStartToken($token) |
90 | 90 | { |
91 | - $pattern = '/^' . preg_quote($this->getPartName(), '/') . '$/i'; |
|
91 | + $pattern = '/^'.preg_quote($this->getPartName(), '/').'$/i'; |
|
92 | 92 | return (preg_match($pattern, $token) === 1); |
93 | 93 | } |
94 | 94 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | return [ |
124 | 124 | '\s+', |
125 | - '(\A\s*|\s+)(?i)' . preg_quote($this->getPartName(), '/') . '(?-i)(?=\s+)' |
|
125 | + '(\A\s*|\s+)(?i)'.preg_quote($this->getPartName(), '/').'(?-i)(?=\s+)' |
|
126 | 126 | ]; |
127 | 127 | } |
128 | 128 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | foreach ($filtered as $part) { |
143 | 143 | if ($part instanceof CommentPart) { |
144 | 144 | $ret[] = $part; |
145 | - continue; // getValue() is empty anyway, but for clarity... |
|
145 | + continue; // getValue() is empty anyway, but for clarity... |
|
146 | 146 | } |
147 | 147 | $strValue .= $part->getValue(); |
148 | 148 | } |
@@ -43,8 +43,8 @@ |
||
43 | 43 | protected function setParseHeaderValue(AbstractConsumer $consumer) |
44 | 44 | { |
45 | 45 | $value = $this->rawValue; |
46 | - $matchp = '~' . MimeLiteralPart::MIME_PART_PATTERN . '~'; |
|
47 | - $value = preg_replace_callback($matchp, function ($matches) { |
|
46 | + $matchp = '~'.MimeLiteralPart::MIME_PART_PATTERN.'~'; |
|
47 | + $value = preg_replace_callback($matchp, function($matches) { |
|
48 | 48 | return $this->mimeLiteralPartFactory->newInstance($matches[0]); |
49 | 49 | }, $value); |
50 | 50 | $this->parts = $consumer($value); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | array $parts, |
100 | 100 | array &$retParts, |
101 | 101 | $curIndex, |
102 | - HeaderPart &$spacePart, |
|
102 | + HeaderPart & $spacePart, |
|
103 | 103 | HeaderPart $lastPart |
104 | 104 | ) { |
105 | 105 | $nextPart = $parts[$curIndex]; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param int $curIndex |
122 | 122 | * @param HeaderPart $spacePart |
123 | 123 | */ |
124 | - private function addSpaces(array $parts, array &$retParts, $curIndex, HeaderPart &$spacePart = null) |
|
124 | + private function addSpaces(array $parts, array &$retParts, $curIndex, HeaderPart & $spacePart = null) |
|
125 | 125 | { |
126 | 126 | $lastPart = end($retParts); |
127 | 127 | if ($spacePart !== null && $curIndex < count($parts) && $parts[$curIndex]->getValue() !== '' && $lastPart !== false) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function getTokenSeparators() |
42 | 42 | { |
43 | - return [ '\(', '\)' ]; |
|
43 | + return ['\(', '\)']; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | foreach ($parts as $part) { |
110 | 110 | // order is important here - CommentPart extends LiteralPart |
111 | 111 | if ($part instanceof CommentPart) { |
112 | - $comment .= '(' . $part->getComment() . ')'; |
|
112 | + $comment .= '('.$part->getComment().')'; |
|
113 | 113 | } elseif ($part instanceof LiteralPart) { |
114 | - $comment .= '"' . str_replace('(["\\])', '\$1', $part->getValue()) . '"'; |
|
114 | + $comment .= '"'.str_replace('(["\\])', '\$1', $part->getValue()).'"'; |
|
115 | 115 | } else { |
116 | 116 | $comment .= $part->getValue(); |
117 | 117 | } |
118 | 118 | } |
119 | - return [ $this->partFactory->newCommentPart($comment) ]; |
|
119 | + return [$this->partFactory->newCommentPart($comment)]; |
|
120 | 120 | } |
121 | 121 | } |