@@ -377,7 +377,7 @@ |
||
| 377 | 377 | if (strpos($folder_name, $delimiter) !== false) { |
| 378 | 378 | return $this->getFolderByPath($folder_name); |
| 379 | 379 | } |
| 380 | - } |
|
| 380 | + } |
|
| 381 | 381 | |
| 382 | 382 | return $this->getFolderByName($folder_name); |
| 383 | 383 | } |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | * @param array $config |
| 178 | 178 | * @param array $default_config |
| 179 | 179 | */ |
| 180 | - private function setAccountConfig($key, $config, $default_config){ |
|
| 180 | + private function setAccountConfig($key, $config, $default_config) { |
|
| 181 | 181 | $value = $this->default_account_config[$key]; |
| 182 | - if(isset($config[$key])) { |
|
| 182 | + if (isset($config[$key])) { |
|
| 183 | 183 | $value = $config[$key]; |
| 184 | - }elseif(isset($default_config[$key])) { |
|
| 184 | + }elseif (isset($default_config[$key])) { |
|
| 185 | 185 | $value = $default_config[$key]; |
| 186 | 186 | } |
| 187 | 187 | $this->$key = $value; |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | protected function setEventsFromConfig($config) { |
| 195 | 195 | $this->events = ClientManager::get("events"); |
| 196 | - if(isset($config['events'])){ |
|
| 197 | - if(isset($config['events'])) { |
|
| 198 | - foreach($config['events'] as $section => $events) { |
|
| 196 | + if (isset($config['events'])) { |
|
| 197 | + if (isset($config['events'])) { |
|
| 198 | + foreach ($config['events'] as $section => $events) { |
|
| 199 | 199 | $this->events[$section] = array_merge($this->events[$section], $events); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -209,45 +209,45 @@ discard block |
||
| 209 | 209 | * @throws MaskNotFoundException |
| 210 | 210 | */ |
| 211 | 211 | protected function setMaskFromConfig($config) { |
| 212 | - $default_config = ClientManager::get("masks"); |
|
| 212 | + $default_config = ClientManager::get("masks"); |
|
| 213 | 213 | |
| 214 | - if(isset($config['masks'])){ |
|
| 215 | - if(isset($config['masks']['message'])) { |
|
| 216 | - if(class_exists($config['masks']['message'])) { |
|
| 214 | + if (isset($config['masks'])) { |
|
| 215 | + if (isset($config['masks']['message'])) { |
|
| 216 | + if (class_exists($config['masks']['message'])) { |
|
| 217 | 217 | $this->default_message_mask = $config['masks']['message']; |
| 218 | - }else{ |
|
| 218 | + }else { |
|
| 219 | 219 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
| 220 | 220 | } |
| 221 | - }else{ |
|
| 222 | - if(class_exists($default_config['message'])) { |
|
| 221 | + }else { |
|
| 222 | + if (class_exists($default_config['message'])) { |
|
| 223 | 223 | $this->default_message_mask = $default_config['message']; |
| 224 | - }else{ |
|
| 224 | + }else { |
|
| 225 | 225 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | - if(isset($config['masks']['attachment'])) { |
|
| 229 | - if(class_exists($config['masks']['attachment'])) { |
|
| 228 | + if (isset($config['masks']['attachment'])) { |
|
| 229 | + if (class_exists($config['masks']['attachment'])) { |
|
| 230 | 230 | $this->default_message_mask = $config['masks']['attachment']; |
| 231 | - }else{ |
|
| 231 | + }else { |
|
| 232 | 232 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
| 233 | 233 | } |
| 234 | - }else{ |
|
| 235 | - if(class_exists($default_config['attachment'])) { |
|
| 234 | + }else { |
|
| 235 | + if (class_exists($default_config['attachment'])) { |
|
| 236 | 236 | $this->default_message_mask = $default_config['attachment']; |
| 237 | - }else{ |
|
| 237 | + }else { |
|
| 238 | 238 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | - }else{ |
|
| 242 | - if(class_exists($default_config['message'])) { |
|
| 241 | + }else { |
|
| 242 | + if (class_exists($default_config['message'])) { |
|
| 243 | 243 | $this->default_message_mask = $default_config['message']; |
| 244 | - }else{ |
|
| 244 | + }else { |
|
| 245 | 245 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if(class_exists($default_config['attachment'])) { |
|
| 248 | + if (class_exists($default_config['attachment'])) { |
|
| 249 | 249 | $this->default_message_mask = $default_config['attachment']; |
| 250 | - }else{ |
|
| 250 | + }else { |
|
| 251 | 251 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $timeout = $this->connection !== false ? $this->connection->getConnectionTimeout() : null; |
| 312 | 312 | $this->connection = new ImapProtocol($this->validate_cert); |
| 313 | 313 | $this->connection->setConnectionTimeout($timeout); |
| 314 | - }else{ |
|
| 314 | + }else { |
|
| 315 | 315 | if (extension_loaded('imap') === false) { |
| 316 | 316 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
| 317 | 317 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
| 425 | 425 | $items = $this->connection->folders('', $pattern); |
| 426 | 426 | |
| 427 | - if(is_array($items)){ |
|
| 427 | + if (is_array($items)) { |
|
| 428 | 428 | foreach ($items as $folder_name => $item) { |
| 429 | 429 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
| 430 | 430 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | return $folders; |
| 442 | - }else{ |
|
| 442 | + }else { |
|
| 443 | 443 | throw new FolderFetchingException("failed to fetch any folders"); |
| 444 | 444 | } |
| 445 | 445 | } |
@@ -475,10 +475,10 @@ discard block |
||
| 475 | 475 | $this->checkConnection(); |
| 476 | 476 | $status = $this->connection->createFolder($folder); |
| 477 | 477 | |
| 478 | - if($expunge) $this->expunge(); |
|
| 478 | + if ($expunge) $this->expunge(); |
|
| 479 | 479 | |
| 480 | 480 | $folder = $this->getFolder($folder); |
| 481 | - if($status && $folder) { |
|
| 481 | + if ($status && $folder) { |
|
| 482 | 482 | $event = $this->getEvent("folder", "new"); |
| 483 | 483 | $event::dispatch($folder); |
| 484 | 484 | } |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | * |
| 504 | 504 | * @return Folder |
| 505 | 505 | */ |
| 506 | - public function getFolderPath(){ |
|
| 506 | + public function getFolderPath() { |
|
| 507 | 507 | return $this->active_folder; |
| 508 | 508 | } |
| 509 | 509 | |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | * |
| 558 | 558 | * @return int |
| 559 | 559 | */ |
| 560 | - public function getTimeout($type){ |
|
| 560 | + public function getTimeout($type) { |
|
| 561 | 561 | return $this->connection->getConnectionTimeout(); |
| 562 | 562 | } |
| 563 | 563 | |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | * |
| 567 | 567 | * @return string |
| 568 | 568 | */ |
| 569 | - public function getDefaultMessageMask(){ |
|
| 569 | + public function getDefaultMessageMask() { |
|
| 570 | 570 | return $this->default_message_mask; |
| 571 | 571 | } |
| 572 | 572 | |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | * |
| 577 | 577 | * @return array |
| 578 | 578 | */ |
| 579 | - public function getDefaultEvents($section){ |
|
| 579 | + public function getDefaultEvents($section) { |
|
| 580 | 580 | return $this->events[$section]; |
| 581 | 581 | } |
| 582 | 582 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | * @throws MaskNotFoundException |
| 589 | 589 | */ |
| 590 | 590 | public function setDefaultMessageMask($mask) { |
| 591 | - if(class_exists($mask)) { |
|
| 591 | + if (class_exists($mask)) { |
|
| 592 | 592 | $this->default_message_mask = $mask; |
| 593 | 593 | |
| 594 | 594 | return $this; |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | * |
| 603 | 603 | * @return string |
| 604 | 604 | */ |
| 605 | - public function getDefaultAttachmentMask(){ |
|
| 605 | + public function getDefaultAttachmentMask() { |
|
| 606 | 606 | return $this->default_attachment_mask; |
| 607 | 607 | } |
| 608 | 608 | |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | * @throws MaskNotFoundException |
| 615 | 615 | */ |
| 616 | 616 | public function setDefaultAttachmentMask($mask) { |
| 617 | - if(class_exists($mask)) { |
|
| 617 | + if (class_exists($mask)) { |
|
| 618 | 618 | $this->default_attachment_mask = $mask; |
| 619 | 619 | |
| 620 | 620 | return $this; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $value = $this->default_account_config[$key]; |
| 182 | 182 | if(isset($config[$key])) { |
| 183 | 183 | $value = $config[$key]; |
| 184 | - }elseif(isset($default_config[$key])) { |
|
| 184 | + } elseif(isset($default_config[$key])) { |
|
| 185 | 185 | $value = $default_config[$key]; |
| 186 | 186 | } |
| 187 | 187 | $this->$key = $value; |
@@ -215,39 +215,39 @@ discard block |
||
| 215 | 215 | if(isset($config['masks']['message'])) { |
| 216 | 216 | if(class_exists($config['masks']['message'])) { |
| 217 | 217 | $this->default_message_mask = $config['masks']['message']; |
| 218 | - }else{ |
|
| 218 | + } else{ |
|
| 219 | 219 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
| 220 | 220 | } |
| 221 | - }else{ |
|
| 221 | + } else{ |
|
| 222 | 222 | if(class_exists($default_config['message'])) { |
| 223 | 223 | $this->default_message_mask = $default_config['message']; |
| 224 | - }else{ |
|
| 224 | + } else{ |
|
| 225 | 225 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | if(isset($config['masks']['attachment'])) { |
| 229 | 229 | if(class_exists($config['masks']['attachment'])) { |
| 230 | 230 | $this->default_message_mask = $config['masks']['attachment']; |
| 231 | - }else{ |
|
| 231 | + } else{ |
|
| 232 | 232 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
| 233 | 233 | } |
| 234 | - }else{ |
|
| 234 | + } else{ |
|
| 235 | 235 | if(class_exists($default_config['attachment'])) { |
| 236 | 236 | $this->default_message_mask = $default_config['attachment']; |
| 237 | - }else{ |
|
| 237 | + } else{ |
|
| 238 | 238 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | - }else{ |
|
| 241 | + } else{ |
|
| 242 | 242 | if(class_exists($default_config['message'])) { |
| 243 | 243 | $this->default_message_mask = $default_config['message']; |
| 244 | - }else{ |
|
| 244 | + } else{ |
|
| 245 | 245 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | if(class_exists($default_config['attachment'])) { |
| 249 | 249 | $this->default_message_mask = $default_config['attachment']; |
| 250 | - }else{ |
|
| 250 | + } else{ |
|
| 251 | 251 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $timeout = $this->connection !== false ? $this->connection->getConnectionTimeout() : null; |
| 312 | 312 | $this->connection = new ImapProtocol($this->validate_cert); |
| 313 | 313 | $this->connection->setConnectionTimeout($timeout); |
| 314 | - }else{ |
|
| 314 | + } else{ |
|
| 315 | 315 | if (extension_loaded('imap') === false) { |
| 316 | 316 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
| 317 | 317 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | return $folders; |
| 442 | - }else{ |
|
| 442 | + } else{ |
|
| 443 | 443 | throw new FolderFetchingException("failed to fetch any folders"); |
| 444 | 444 | } |
| 445 | 445 | } |
@@ -475,7 +475,9 @@ discard block |
||
| 475 | 475 | $this->checkConnection(); |
| 476 | 476 | $status = $this->connection->createFolder($folder); |
| 477 | 477 | |
| 478 | - if($expunge) $this->expunge(); |
|
| 478 | + if($expunge) { |
|
| 479 | + $this->expunge(); |
|
| 480 | + } |
|
| 479 | 481 | |
| 480 | 482 | $folder = $this->getFolder($folder); |
| 481 | 483 | if($status && $folder) { |