@@ -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 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $value = $this->default_account_config[$key]; |
173 | 173 | if(isset($config[$key])) { |
174 | 174 | $value = $config[$key]; |
175 | - }elseif(isset($default_config[$key])) { |
|
175 | + } elseif(isset($default_config[$key])) { |
|
176 | 176 | $value = $default_config[$key]; |
177 | 177 | } |
178 | 178 | $this->$key = $value; |
@@ -206,39 +206,39 @@ discard block |
||
206 | 206 | if(isset($config['masks']['message'])) { |
207 | 207 | if(class_exists($config['masks']['message'])) { |
208 | 208 | $this->default_message_mask = $config['masks']['message']; |
209 | - }else{ |
|
209 | + } else{ |
|
210 | 210 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
211 | 211 | } |
212 | - }else{ |
|
212 | + } else{ |
|
213 | 213 | if(class_exists($default_config['message'])) { |
214 | 214 | $this->default_message_mask = $default_config['message']; |
215 | - }else{ |
|
215 | + } else{ |
|
216 | 216 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
217 | 217 | } |
218 | 218 | } |
219 | 219 | if(isset($config['masks']['attachment'])) { |
220 | 220 | if(class_exists($config['masks']['attachment'])) { |
221 | 221 | $this->default_message_mask = $config['masks']['attachment']; |
222 | - }else{ |
|
222 | + } else{ |
|
223 | 223 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
224 | 224 | } |
225 | - }else{ |
|
225 | + } else{ |
|
226 | 226 | if(class_exists($default_config['attachment'])) { |
227 | 227 | $this->default_message_mask = $default_config['attachment']; |
228 | - }else{ |
|
228 | + } else{ |
|
229 | 229 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
230 | 230 | } |
231 | 231 | } |
232 | - }else{ |
|
232 | + } else{ |
|
233 | 233 | if(class_exists($default_config['message'])) { |
234 | 234 | $this->default_message_mask = $default_config['message']; |
235 | - }else{ |
|
235 | + } else{ |
|
236 | 236 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
237 | 237 | } |
238 | 238 | |
239 | 239 | if(class_exists($default_config['attachment'])) { |
240 | 240 | $this->default_message_mask = $default_config['attachment']; |
241 | - }else{ |
|
241 | + } else{ |
|
242 | 242 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
243 | 243 | } |
244 | 244 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $timeout = $this->connection !== false ? $this->connection->getConnectionTimeout() : null; |
303 | 303 | $this->connection = new ImapProtocol($this->validate_cert); |
304 | 304 | $this->connection->setConnectionTimeout($timeout); |
305 | - }else{ |
|
305 | + } else{ |
|
306 | 306 | if (extension_loaded('imap') === false) { |
307 | 307 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
308 | 308 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | try { |
329 | 329 | if ($this->authentication == "oauth") { |
330 | 330 | $this->connection->authenticate($this->username, $this->password); |
331 | - }else{ |
|
331 | + } else{ |
|
332 | 332 | $this->connection->login($this->username, $this->password); |
333 | 333 | } |
334 | 334 | } catch (\Exception $e) { |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | } |
394 | 394 | |
395 | 395 | return $folders; |
396 | - }else{ |
|
396 | + } else{ |
|
397 | 397 | throw new FolderFetchingException("failed to fetch any folders"); |
398 | 398 | } |
399 | 399 | } |
@@ -427,7 +427,9 @@ discard block |
||
427 | 427 | public function createFolder($folder, $expunge = true) { |
428 | 428 | $this->checkConnection(); |
429 | 429 | $status = $this->connection->createFolder($folder); |
430 | - if($expunge) $this->expunge(); |
|
430 | + if($expunge) { |
|
431 | + $this->expunge(); |
|
432 | + } |
|
431 | 433 | |
432 | 434 | $folder = $this->getFolder($folder); |
433 | 435 | if($status && $folder) { |
@@ -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 |