@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | * @param array $config |
204 | 204 | * @param array $default_config |
205 | 205 | */ |
206 | - private function setAccountConfig($key, $config, $default_config){ |
|
206 | + private function setAccountConfig($key, $config, $default_config) { |
|
207 | 207 | $value = $this->default_account_config[$key]; |
208 | - if(isset($config[$key])) { |
|
208 | + if (isset($config[$key])) { |
|
209 | 209 | $value = $config[$key]; |
210 | - }elseif(isset($default_config[$key])) { |
|
210 | + }elseif (isset($default_config[$key])) { |
|
211 | 211 | $value = $default_config[$key]; |
212 | 212 | } |
213 | 213 | $this->$key = $value; |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function setEventsFromConfig($config) { |
221 | 221 | $this->events = ClientManager::get("events"); |
222 | - if(isset($config['events'])){ |
|
223 | - if(isset($config['events'])) { |
|
224 | - foreach($config['events'] as $section => $events) { |
|
222 | + if (isset($config['events'])) { |
|
223 | + if (isset($config['events'])) { |
|
224 | + foreach ($config['events'] as $section => $events) { |
|
225 | 225 | $this->events[$section] = array_merge($this->events[$section], $events); |
226 | 226 | } |
227 | 227 | } |
@@ -235,45 +235,45 @@ discard block |
||
235 | 235 | * @throws MaskNotFoundException |
236 | 236 | */ |
237 | 237 | protected function setMaskFromConfig($config) { |
238 | - $default_config = ClientManager::get("masks"); |
|
238 | + $default_config = ClientManager::get("masks"); |
|
239 | 239 | |
240 | - if(isset($config['masks'])){ |
|
241 | - if(isset($config['masks']['message'])) { |
|
242 | - if(class_exists($config['masks']['message'])) { |
|
240 | + if (isset($config['masks'])) { |
|
241 | + if (isset($config['masks']['message'])) { |
|
242 | + if (class_exists($config['masks']['message'])) { |
|
243 | 243 | $this->default_message_mask = $config['masks']['message']; |
244 | - }else{ |
|
244 | + }else { |
|
245 | 245 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
246 | 246 | } |
247 | - }else{ |
|
248 | - if(class_exists($default_config['message'])) { |
|
247 | + }else { |
|
248 | + if (class_exists($default_config['message'])) { |
|
249 | 249 | $this->default_message_mask = $default_config['message']; |
250 | - }else{ |
|
250 | + }else { |
|
251 | 251 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
252 | 252 | } |
253 | 253 | } |
254 | - if(isset($config['masks']['attachment'])) { |
|
255 | - if(class_exists($config['masks']['attachment'])) { |
|
254 | + if (isset($config['masks']['attachment'])) { |
|
255 | + if (class_exists($config['masks']['attachment'])) { |
|
256 | 256 | $this->default_message_mask = $config['masks']['attachment']; |
257 | - }else{ |
|
257 | + }else { |
|
258 | 258 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
259 | 259 | } |
260 | - }else{ |
|
261 | - if(class_exists($default_config['attachment'])) { |
|
260 | + }else { |
|
261 | + if (class_exists($default_config['attachment'])) { |
|
262 | 262 | $this->default_message_mask = $default_config['attachment']; |
263 | - }else{ |
|
263 | + }else { |
|
264 | 264 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
265 | 265 | } |
266 | 266 | } |
267 | - }else{ |
|
268 | - if(class_exists($default_config['message'])) { |
|
267 | + }else { |
|
268 | + if (class_exists($default_config['message'])) { |
|
269 | 269 | $this->default_message_mask = $default_config['message']; |
270 | - }else{ |
|
270 | + }else { |
|
271 | 271 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
272 | 272 | } |
273 | 273 | |
274 | - if(class_exists($default_config['attachment'])) { |
|
274 | + if (class_exists($default_config['attachment'])) { |
|
275 | 275 | $this->default_message_mask = $default_config['attachment']; |
276 | - }else{ |
|
276 | + }else { |
|
277 | 277 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
278 | 278 | } |
279 | 279 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $this->connection = new ImapProtocol($this->validate_cert, $this->encryption); |
338 | 338 | $this->connection->setConnectionTimeout($this->timeout); |
339 | 339 | $this->connection->setProxy($this->proxy); |
340 | - }else{ |
|
340 | + }else { |
|
341 | 341 | if (extension_loaded('imap') === false) { |
342 | 342 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
343 | 343 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | |
411 | 411 | // Set delimiter to false to force selection via getFolderByName (maybe useful for uncommon folder names) |
412 | 412 | $delimiter = is_null($delimiter) ? ClientManager::get('options.delimiter', "/") : $delimiter; |
413 | - if (strpos($folder_name, (string)$delimiter) !== false) { |
|
413 | + if (strpos($folder_name, (string) $delimiter) !== false) { |
|
414 | 414 | return $this->getFolderByPath($folder_name); |
415 | 415 | } |
416 | 416 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
463 | 463 | $items = $this->connection->folders('', $pattern); |
464 | 464 | |
465 | - if(is_array($items)){ |
|
465 | + if (is_array($items)) { |
|
466 | 466 | foreach ($items as $folder_name => $item) { |
467 | 467 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
468 | 468 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | } |
478 | 478 | |
479 | 479 | return $folders; |
480 | - }else{ |
|
480 | + }else { |
|
481 | 481 | throw new FolderFetchingException("failed to fetch any folders"); |
482 | 482 | } |
483 | 483 | } |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | $this->checkConnection(); |
516 | 516 | $status = $this->connection->createFolder($folder); |
517 | 517 | |
518 | - if($expunge) $this->expunge(); |
|
518 | + if ($expunge) $this->expunge(); |
|
519 | 519 | |
520 | 520 | $folder = $this->getFolder($folder); |
521 | - if($status && $folder) { |
|
521 | + if ($status && $folder) { |
|
522 | 522 | $event = $this->getEvent("folder", "new"); |
523 | 523 | $event::dispatch($folder); |
524 | 524 | } |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return string |
546 | 546 | */ |
547 | - public function getFolderPath(){ |
|
547 | + public function getFolderPath() { |
|
548 | 548 | return $this->active_folder; |
549 | 549 | } |
550 | 550 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | * @return int |
603 | 603 | * @throws ConnectionFailedException |
604 | 604 | */ |
605 | - public function getTimeout(){ |
|
605 | + public function getTimeout() { |
|
606 | 606 | $this->checkConnection(); |
607 | 607 | return $this->connection->getConnectionTimeout(); |
608 | 608 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * |
613 | 613 | * @return string |
614 | 614 | */ |
615 | - public function getDefaultMessageMask(){ |
|
615 | + public function getDefaultMessageMask() { |
|
616 | 616 | return $this->default_message_mask; |
617 | 617 | } |
618 | 618 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @return array |
624 | 624 | */ |
625 | - public function getDefaultEvents($section){ |
|
625 | + public function getDefaultEvents($section) { |
|
626 | 626 | return $this->events[$section]; |
627 | 627 | } |
628 | 628 | |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | * @throws MaskNotFoundException |
635 | 635 | */ |
636 | 636 | public function setDefaultMessageMask($mask) { |
637 | - if(class_exists($mask)) { |
|
637 | + if (class_exists($mask)) { |
|
638 | 638 | $this->default_message_mask = $mask; |
639 | 639 | |
640 | 640 | return $this; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * |
649 | 649 | * @return string |
650 | 650 | */ |
651 | - public function getDefaultAttachmentMask(){ |
|
651 | + public function getDefaultAttachmentMask() { |
|
652 | 652 | return $this->default_attachment_mask; |
653 | 653 | } |
654 | 654 | |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | * @throws MaskNotFoundException |
661 | 661 | */ |
662 | 662 | public function setDefaultAttachmentMask($mask) { |
663 | - if(class_exists($mask)) { |
|
663 | + if (class_exists($mask)) { |
|
664 | 664 | $this->default_attachment_mask = $mask; |
665 | 665 | |
666 | 666 | return $this; |