@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | if (strpos(strtolower($name), "where") === false){ |
85 | 85 | $method = 'where'.ucfirst($name); |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | $method = lcfirst($name); |
88 | 88 | } |
89 | 89 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | } |
129 | 129 | return $this->where($key, $value); |
130 | 130 | } |
131 | - }else{ |
|
131 | + } else{ |
|
132 | 132 | $criteria = $this->validate_criteria($criteria); |
133 | 133 | $value = $this->parse_value($value); |
134 | 134 | |
135 | 135 | if($value === null || $value === ''){ |
136 | 136 | $this->query->push([$criteria]); |
137 | - }else{ |
|
137 | + } else{ |
|
138 | 138 | $this->query->push([$criteria, $value]); |
139 | 139 | } |
140 | 140 | } |
@@ -149,7 +149,9 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function orWhere(\Closure $closure = null) { |
151 | 151 | $this->query->push(['OR']); |
152 | - if($closure !== null) $closure($this); |
|
152 | + if($closure !== null) { |
|
153 | + $closure($this); |
|
154 | + } |
|
153 | 155 | |
154 | 156 | return $this; |
155 | 157 | } |
@@ -161,7 +163,9 @@ discard block |
||
161 | 163 | */ |
162 | 164 | public function andWhere(\Closure $closure = null) { |
163 | 165 | $this->query->push(['AND']); |
164 | - if($closure !== null) $closure($this); |
|
166 | + if($closure !== null) { |
|
167 | + $closure($this); |
|
168 | + } |
|
165 | 169 | |
166 | 170 | return $this; |
167 | 171 | } |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | if($value === null) { |
73 | 73 | if(isset(self::$config[$part])) { |
74 | 74 | $value = self::$config[$part]; |
75 | - }else{ |
|
75 | + } else{ |
|
76 | 76 | break; |
77 | 77 | } |
78 | - }else{ |
|
78 | + } else{ |
|
79 | 79 | if(isset($value[$part])) { |
80 | 80 | $value = $value[$part]; |
81 | - }else{ |
|
81 | + } else{ |
|
82 | 82 | break; |
83 | 83 | } |
84 | 84 | } |
@@ -227,11 +227,15 @@ discard block |
||
227 | 227 | $arrays = func_get_args(); |
228 | 228 | $base = array_shift($arrays); |
229 | 229 | |
230 | - if(!is_array($base)) $base = empty($base) ? array() : array($base); |
|
230 | + if(!is_array($base)) { |
|
231 | + $base = empty($base) ? array() : array($base); |
|
232 | + } |
|
231 | 233 | |
232 | 234 | foreach($arrays as $append) { |
233 | 235 | |
234 | - if(!is_array($append)) $append = array($append); |
|
236 | + if(!is_array($append)) { |
|
237 | + $append = array($append); |
|
238 | + } |
|
235 | 239 | |
236 | 240 | foreach($append as $key => $value) { |
237 | 241 | |
@@ -243,7 +247,9 @@ discard block |
||
243 | 247 | if(is_array($value) or is_array($base[$key])) { |
244 | 248 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]); |
245 | 249 | } else if(is_numeric($key)) { |
246 | - if(!in_array($value, $base)) $base[] = $value; |
|
250 | + if(!in_array($value, $base)) { |
|
251 | + $base[] = $value; |
|
252 | + } |
|
247 | 253 | } else { |
248 | 254 | $base[$key] = $value; |
249 | 255 | } |
@@ -35,11 +35,14 @@ |
||
35 | 35 | <td><?php echo $message->getAttachments()->count() > 0 ? 'yes' : 'no'; ?></td> |
36 | 36 | </tr> |
37 | 37 | <?php endforeach; ?> |
38 | - <?php else: ?> |
|
38 | + <?php else { |
|
39 | + : ?> |
|
39 | 40 | <tr> |
40 | 41 | <td colspan="4">No messages found</td> |
41 | 42 | </tr> |
42 | - <?php endif; ?> |
|
43 | + <?php endif; |
|
44 | +} |
|
45 | +?> |
|
43 | 46 | </tbody> |
44 | 47 | </table> |
45 | 48 |
@@ -31,11 +31,14 @@ |
||
31 | 31 | <td><?php echo $folder->search()->unseen()->setFetchBody(false)->count(); ?></td> |
32 | 32 | </tr> |
33 | 33 | <?php endforeach; ?> |
34 | - <?php else: ?> |
|
34 | + <?php else { |
|
35 | + : ?> |
|
35 | 36 | <tr> |
36 | 37 | <td colspan="4">No folders found</td> |
37 | 38 | </tr> |
38 | - <?php endif; ?> |
|
39 | + <?php endif; |
|
40 | +} |
|
41 | +?> |
|
39 | 42 | </tbody> |
40 | 43 | </table> |
41 | 44 |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | if ($prev_header !== null) { |
169 | 169 | $headers[$prev_header][] = $line; |
170 | 170 | } |
171 | - }else{ |
|
171 | + } else{ |
|
172 | 172 | if (($pos = strpos($line, ":")) > 0) { |
173 | 173 | $key = strtolower(substr($line, 0, $pos)); |
174 | 174 | $value = trim(rtrim(strtolower(substr($line, $pos + 1)))); |
@@ -179,7 +179,9 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | foreach($headers as $key => $values) { |
182 | - if (isset($imap_headers[$key])) continue; |
|
182 | + if (isset($imap_headers[$key])) { |
|
183 | + continue; |
|
184 | + } |
|
183 | 185 | $value = null; |
184 | 186 | switch($key){ |
185 | 187 | case 'from': |
@@ -297,9 +299,9 @@ discard block |
||
297 | 299 | return EncodingAliases::get($parameter->value, $this->fallback_encoding); |
298 | 300 | } |
299 | 301 | } |
300 | - }elseif (property_exists($structure, 'charset')) { |
|
302 | + } elseif (property_exists($structure, 'charset')) { |
|
301 | 303 | return EncodingAliases::get($structure->charset, $this->fallback_encoding); |
302 | - }elseif (is_string($structure) === true){ |
|
304 | + } elseif (is_string($structure) === true){ |
|
303 | 305 | return mb_detect_encoding($structure); |
304 | 306 | } |
305 | 307 | |
@@ -330,9 +332,9 @@ discard block |
||
330 | 332 | } |
331 | 333 | } |
332 | 334 | } |
333 | - }elseif($decoder === 'iconv') { |
|
335 | + } elseif($decoder === 'iconv') { |
|
334 | 336 | $value = iconv_mime_decode($value); |
335 | - }else{ |
|
337 | + } else{ |
|
336 | 338 | $value = mb_decode_mimeheader($value); |
337 | 339 | } |
338 | 340 | |
@@ -352,7 +354,9 @@ discard block |
||
352 | 354 | * Try to extract the priority from a given raw header string |
353 | 355 | */ |
354 | 356 | private function findPriority() { |
355 | - if(($priority = $this->get("x-priority")) === null) return; |
|
357 | + if(($priority = $this->get("x-priority")) === null) { |
|
358 | + return; |
|
359 | + } |
|
356 | 360 | switch($priority){ |
357 | 361 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
358 | 362 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
@@ -121,7 +121,7 @@ |
||
121 | 121 | protected function parse(){ |
122 | 122 | if ($this->header === null) { |
123 | 123 | $body = $this->findHeaders(); |
124 | - }else{ |
|
124 | + } else{ |
|
125 | 125 | $body = $this->raw; |
126 | 126 | } |
127 | 127 |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $value = $this->default_account_config[$key]; |
181 | 181 | if(isset($config[$key])) { |
182 | 182 | $value = $config[$key]; |
183 | - }elseif(isset($default_config[$key])) { |
|
183 | + } elseif(isset($default_config[$key])) { |
|
184 | 184 | $value = $default_config[$key]; |
185 | 185 | } |
186 | 186 | $this->$key = $value; |
@@ -214,39 +214,39 @@ discard block |
||
214 | 214 | if(isset($config['masks']['message'])) { |
215 | 215 | if(class_exists($config['masks']['message'])) { |
216 | 216 | $this->default_message_mask = $config['masks']['message']; |
217 | - }else{ |
|
217 | + } else{ |
|
218 | 218 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
219 | 219 | } |
220 | - }else{ |
|
220 | + } else{ |
|
221 | 221 | if(class_exists($default_config['message'])) { |
222 | 222 | $this->default_message_mask = $default_config['message']; |
223 | - }else{ |
|
223 | + } else{ |
|
224 | 224 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
225 | 225 | } |
226 | 226 | } |
227 | 227 | if(isset($config['masks']['attachment'])) { |
228 | 228 | if(class_exists($config['masks']['attachment'])) { |
229 | 229 | $this->default_message_mask = $config['masks']['attachment']; |
230 | - }else{ |
|
230 | + } else{ |
|
231 | 231 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
232 | 232 | } |
233 | - }else{ |
|
233 | + } else{ |
|
234 | 234 | if(class_exists($default_config['attachment'])) { |
235 | 235 | $this->default_message_mask = $default_config['attachment']; |
236 | - }else{ |
|
236 | + } else{ |
|
237 | 237 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
238 | 238 | } |
239 | 239 | } |
240 | - }else{ |
|
240 | + } else{ |
|
241 | 241 | if(class_exists($default_config['message'])) { |
242 | 242 | $this->default_message_mask = $default_config['message']; |
243 | - }else{ |
|
243 | + } else{ |
|
244 | 244 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
245 | 245 | } |
246 | 246 | |
247 | 247 | if(class_exists($default_config['attachment'])) { |
248 | 248 | $this->default_message_mask = $default_config['attachment']; |
249 | - }else{ |
|
249 | + } else{ |
|
250 | 250 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
251 | 251 | } |
252 | 252 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $timeout = $this->connection !== false ? $this->connection->getConnectionTimeout() : null; |
311 | 311 | $this->connection = new ImapProtocol($this->validate_cert); |
312 | 312 | $this->connection->setConnectionTimeout($timeout); |
313 | - }else{ |
|
313 | + } else{ |
|
314 | 314 | if (extension_loaded('imap') === false) { |
315 | 315 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
316 | 316 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | } |
403 | 403 | |
404 | 404 | return $folders; |
405 | - }else{ |
|
405 | + } else{ |
|
406 | 406 | throw new FolderFetchingException("failed to fetch any folders"); |
407 | 407 | } |
408 | 408 | } |
@@ -436,7 +436,9 @@ discard block |
||
436 | 436 | public function createFolder($folder, $expunge = true) { |
437 | 437 | $this->checkConnection(); |
438 | 438 | $status = $this->connection->createFolder($folder); |
439 | - if($expunge) $this->expunge(); |
|
439 | + if($expunge) { |
|
440 | + $this->expunge(); |
|
441 | + } |
|
440 | 442 | |
441 | 443 | $folder = $this->getFolder($folder); |
442 | 444 | if($status && $folder) { |