@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $this->setDelimiter($structure->delimiter); |
120 | 120 | $this->path = $structure->name; |
121 | - $this->full_name = $this->decodeName($structure->name); |
|
121 | + $this->full_name = $this->decodeName($structure->name); |
|
122 | 122 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
123 | 123 | |
124 | 124 | $this->parseAttributes($structure->attributes); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return WhereQuery |
132 | 132 | * @throws Exceptions\ConnectionFailedException |
133 | 133 | */ |
134 | - public function query($charset = 'UTF-8'){ |
|
134 | + public function query($charset = 'UTF-8') { |
|
135 | 135 | $this->getClient()->checkConnection(); |
136 | 136 | $this->getClient()->openFolder($this); |
137 | 137 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @inheritdoc self::query($charset = 'UTF-8') |
143 | 143 | * @throws Exceptions\ConnectionFailedException |
144 | 144 | */ |
145 | - public function search($charset = 'UTF-8'){ |
|
145 | + public function search($charset = 'UTF-8') { |
|
146 | 146 | return $this->query($charset); |
147 | 147 | } |
148 | 148 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @inheritdoc self::query($charset = 'UTF-8') |
151 | 151 | * @throws Exceptions\ConnectionFailedException |
152 | 152 | */ |
153 | - public function messages($charset = 'UTF-8'){ |
|
153 | + public function messages($charset = 'UTF-8') { |
|
154 | 154 | return $this->query($charset); |
155 | 155 | } |
156 | 156 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @deprecated 1.2.1:2.0.0 No longer needed. Use Folder::query() instead |
315 | 315 | * @see Folder::query() |
316 | 316 | */ |
317 | - public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
317 | + public function searchMessages(array $where, $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") { |
|
318 | 318 | $this->getClient()->checkConnection(); |
319 | 319 | |
320 | 320 | return $this->query($charset)->where($where)->setFetchOptions($fetch_options)->setFetchBody($fetch_body) |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function delete($expunge = true) { |
375 | 375 | $status = imap_deletemailbox($this->client->getConnection(), $this->path); |
376 | - if($expunge) $this->client->expunge(); |
|
376 | + if ($expunge) $this->client->expunge(); |
|
377 | 377 | |
378 | 378 | return $status; |
379 | 379 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | */ |
391 | 391 | public function move($target_mailbox, $expunge = true) { |
392 | 392 | $status = imap_renamemailbox($this->client->getConnection(), $this->path, $target_mailbox); |
393 | - if($expunge) $this->client->expunge(); |
|
393 | + if ($expunge) $this->client->expunge(); |
|
394 | 394 | |
395 | 395 | return $status; |
396 | 396 | } |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | /** |
440 | 440 | * @param $delimiter |
441 | 441 | */ |
442 | - public function setDelimiter($delimiter){ |
|
443 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
442 | + public function setDelimiter($delimiter) { |
|
443 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
444 | 444 | $delimiter = config('imap.options.delimiter', '/'); |
445 | 445 | } |
446 | 446 |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $this->part_number = ($part_number) ? $part_number : $this->part_number; |
94 | 94 | |
95 | 95 | $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask(); |
96 | - if($default_mask != null) { |
|
96 | + if ($default_mask != null) { |
|
97 | 97 | $this->mask = $default_mask; |
98 | 98 | } |
99 | 99 | |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * @throws MethodNotFoundException |
111 | 111 | */ |
112 | 112 | public function __call($method, $arguments) { |
113 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
113 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
114 | 114 | $name = snake_case(substr($method, 3)); |
115 | 115 | |
116 | - if(isset($this->attributes[$name])) { |
|
116 | + if (isset($this->attributes[$name])) { |
|
117 | 117 | return $this->attributes[$name]; |
118 | 118 | } |
119 | 119 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return mixed|null |
148 | 148 | */ |
149 | 149 | public function __get($name) { |
150 | - if(isset($this->attributes[$name])) { |
|
150 | + if (isset($this->attributes[$name])) { |
|
151 | 151 | return $this->attributes[$name]; |
152 | 152 | } |
153 | 153 | |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | * @param $name |
256 | 256 | */ |
257 | 257 | public function setName($name) { |
258 | - if($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
258 | + if ($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
259 | 259 | $this->name = imap_utf8($name); |
260 | - }else{ |
|
260 | + } else { |
|
261 | 261 | $this->name = mb_decode_mimeheader($name); |
262 | 262 | } |
263 | 263 | } |
@@ -277,28 +277,28 @@ discard block |
||
277 | 277 | /** |
278 | 278 | * @return string|null |
279 | 279 | */ |
280 | - public function getMimeType(){ |
|
280 | + public function getMimeType() { |
|
281 | 281 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
285 | 285 | * @return string|null |
286 | 286 | */ |
287 | - public function getExtension(){ |
|
287 | + public function getExtension() { |
|
288 | 288 | return ExtensionGuesser::getInstance()->guess($this->getMimeType()); |
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | 292 | * @return array |
293 | 293 | */ |
294 | - public function getAttributes(){ |
|
294 | + public function getAttributes() { |
|
295 | 295 | return $this->attributes; |
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
299 | 299 | * @return Message |
300 | 300 | */ |
301 | - public function getMessage(){ |
|
301 | + public function getMessage() { |
|
302 | 302 | return $this->oMessage; |
303 | 303 | } |
304 | 304 | |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | * @param $mask |
307 | 307 | * @return $this |
308 | 308 | */ |
309 | - public function setMask($mask){ |
|
310 | - if(class_exists($mask)){ |
|
309 | + public function setMask($mask) { |
|
310 | + if (class_exists($mask)) { |
|
311 | 311 | $this->mask = $mask; |
312 | 312 | } |
313 | 313 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | /** |
318 | 318 | * @return string |
319 | 319 | */ |
320 | - public function getMask(){ |
|
320 | + public function getMask() { |
|
321 | 321 | return $this->mask; |
322 | 322 | } |
323 | 323 | |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | * @return mixed |
329 | 329 | * @throws MaskNotFoundException |
330 | 330 | */ |
331 | - public function mask($mask = null){ |
|
331 | + public function mask($mask = null) { |
|
332 | 332 | $mask = $mask !== null ? $mask : $this->mask; |
333 | - if(class_exists($mask)){ |
|
333 | + if (class_exists($mask)) { |
|
334 | 334 | return new $mask($this); |
335 | 335 | } |
336 | 336 |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | return null; |
121 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
121 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
122 | 122 | $name = snake_case(substr($method, 3)); |
123 | 123 | |
124 | 124 | $this->attributes[$name] = array_pop($arguments); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | public function setName($name) { |
258 | 258 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
259 | 259 | $this->name = imap_utf8($name); |
260 | - }else{ |
|
260 | + } else{ |
|
261 | 261 | $this->name = mb_decode_mimeheader($name); |
262 | 262 | } |
263 | 263 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | * |
48 | 48 | * @return Attachment |
49 | 49 | */ |
50 | - public function getAttachment(){ |
|
50 | + public function getAttachment() { |
|
51 | 51 | return $this->parent; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function __construct($parent) { |
39 | 39 | $this->parent = $parent; |
40 | 40 | |
41 | - if(method_exists($this->parent, 'getAttributes')){ |
|
41 | + if (method_exists($this->parent, 'getAttributes')) { |
|
42 | 42 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes()); |
43 | 43 | } |
44 | 44 | } |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | * @throws MethodNotFoundException |
54 | 54 | */ |
55 | 55 | public function __call($method, $arguments) { |
56 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
56 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
57 | 57 | $name = snake_case(substr($method, 3)); |
58 | 58 | |
59 | - if(isset($this->attributes[$name])) { |
|
59 | + if (isset($this->attributes[$name])) { |
|
60 | 60 | return $this->attributes[$name]; |
61 | 61 | } |
62 | 62 | |
63 | 63 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
64 | 64 | $name = snake_case(substr($method, 3)); |
65 | 65 | |
66 | - if(isset($this->attributes[$name])) { |
|
66 | + if (isset($this->attributes[$name])) { |
|
67 | 67 | $this->attributes[$name] = array_pop($arguments); |
68 | 68 | |
69 | 69 | return $this->attributes[$name]; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | } |
73 | 73 | |
74 | - if(method_exists($this->parent, $method) === true){ |
|
74 | + if (method_exists($this->parent, $method) === true) { |
|
75 | 75 | return call_user_func_array([$this->parent, $method], $arguments); |
76 | 76 | } |
77 | 77 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return mixed|null |
97 | 97 | */ |
98 | 98 | public function __get($name) { |
99 | - if(isset($this->attributes[$name])) { |
|
99 | + if (isset($this->attributes[$name])) { |
|
100 | 100 | return $this->attributes[$name]; |
101 | 101 | } |
102 | 102 | |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * @return mixed |
108 | 108 | */ |
109 | - public function getParent(){ |
|
109 | + public function getParent() { |
|
110 | 110 | return $this->parent; |
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public function getAttributes(){ |
|
116 | + public function getAttributes() { |
|
117 | 117 | return $this->attributes; |
118 | 118 | } |
119 | 119 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | return $this->attributes[$name]; |
61 | 61 | } |
62 | 62 | |
63 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
63 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
64 | 64 | $name = snake_case(substr($method, 3)); |
65 | 65 | |
66 | 66 | if(isset($this->attributes[$name])) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * Get the message html body |
30 | 30 | * @return null |
31 | 31 | */ |
32 | - public function getHtmlBody(){ |
|
32 | + public function getHtmlBody() { |
|
33 | 33 | $bodies = $this->parent->getBodies(); |
34 | 34 | if (!isset($bodies['html'])) { |
35 | 35 | return null; |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function getCustomHTMLBody($callback = false) { |
47 | 47 | $body = $this->getHtmlBody(); |
48 | - if($body === null) return null; |
|
48 | + if ($body === null) return null; |
|
49 | 49 | |
50 | 50 | if ($callback !== false) { |
51 | 51 | $aAttachment = $this->parent->getAttachments(); |
52 | 52 | $aAttachment->each(function($oAttachment) use(&$body, $callback) { |
53 | 53 | /** @var Attachment $oAttachment */ |
54 | - if(is_callable($callback)) { |
|
54 | + if (is_callable($callback)) { |
|
55 | 55 | $body = $callback($body, $oAttachment); |
56 | - }elseif(is_string($callback)) { |
|
56 | + }elseif (is_string($callback)) { |
|
57 | 57 | call_user_func($callback, [$body, $oAttachment]); |
58 | 58 | } |
59 | 59 | }); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return string|null |
70 | 70 | */ |
71 | 71 | public function getHTMLBodyWithEmbeddedBase64Images() { |
72 | - return $this->getCustomHTMLBody(function($body, $oAttachment){ |
|
72 | + return $this->getCustomHTMLBody(function($body, $oAttachment) { |
|
73 | 73 | /** @var \Webklex\IMAP\Attachment $oAttachment */ |
74 | 74 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
75 | 75 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return Message |
115 | 115 | */ |
116 | - public function getMessage(){ |
|
116 | + public function getMessage() { |
|
117 | 117 | return $this->parent; |
118 | 118 | } |
119 | 119 |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function getCustomHTMLBody($callback = false) { |
47 | 47 | $body = $this->getHtmlBody(); |
48 | - if($body === null) return null; |
|
48 | + if($body === null) { |
|
49 | + return null; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | if ($callback !== false) { |
51 | 53 | $aAttachment = $this->parent->getAttachments(); |
@@ -53,7 +55,7 @@ discard block |
||
53 | 55 | /** @var Attachment $oAttachment */ |
54 | 56 | if(is_callable($callback)) { |
55 | 57 | $body = $callback($body, $oAttachment); |
56 | - }elseif(is_string($callback)) { |
|
58 | + } elseif(is_string($callback)) { |
|
57 | 59 | call_user_func($callback, [$body, $oAttachment]); |
58 | 60 | } |
59 | 61 | }); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function __construct(Client $client, $charset = 'UTF-8') { |
66 | 66 | $this->setClient($client); |
67 | 67 | |
68 | - if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
68 | + if (config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
69 | 69 | |
70 | 70 | $this->charset = $charset; |
71 | 71 | $this->query = collect(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * Instance boot method for additional functionality |
77 | 77 | */ |
78 | - protected function boot(){} |
|
78 | + protected function boot() {} |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Parse a given value |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - protected function parse_value($value){ |
|
87 | - switch(true){ |
|
86 | + protected function parse_value($value) { |
|
87 | + switch (true) { |
|
88 | 88 | case $value instanceof \Carbon\Carbon: |
89 | 89 | $value = $value->format('d M y'); |
90 | 90 | break; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @throws MessageSearchValidationException |
102 | 102 | */ |
103 | 103 | protected function parse_date($date) { |
104 | - if($date instanceof \Carbon\Carbon) return $date; |
|
104 | + if ($date instanceof \Carbon\Carbon) return $date; |
|
105 | 105 | |
106 | 106 | try { |
107 | 107 | $date = Carbon::parse($date); |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * Don't set the charset if it isn't used - prevent strange outlook mail server errors |
151 | 151 | * @see https://github.com/Webklex/laravel-imap/issues/100 |
152 | 152 | */ |
153 | - if($this->getCharset() === null){ |
|
153 | + if ($this->getCharset() === null) { |
|
154 | 154 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID); |
155 | - }else{ |
|
155 | + } else { |
|
156 | 156 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset()); |
157 | 157 | } |
158 | 158 | |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | $available_messages = collect($available_messages); |
162 | 162 | $options = config('imap.options'); |
163 | 163 | |
164 | - if(strtolower($options['fetch_order']) === 'desc'){ |
|
164 | + if (strtolower($options['fetch_order']) === 'desc') { |
|
165 | 165 | $available_messages = $available_messages->reverse(); |
166 | 166 | } |
167 | 167 | |
168 | 168 | $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options) { |
169 | 169 | $oMessage = new Message($msgno, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchAttachment(), $this->getFetchFlags()); |
170 | - switch ($options['message_key']){ |
|
170 | + switch ($options['message_key']) { |
|
171 | 171 | case 'number': |
172 | 172 | $message_key = $oMessage->getMessageNo(); |
173 | 173 | break; |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | if (count($statement) == 1) { |
203 | 203 | $query .= $statement[0]; |
204 | 204 | } else { |
205 | - if($statement[1] === null){ |
|
205 | + if ($statement[1] === null) { |
|
206 | 206 | $query .= $statement[0]; |
207 | - }else{ |
|
207 | + } else { |
|
208 | 208 | $query .= $statement[0].' "'.$statement[1].'"'; |
209 | 209 | } |
210 | 210 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @return $this |
235 | 235 | */ |
236 | 236 | public function limit($limit, $page = 1) { |
237 | - if($page >= 1) $this->page = $page; |
|
237 | + if ($page >= 1) $this->page = $page; |
|
238 | 238 | $this->limit = $limit; |
239 | 239 | |
240 | 240 | return $this; |
@@ -65,7 +65,9 @@ discard block |
||
65 | 65 | public function __construct(Client $client, $charset = 'UTF-8') { |
66 | 66 | $this->setClient($client); |
67 | 67 | |
68 | - if(config('imap.options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
68 | + if(config('imap.options.fetch') === IMAP::FT_PEEK) { |
|
69 | + $this->leaveUnread(); |
|
70 | + } |
|
69 | 71 | |
70 | 72 | $this->charset = $charset; |
71 | 73 | $this->query = collect(); |
@@ -101,7 +103,9 @@ discard block |
||
101 | 103 | * @throws MessageSearchValidationException |
102 | 104 | */ |
103 | 105 | protected function parse_date($date) { |
104 | - if($date instanceof \Carbon\Carbon) return $date; |
|
106 | + if($date instanceof \Carbon\Carbon) { |
|
107 | + return $date; |
|
108 | + } |
|
105 | 109 | |
106 | 110 | try { |
107 | 111 | $date = Carbon::parse($date); |
@@ -152,7 +156,7 @@ discard block |
||
152 | 156 | */ |
153 | 157 | if($this->getCharset() === null){ |
154 | 158 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID); |
155 | - }else{ |
|
159 | + } else{ |
|
156 | 160 | $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset()); |
157 | 161 | } |
158 | 162 | |
@@ -204,7 +208,7 @@ discard block |
||
204 | 208 | } else { |
205 | 209 | if($statement[1] === null){ |
206 | 210 | $query .= $statement[0]; |
207 | - }else{ |
|
211 | + } else{ |
|
208 | 212 | $query .= $statement[0].' "'.$statement[1].'"'; |
209 | 213 | } |
210 | 214 | } |
@@ -234,7 +238,9 @@ discard block |
||
234 | 238 | * @return $this |
235 | 239 | */ |
236 | 240 | public function limit($limit, $page = 1) { |
237 | - if($page >= 1) $this->page = $page; |
|
241 | + if($page >= 1) { |
|
242 | + $this->page = $page; |
|
243 | + } |
|
238 | 244 | $this->limit = $limit; |
239 | 245 | |
240 | 246 | return $this; |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | |
76 | 76 | $name = camel_case($name); |
77 | 77 | |
78 | - if(strtolower(substr($name, 0, 3)) === 'not') { |
|
78 | + if (strtolower(substr($name, 0, 3)) === 'not') { |
|
79 | 79 | $that = $that->whereNot(); |
80 | 80 | $name = substr($name, 3); |
81 | 81 | } |
82 | 82 | |
83 | 83 | $method = 'where'.ucfirst($name); |
84 | - if(method_exists($this, $method) === true){ |
|
84 | + if (method_exists($this, $method) === true) { |
|
85 | 85 | return call_user_func_array([$that, $method], $arguments); |
86 | 86 | } |
87 | 87 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | protected function validate_criteria($criteria) { |
99 | 99 | $criteria = strtoupper($criteria); |
100 | 100 | |
101 | - if(in_array($criteria, $this->available_criteria) === false) { |
|
101 | + if (in_array($criteria, $this->available_criteria) === false) { |
|
102 | 102 | throw new InvalidWhereQueryCriteriaException(); |
103 | 103 | } |
104 | 104 | |
@@ -113,21 +113,21 @@ discard block |
||
113 | 113 | * @throws InvalidWhereQueryCriteriaException |
114 | 114 | */ |
115 | 115 | public function where($criteria, $value = null) { |
116 | - if(is_array($criteria)){ |
|
117 | - foreach($criteria as $arguments){ |
|
118 | - if(count($arguments) == 1){ |
|
116 | + if (is_array($criteria)) { |
|
117 | + foreach ($criteria as $arguments) { |
|
118 | + if (count($arguments) == 1) { |
|
119 | 119 | $this->where($arguments[0]); |
120 | - }elseif(count($arguments) == 2){ |
|
120 | + }elseif (count($arguments) == 2) { |
|
121 | 121 | $this->where($arguments[0], $arguments[1]); |
122 | 122 | } |
123 | 123 | } |
124 | - }else{ |
|
124 | + } else { |
|
125 | 125 | $criteria = $this->validate_criteria($criteria); |
126 | 126 | $value = $this->parse_value($value); |
127 | 127 | |
128 | - if($value === null || $value === ''){ |
|
128 | + if ($value === null || $value === '') { |
|
129 | 129 | $this->query->push([$criteria]); |
130 | - }else{ |
|
130 | + } else { |
|
131 | 131 | $this->query->push([$criteria, $value]); |
132 | 132 | } |
133 | 133 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function orWhere(\Closure $closure = null) { |
144 | 144 | $this->query->push(['OR']); |
145 | - if($closure !== null) $closure($this); |
|
145 | + if ($closure !== null) $closure($this); |
|
146 | 146 | |
147 | 147 | return $this; |
148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function andWhere(\Closure $closure = null) { |
156 | 156 | $this->query->push(['AND']); |
157 | - if($closure !== null) $closure($this); |
|
157 | + if ($closure !== null) $closure($this); |
|
158 | 158 | |
159 | 159 | return $this; |
160 | 160 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @return WhereQuery |
405 | 405 | * @throws InvalidWhereQueryCriteriaException |
406 | 406 | */ |
407 | - public function whereNoXSpam(){ |
|
407 | + public function whereNoXSpam() { |
|
408 | 408 | return $this->where("X-Spam-Flag NO"); |
409 | 409 | } |
410 | 410 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return WhereQuery |
413 | 413 | * @throws InvalidWhereQueryCriteriaException |
414 | 414 | */ |
415 | - public function whereIsXSpam(){ |
|
415 | + public function whereIsXSpam() { |
|
416 | 416 | return $this->where("X-Spam-Flag YES"); |
417 | 417 | } |
418 | 418 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @return WhereQuery |
423 | 423 | * @throws InvalidWhereQueryCriteriaException |
424 | 424 | */ |
425 | - public function whereLanguage($country_code){ |
|
425 | + public function whereLanguage($country_code) { |
|
426 | 426 | return $this->where("Content-Language $country_code"); |
427 | 427 | } |
428 | 428 | } |
429 | 429 | \ No newline at end of file |
@@ -172,45 +172,45 @@ discard block |
||
172 | 172 | * @throws MaskNotFoundException |
173 | 173 | */ |
174 | 174 | protected function setMaskFromConfig($config) { |
175 | - $default_config = config("imap.masks"); |
|
175 | + $default_config = config("imap.masks"); |
|
176 | 176 | |
177 | - if(isset($config['masks'])){ |
|
178 | - if(isset($config['masks']['message'])) { |
|
179 | - if(class_exists($config['masks']['message'])) { |
|
177 | + if (isset($config['masks'])) { |
|
178 | + if (isset($config['masks']['message'])) { |
|
179 | + if (class_exists($config['masks']['message'])) { |
|
180 | 180 | $this->default_message_mask = $config['masks']['message']; |
181 | - }else{ |
|
181 | + } else { |
|
182 | 182 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
183 | 183 | } |
184 | - }else{ |
|
185 | - if(class_exists($default_config['message'])) { |
|
184 | + } else { |
|
185 | + if (class_exists($default_config['message'])) { |
|
186 | 186 | $this->default_message_mask = $default_config['message']; |
187 | - }else{ |
|
187 | + } else { |
|
188 | 188 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
189 | 189 | } |
190 | 190 | } |
191 | - if(isset($config['masks']['attachment'])) { |
|
192 | - if(class_exists($config['masks']['attachment'])) { |
|
191 | + if (isset($config['masks']['attachment'])) { |
|
192 | + if (class_exists($config['masks']['attachment'])) { |
|
193 | 193 | $this->default_message_mask = $config['masks']['attachment']; |
194 | - }else{ |
|
194 | + } else { |
|
195 | 195 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
196 | 196 | } |
197 | - }else{ |
|
198 | - if(class_exists($default_config['attachment'])) { |
|
197 | + } else { |
|
198 | + if (class_exists($default_config['attachment'])) { |
|
199 | 199 | $this->default_message_mask = $default_config['attachment']; |
200 | - }else{ |
|
200 | + } else { |
|
201 | 201 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
202 | 202 | } |
203 | 203 | } |
204 | - }else{ |
|
205 | - if(class_exists($default_config['message'])) { |
|
204 | + } else { |
|
205 | + if (class_exists($default_config['message'])) { |
|
206 | 206 | $this->default_message_mask = $default_config['message']; |
207 | - }else{ |
|
207 | + } else { |
|
208 | 208 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
209 | 209 | } |
210 | 210 | |
211 | - if(class_exists($default_config['attachment'])) { |
|
211 | + if (class_exists($default_config['attachment'])) { |
|
212 | 212 | $this->default_message_mask = $default_config['attachment']; |
213 | - }else{ |
|
213 | + } else { |
|
214 | 214 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
215 | 215 | } |
216 | 216 | } |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function createFolder($name, $expunge = true) { |
402 | 402 | $this->checkConnection(); |
403 | - $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
|
404 | - if($expunge) $this->expunge(); |
|
403 | + $status = imap_createmailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name)); |
|
404 | + if ($expunge) $this->expunge(); |
|
405 | 405 | |
406 | 406 | return $status; |
407 | 407 | } |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function renameFolder($old_name, $new_name, $expunge = true) { |
419 | 419 | $this->checkConnection(); |
420 | - $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
|
421 | - if($expunge) $this->expunge(); |
|
420 | + $status = imap_renamemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($old_name), $this->getAddress().imap_utf7_encode($new_name)); |
|
421 | + if ($expunge) $this->expunge(); |
|
422 | 422 | |
423 | 423 | return $status; |
424 | 424 | } |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function deleteFolder($name, $expunge = true) { |
435 | 435 | $this->checkConnection(); |
436 | - $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
|
437 | - if($expunge) $this->expunge(); |
|
436 | + $status = imap_deletemailbox($this->getConnection(), $this->getAddress().imap_utf7_encode($name)); |
|
437 | + if ($expunge) $this->expunge(); |
|
438 | 438 | |
439 | 439 | return $status; |
440 | 440 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | if (!$this->validate_cert) { |
529 | 529 | $address .= '/novalidate-cert'; |
530 | 530 | } |
531 | - if (in_array($this->encryption,['tls','ssl'])) { |
|
531 | + if (in_array($this->encryption, ['tls', 'ssl'])) { |
|
532 | 532 | $address .= '/'.$this->encryption; |
533 | 533 | } |
534 | 534 | $address .= '}'; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * @throws InvalidImapTimeoutTypeException |
649 | 649 | */ |
650 | 650 | public function setTimeout($type, $timeout) { |
651 | - if(0 <= $type && $type <= 4) { |
|
651 | + if (0 <= $type && $type <= 4) { |
|
652 | 652 | return imap_timeout($type, $timeout); |
653 | 653 | } |
654 | 654 | |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | * @return mixed |
663 | 663 | * @throws InvalidImapTimeoutTypeException |
664 | 664 | */ |
665 | - public function getTimeout($type){ |
|
666 | - if(0 <= $type && $type <= 4) { |
|
665 | + public function getTimeout($type) { |
|
666 | + if (0 <= $type && $type <= 4) { |
|
667 | 667 | return imap_timeout($type); |
668 | 668 | } |
669 | 669 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | /** |
674 | 674 | * @return string |
675 | 675 | */ |
676 | - public function getDefaultMessageMask(){ |
|
676 | + public function getDefaultMessageMask() { |
|
677 | 677 | return $this->default_message_mask; |
678 | 678 | } |
679 | 679 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * @throws MaskNotFoundException |
685 | 685 | */ |
686 | 686 | public function setDefaultMessageMask($mask) { |
687 | - if(class_exists($mask)) { |
|
687 | + if (class_exists($mask)) { |
|
688 | 688 | $this->default_message_mask = $mask; |
689 | 689 | |
690 | 690 | return $this; |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | /** |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public function getDefaultAttachmentMask(){ |
|
699 | + public function getDefaultAttachmentMask() { |
|
700 | 700 | return $this->default_attachment_mask; |
701 | 701 | } |
702 | 702 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * @throws MaskNotFoundException |
708 | 708 | */ |
709 | 709 | public function setDefaultAttachmentMask($mask) { |
710 | - if(class_exists($mask)) { |
|
710 | + if (class_exists($mask)) { |
|
711 | 711 | $this->default_attachment_mask = $mask; |
712 | 712 | |
713 | 713 | return $this; |
@@ -178,39 +178,39 @@ discard block |
||
178 | 178 | if(isset($config['masks']['message'])) { |
179 | 179 | if(class_exists($config['masks']['message'])) { |
180 | 180 | $this->default_message_mask = $config['masks']['message']; |
181 | - }else{ |
|
181 | + } else{ |
|
182 | 182 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
183 | 183 | } |
184 | - }else{ |
|
184 | + } else{ |
|
185 | 185 | if(class_exists($default_config['message'])) { |
186 | 186 | $this->default_message_mask = $default_config['message']; |
187 | - }else{ |
|
187 | + } else{ |
|
188 | 188 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
189 | 189 | } |
190 | 190 | } |
191 | 191 | if(isset($config['masks']['attachment'])) { |
192 | 192 | if(class_exists($config['masks']['attachment'])) { |
193 | 193 | $this->default_message_mask = $config['masks']['attachment']; |
194 | - }else{ |
|
194 | + } else{ |
|
195 | 195 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
196 | 196 | } |
197 | - }else{ |
|
197 | + } else{ |
|
198 | 198 | if(class_exists($default_config['attachment'])) { |
199 | 199 | $this->default_message_mask = $default_config['attachment']; |
200 | - }else{ |
|
200 | + } else{ |
|
201 | 201 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
202 | 202 | } |
203 | 203 | } |
204 | - }else{ |
|
204 | + } else{ |
|
205 | 205 | if(class_exists($default_config['message'])) { |
206 | 206 | $this->default_message_mask = $default_config['message']; |
207 | - }else{ |
|
207 | + } else{ |
|
208 | 208 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
209 | 209 | } |
210 | 210 | |
211 | 211 | if(class_exists($default_config['attachment'])) { |
212 | 212 | $this->default_message_mask = $default_config['attachment']; |
213 | - }else{ |
|
213 | + } else{ |
|
214 | 214 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
215 | 215 | } |
216 | 216 | } |
@@ -401,7 +401,9 @@ discard block |
||
401 | 401 | public function createFolder($name, $expunge = true) { |
402 | 402 | $this->checkConnection(); |
403 | 403 | $status = imap_createmailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
404 | - if($expunge) $this->expunge(); |
|
404 | + if($expunge) { |
|
405 | + $this->expunge(); |
|
406 | + } |
|
405 | 407 | |
406 | 408 | return $status; |
407 | 409 | } |
@@ -418,7 +420,9 @@ discard block |
||
418 | 420 | public function renameFolder($old_name, $new_name, $expunge = true) { |
419 | 421 | $this->checkConnection(); |
420 | 422 | $status = imap_renamemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); |
421 | - if($expunge) $this->expunge(); |
|
423 | + if($expunge) { |
|
424 | + $this->expunge(); |
|
425 | + } |
|
422 | 426 | |
423 | 427 | return $status; |
424 | 428 | } |
@@ -434,7 +438,9 @@ discard block |
||
434 | 438 | public function deleteFolder($name, $expunge = true) { |
435 | 439 | $this->checkConnection(); |
436 | 440 | $status = imap_deletemailbox($this->getConnection(), $this->getAddress() . imap_utf7_encode($name)); |
437 | - if($expunge) $this->expunge(); |
|
441 | + if($expunge) { |
|
442 | + $this->expunge(); |
|
443 | + } |
|
438 | 444 | |
439 | 445 | return $status; |
440 | 446 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = false) { |
190 | 190 | |
191 | 191 | $default_mask = $client->getDefaultMessageMask(); |
192 | - if($default_mask != null) { |
|
192 | + if ($default_mask != null) { |
|
193 | 193 | $this->mask = $default_mask; |
194 | 194 | } |
195 | 195 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $this->msglist = $msglist; |
207 | 207 | $this->client = $client; |
208 | 208 | |
209 | - $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid; |
|
209 | + $this->uid = ($this->fetch_options == IMAP::FT_UID) ? $uid : $uid; |
|
210 | 210 | $this->msgn = ($this->fetch_options == IMAP::FT_UID) ? imap_msgno($this->client->getConnection(), $uid) : $uid; |
211 | 211 | |
212 | 212 | $this->parseHeader(); |
@@ -229,17 +229,17 @@ discard block |
||
229 | 229 | * @throws MethodNotFoundException |
230 | 230 | */ |
231 | 231 | public function __call($method, $arguments) { |
232 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
232 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
233 | 233 | $name = snake_case(substr($method, 3)); |
234 | 234 | |
235 | - if(isset($this->attributes[$name])) { |
|
235 | + if (isset($this->attributes[$name])) { |
|
236 | 236 | return $this->attributes[$name]; |
237 | 237 | } |
238 | 238 | |
239 | 239 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
240 | 240 | $name = snake_case(substr($method, 3)); |
241 | 241 | |
242 | - if(isset($this->attributes[$name])) { |
|
242 | + if (isset($this->attributes[$name])) { |
|
243 | 243 | $this->attributes[$name] = array_pop($arguments); |
244 | 244 | |
245 | 245 | return $this->attributes[$name]; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @return mixed|null |
269 | 269 | */ |
270 | 270 | public function __get($name) { |
271 | - if(isset($this->attributes[$name])) { |
|
271 | + if (isset($this->attributes[$name])) { |
|
272 | 272 | return $this->attributes[$name]; |
273 | 273 | } |
274 | 274 | |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | if ($replaceImages !== false) { |
353 | 353 | $this->attachments->each(function($oAttachment) use(&$body, $replaceImages) { |
354 | 354 | /** @var Attachment $oAttachment */ |
355 | - if(is_callable($replaceImages)) { |
|
355 | + if (is_callable($replaceImages)) { |
|
356 | 356 | $body = $replaceImages($body, $oAttachment); |
357 | - }elseif(is_string($replaceImages)) { |
|
357 | + }elseif (is_string($replaceImages)) { |
|
358 | 358 | call_user_func($replaceImages, [$body, $oAttachment]); |
359 | - }else{ |
|
359 | + } else { |
|
360 | 360 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
361 | 361 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
362 | 362 | } |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | } |
385 | 385 | |
386 | 386 | if (property_exists($header, 'subject')) { |
387 | - if($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
387 | + if ($this->config['decoder']['message']['subject'] === 'utf-8') { |
|
388 | 388 | $this->subject = imap_utf8($header->subject); |
389 | - }else{ |
|
389 | + } else { |
|
390 | 390 | $this->subject = mb_decode_mimeheader($header->subject); |
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | - foreach(['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part){ |
|
394 | + foreach (['from', 'to', 'cc', 'bcc', 'reply_to', 'sender'] as $part) { |
|
395 | 395 | $this->extractHeaderAddressPart($header, $part); |
396 | 396 | } |
397 | 397 | |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | * @return int|null |
422 | 422 | */ |
423 | 423 | private function extractPriority($header) { |
424 | - if(preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)){ |
|
424 | + if (preg_match('/x\-priority\:.*([0-9]{1,2})/i', $header, $priority)) { |
|
425 | 425 | $priority = isset($priority[1]) ? (int) $priority[1] : 0; |
426 | - switch($priority){ |
|
426 | + switch ($priority) { |
|
427 | 427 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
428 | 428 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
429 | 429 | break; |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | if (property_exists($header, 'date')) { |
475 | 475 | $date = $header->date; |
476 | 476 | |
477 | - if(preg_match('/\+0580/', $date)) { |
|
477 | + if (preg_match('/\+0580/', $date)) { |
|
478 | 478 | $date = str_replace('+0580', '+0530', $date); |
479 | 479 | } |
480 | 480 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | $date .= 'C'; |
496 | 496 | break; |
497 | 497 | } |
498 | - try{ |
|
498 | + try { |
|
499 | 499 | $parsed_date = Carbon::parse($date); |
500 | 500 | } catch (\Exception $_e) { |
501 | 501 | throw new InvalidMessageDateException("Invalid message date. ID:".$this->getMessageId(), 1000, $e); |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | |
518 | 518 | $flags = imap_fetch_overview($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
519 | 519 | if (is_array($flags) && isset($flags[0])) { |
520 | - foreach($this->available_flags as $flag) { |
|
520 | + foreach ($this->available_flags as $flag) { |
|
521 | 521 | $this->parseFlag($flags, $flag); |
522 | 522 | } |
523 | 523 | } |
@@ -614,12 +614,12 @@ discard block |
||
614 | 614 | public function parseBody() { |
615 | 615 | $this->structure = imap_fetchstructure($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
616 | 616 | |
617 | - if(property_exists($this->structure, 'parts')){ |
|
617 | + if (property_exists($this->structure, 'parts')) { |
|
618 | 618 | $parts = $this->structure->parts; |
619 | 619 | |
620 | - foreach ($parts as $part) { |
|
621 | - foreach ($part->parameters as $parameter) { |
|
622 | - if($parameter->attribute == "charset") { |
|
620 | + foreach ($parts as $part) { |
|
621 | + foreach ($part->parameters as $parameter) { |
|
622 | + if ($parameter->attribute == "charset") { |
|
623 | 623 | $encoding = $parameter->value; |
624 | 624 | |
625 | 625 | $encoding = preg_replace('/Content-Transfer-Encoding/', '', $encoding); |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | return EncodingAliases::get($parameter->value); |
891 | 891 | } |
892 | 892 | } |
893 | - }elseif (is_string($structure) === true){ |
|
893 | + }elseif (is_string($structure) === true) { |
|
894 | 894 | return mb_detect_encoding($structure); |
895 | 895 | } |
896 | 896 | |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | */ |
963 | 963 | public function delete($expunge = true) { |
964 | 964 | $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
965 | - if($expunge) $this->client->expunge(); |
|
965 | + if ($expunge) $this->client->expunge(); |
|
966 | 966 | |
967 | 967 | return $status; |
968 | 968 | } |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | */ |
977 | 977 | public function restore($expunge = true) { |
978 | 978 | $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
979 | - if($expunge) $this->client->expunge(); |
|
979 | + if ($expunge) $this->client->expunge(); |
|
980 | 980 | |
981 | 981 | return $status; |
982 | 982 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | /** |
1101 | 1101 | * @return object|null |
1102 | 1102 | */ |
1103 | - public function getStructure(){ |
|
1103 | + public function getStructure() { |
|
1104 | 1104 | return $this->structure; |
1105 | 1105 | } |
1106 | 1106 | |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | /** |
1127 | 1127 | * @return array |
1128 | 1128 | */ |
1129 | - public function getAttributes(){ |
|
1129 | + public function getAttributes() { |
|
1130 | 1130 | return $this->attributes; |
1131 | 1131 | } |
1132 | 1132 | |
@@ -1134,8 +1134,8 @@ discard block |
||
1134 | 1134 | * @param $mask |
1135 | 1135 | * @return $this |
1136 | 1136 | */ |
1137 | - public function setMask($mask){ |
|
1138 | - if(class_exists($mask)){ |
|
1137 | + public function setMask($mask) { |
|
1138 | + if (class_exists($mask)) { |
|
1139 | 1139 | $this->mask = $mask; |
1140 | 1140 | } |
1141 | 1141 | |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | /** |
1146 | 1146 | * @return string |
1147 | 1147 | */ |
1148 | - public function getMask(){ |
|
1148 | + public function getMask() { |
|
1149 | 1149 | return $this->mask; |
1150 | 1150 | } |
1151 | 1151 | |
@@ -1156,9 +1156,9 @@ discard block |
||
1156 | 1156 | * @return mixed |
1157 | 1157 | * @throws MaskNotFoundException |
1158 | 1158 | */ |
1159 | - public function mask($mask = null){ |
|
1159 | + public function mask($mask = null) { |
|
1160 | 1160 | $mask = $mask !== null ? $mask : $this->mask; |
1161 | - if(class_exists($mask)){ |
|
1161 | + if (class_exists($mask)) { |
|
1162 | 1162 | return new $mask($this); |
1163 | 1163 | } |
1164 | 1164 |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | return $this->attributes[$name]; |
237 | 237 | } |
238 | 238 | |
239 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
239 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
240 | 240 | $name = snake_case(substr($method, 3)); |
241 | 241 | |
242 | 242 | if(isset($this->attributes[$name])) { |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | /** @var Attachment $oAttachment */ |
355 | 355 | if(is_callable($replaceImages)) { |
356 | 356 | $body = $replaceImages($body, $oAttachment); |
357 | - }elseif(is_string($replaceImages)) { |
|
357 | + } elseif(is_string($replaceImages)) { |
|
358 | 358 | call_user_func($replaceImages, [$body, $oAttachment]); |
359 | - }else{ |
|
359 | + } else{ |
|
360 | 360 | if ($oAttachment->id && $oAttachment->getImgSrc() != null) { |
361 | 361 | $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body); |
362 | 362 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | if (property_exists($header, 'subject')) { |
387 | 387 | if($this->config['decoder']['message']['subject'] === 'utf-8') { |
388 | 388 | $this->subject = imap_utf8($header->subject); |
389 | - }else{ |
|
389 | + } else{ |
|
390 | 390 | $this->subject = mb_decode_mimeheader($header->subject); |
391 | 391 | } |
392 | 392 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | return EncodingAliases::get($parameter->value); |
891 | 891 | } |
892 | 892 | } |
893 | - }elseif (is_string($structure) === true){ |
|
893 | + } elseif (is_string($structure) === true){ |
|
894 | 894 | return mb_detect_encoding($structure); |
895 | 895 | } |
896 | 896 | |
@@ -962,7 +962,9 @@ discard block |
||
962 | 962 | */ |
963 | 963 | public function delete($expunge = true) { |
964 | 964 | $status = imap_delete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
965 | - if($expunge) $this->client->expunge(); |
|
965 | + if($expunge) { |
|
966 | + $this->client->expunge(); |
|
967 | + } |
|
966 | 968 | |
967 | 969 | return $status; |
968 | 970 | } |
@@ -976,7 +978,9 @@ discard block |
||
976 | 978 | */ |
977 | 979 | public function restore($expunge = true) { |
978 | 980 | $status = imap_undelete($this->client->getConnection(), $this->uid, IMAP::FT_UID); |
979 | - if($expunge) $this->client->expunge(); |
|
981 | + if($expunge) { |
|
982 | + $this->client->expunge(); |
|
983 | + } |
|
980 | 984 | |
981 | 985 | return $status; |
982 | 986 | } |