@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * New custom method which can be called through a mask |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | - public function token(){ |
|
| 19 | + public function token() { |
|
| 20 | 20 | return implode('-', [$this->message_id, $this->uid, $this->message_no]); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * New custom method which can be called through a mask |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | - public function token(){ |
|
| 19 | + public function token() { |
|
| 20 | 20 | return implode('-', [$this->id, $this->getMessage()->getUid(), $this->name]); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * @return int|null |
| 70 | 70 | */ |
| 71 | 71 | public function total($total = null) { |
| 72 | - if($total === null) { |
|
| 72 | + if ($total === null) { |
|
| 73 | 73 | return $this->total; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | * |
| 66 | 66 | * @return array |
| 67 | 67 | */ |
| 68 | - public function getEvents(){ |
|
| 68 | + public function getEvents() { |
|
| 69 | 69 | return $this->events; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -68,17 +68,17 @@ discard block |
||
| 68 | 68 | public static function get($key, $default = null) { |
| 69 | 69 | $parts = explode('.', $key); |
| 70 | 70 | $value = null; |
| 71 | - foreach($parts as $part) { |
|
| 72 | - if($value === null) { |
|
| 73 | - if(isset(self::$config[$part])) { |
|
| 71 | + foreach ($parts as $part) { |
|
| 72 | + if ($value === null) { |
|
| 73 | + if (isset(self::$config[$part])) { |
|
| 74 | 74 | $value = self::$config[$part]; |
| 75 | - }else{ |
|
| 75 | + }else { |
|
| 76 | 76 | break; |
| 77 | 77 | } |
| 78 | - }else{ |
|
| 79 | - if(isset($value[$part])) { |
|
| 78 | + }else { |
|
| 79 | + if (isset($value[$part])) { |
|
| 80 | 80 | $value = $value[$part]; |
| 81 | - }else{ |
|
| 81 | + }else { |
|
| 82 | 82 | break; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function setConfig($config) { |
| 173 | 173 | |
| 174 | - if(is_array($config) === false) { |
|
| 174 | + if (is_array($config) === false) { |
|
| 175 | 175 | $config = require $config; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -181,17 +181,17 @@ discard block |
||
| 181 | 181 | $vendor_config = require $path; |
| 182 | 182 | $config = $this->array_merge_recursive_distinct($vendor_config, $config); |
| 183 | 183 | |
| 184 | - if(is_array($config)){ |
|
| 185 | - if(isset($config['default'])){ |
|
| 186 | - if(isset($config['accounts']) && $config['default'] != false){ |
|
| 184 | + if (is_array($config)) { |
|
| 185 | + if (isset($config['default'])) { |
|
| 186 | + if (isset($config['accounts']) && $config['default'] != false) { |
|
| 187 | 187 | |
| 188 | 188 | $default_config = $vendor_config['accounts']['default']; |
| 189 | - if(isset($config['accounts'][$config['default']])){ |
|
| 189 | + if (isset($config['accounts'][$config['default']])) { |
|
| 190 | 190 | $default_config = array_merge($default_config, $config['accounts'][$config['default']]); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - if(is_array($config['accounts'])){ |
|
| 194 | - foreach($config['accounts'] as $account_key => $account){ |
|
| 193 | + if (is_array($config['accounts'])) { |
|
| 194 | + foreach ($config['accounts'] as $account_key => $account) { |
|
| 195 | 195 | $config['accounts'][$account_key] = array_merge($default_config, $account); |
| 196 | 196 | } |
| 197 | 197 | } |
@@ -227,24 +227,24 @@ 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)) $base = empty($base) ? array() : array($base); |
|
| 231 | 231 | |
| 232 | - foreach($arrays as $append) { |
|
| 232 | + foreach ($arrays as $append) { |
|
| 233 | 233 | |
| 234 | - if(!is_array($append)) $append = array($append); |
|
| 234 | + if (!is_array($append)) $append = array($append); |
|
| 235 | 235 | |
| 236 | - foreach($append as $key => $value) { |
|
| 236 | + foreach ($append as $key => $value) { |
|
| 237 | 237 | |
| 238 | - if(!array_key_exists($key, $base) and !is_numeric($key)) { |
|
| 238 | + if (!array_key_exists($key, $base) and !is_numeric($key)) { |
|
| 239 | 239 | $base[$key] = $append[$key]; |
| 240 | 240 | continue; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if(is_array($value) or is_array($base[$key])) { |
|
| 243 | + if (is_array($value) or is_array($base[$key])) { |
|
| 244 | 244 | $base[$key] = $this->array_merge_recursive_distinct($base[$key], $append[$key]); |
| 245 | - } else if(is_numeric($key)) { |
|
| 246 | - if(!in_array($value, $base)) $base[] = $value; |
|
| 247 | - } else { |
|
| 245 | + }else if (is_numeric($key)) { |
|
| 246 | + if (!in_array($value, $base)) $base[] = $value; |
|
| 247 | + }else { |
|
| 248 | 248 | $base[$key] = $value; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -26,8 +26,8 @@ |
||
| 26 | 26 | </tr> |
| 27 | 27 | </thead> |
| 28 | 28 | <tbody> |
| 29 | - <?php if($paginator->count() > 0): ?> |
|
| 30 | - <?php foreach($paginator as $message): ?> |
|
| 29 | + <?php if ($paginator->count() > 0): ?> |
|
| 30 | + <?php foreach ($paginator as $message): ?> |
|
| 31 | 31 | <tr> |
| 32 | 32 | <td><?php echo $message->getUid(); ?></td> |
| 33 | 33 | <td><?php echo $message->getSubject(); ?></td> |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | </tr> |
| 25 | 25 | </thead> |
| 26 | 26 | <tbody> |
| 27 | - <?php if($paginator->count() > 0): ?> |
|
| 28 | - <?php foreach($paginator as $folder): ?> |
|
| 27 | + <?php if ($paginator->count() > 0): ?> |
|
| 28 | + <?php foreach ($paginator as $folder): ?> |
|
| 29 | 29 | <tr> |
| 30 | 30 | <td><?php echo $folder->name; ?></td> |
| 31 | 31 | <td><?php echo $folder->search()->unseen()->setFetchBody(false)->count(); ?></td> |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function __construct($parent) { |
| 44 | 44 | $this->parent = $parent; |
| 45 | 45 | |
| 46 | - if(method_exists($this->parent, 'getAttributes')){ |
|
| 46 | + if (method_exists($this->parent, 'getAttributes')) { |
|
| 47 | 47 | $this->attributes = array_merge($this->attributes, $this->parent->getAttributes()); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * Boot method made to be used by any custom mask |
| 55 | 55 | */ |
| 56 | - protected function boot(){} |
|
| 56 | + protected function boot() {} |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * Call dynamic attribute setter and getter methods and inherit the parent calls |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | * @throws MethodNotFoundException |
| 65 | 65 | */ |
| 66 | 66 | public function __call($method, $arguments) { |
| 67 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 67 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 68 | 68 | $name = Str::snake(substr($method, 3)); |
| 69 | 69 | |
| 70 | - if(isset($this->attributes[$name])) { |
|
| 70 | + if (isset($this->attributes[$name])) { |
|
| 71 | 71 | return $this->attributes[$name]; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
| 75 | 75 | $name = Str::snake(substr($method, 3)); |
| 76 | 76 | |
| 77 | - if(isset($this->attributes[$name])) { |
|
| 77 | + if (isset($this->attributes[$name])) { |
|
| 78 | 78 | $this->attributes[$name] = array_pop($arguments); |
| 79 | 79 | |
| 80 | 80 | return $this->attributes[$name]; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if(method_exists($this->parent, $method) === true){ |
|
| 85 | + if (method_exists($this->parent, $method) === true) { |
|
| 86 | 86 | return call_user_func_array([$this->parent, $method], $arguments); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return mixed|null |
| 110 | 110 | */ |
| 111 | 111 | public function __get($name) { |
| 112 | - if(isset($this->attributes[$name])) { |
|
| 112 | + if (isset($this->attributes[$name])) { |
|
| 113 | 113 | return $this->attributes[$name]; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return mixed |
| 123 | 123 | */ |
| 124 | - public function getParent(){ |
|
| 124 | + public function getParent() { |
|
| 125 | 125 | return $this->parent; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return array |
| 132 | 132 | */ |
| 133 | - public function getAttributes(){ |
|
| 133 | + public function getAttributes() { |
|
| 134 | 134 | return $this->attributes; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | * @param array $config |
| 177 | 177 | * @param array $default_config |
| 178 | 178 | */ |
| 179 | - private function setAccountConfig($key, $config, $default_config){ |
|
| 179 | + private function setAccountConfig($key, $config, $default_config) { |
|
| 180 | 180 | $value = $this->default_account_config[$key]; |
| 181 | - if(isset($config[$key])) { |
|
| 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; |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | protected function setEventsFromConfig($config) { |
| 194 | 194 | $this->events = ClientManager::get("events"); |
| 195 | - if(isset($config['events'])){ |
|
| 196 | - if(isset($config['events'])) { |
|
| 197 | - foreach($config['events'] as $section => $events) { |
|
| 195 | + if (isset($config['events'])) { |
|
| 196 | + if (isset($config['events'])) { |
|
| 197 | + foreach ($config['events'] as $section => $events) { |
|
| 198 | 198 | $this->events[$section] = array_merge($this->events[$section], $events); |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -208,45 +208,45 @@ discard block |
||
| 208 | 208 | * @throws MaskNotFoundException |
| 209 | 209 | */ |
| 210 | 210 | protected function setMaskFromConfig($config) { |
| 211 | - $default_config = ClientManager::get("masks"); |
|
| 211 | + $default_config = ClientManager::get("masks"); |
|
| 212 | 212 | |
| 213 | - if(isset($config['masks'])){ |
|
| 214 | - if(isset($config['masks']['message'])) { |
|
| 215 | - if(class_exists($config['masks']['message'])) { |
|
| 213 | + if (isset($config['masks'])) { |
|
| 214 | + if (isset($config['masks']['message'])) { |
|
| 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{ |
|
| 221 | - if(class_exists($default_config['message'])) { |
|
| 220 | + }else { |
|
| 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 | - if(isset($config['masks']['attachment'])) { |
|
| 228 | - if(class_exists($config['masks']['attachment'])) { |
|
| 227 | + if (isset($config['masks']['attachment'])) { |
|
| 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{ |
|
| 234 | - if(class_exists($default_config['attachment'])) { |
|
| 233 | + }else { |
|
| 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{ |
|
| 241 | - if(class_exists($default_config['message'])) { |
|
| 240 | + }else { |
|
| 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 | - if(class_exists($default_config['attachment'])) { |
|
| 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 | } |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
| 388 | 388 | $items = $this->connection->folders('', $pattern); |
| 389 | 389 | |
| 390 | - if(is_array($items)){ |
|
| 390 | + if (is_array($items)) { |
|
| 391 | 391 | foreach ($items as $folder_name => $item) { |
| 392 | 392 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
| 393 | 393 | |
@@ -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,10 +436,10 @@ 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) $this->expunge(); |
|
| 440 | 440 | |
| 441 | 441 | $folder = $this->getFolder($folder); |
| 442 | - if($status && $folder) { |
|
| 442 | + if ($status && $folder) { |
|
| 443 | 443 | $event = $this->getEvent("folder", "new"); |
| 444 | 444 | $event::dispatch($folder); |
| 445 | 445 | } |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | * |
| 465 | 465 | * @return Folder |
| 466 | 466 | */ |
| 467 | - public function getFolderPath(){ |
|
| 467 | + public function getFolderPath() { |
|
| 468 | 468 | return $this->active_folder; |
| 469 | 469 | } |
| 470 | 470 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | * |
| 519 | 519 | * @return int |
| 520 | 520 | */ |
| 521 | - public function getTimeout($type){ |
|
| 521 | + public function getTimeout($type) { |
|
| 522 | 522 | return $this->connection->getConnectionTimeout(); |
| 523 | 523 | } |
| 524 | 524 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | * |
| 528 | 528 | * @return string |
| 529 | 529 | */ |
| 530 | - public function getDefaultMessageMask(){ |
|
| 530 | + public function getDefaultMessageMask() { |
|
| 531 | 531 | return $this->default_message_mask; |
| 532 | 532 | } |
| 533 | 533 | |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | * |
| 538 | 538 | * @return array |
| 539 | 539 | */ |
| 540 | - public function getDefaultEvents($section){ |
|
| 540 | + public function getDefaultEvents($section) { |
|
| 541 | 541 | return $this->events[$section]; |
| 542 | 542 | } |
| 543 | 543 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | * @throws MaskNotFoundException |
| 550 | 550 | */ |
| 551 | 551 | public function setDefaultMessageMask($mask) { |
| 552 | - if(class_exists($mask)) { |
|
| 552 | + if (class_exists($mask)) { |
|
| 553 | 553 | $this->default_message_mask = $mask; |
| 554 | 554 | |
| 555 | 555 | return $this; |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | * |
| 564 | 564 | * @return string |
| 565 | 565 | */ |
| 566 | - public function getDefaultAttachmentMask(){ |
|
| 566 | + public function getDefaultAttachmentMask() { |
|
| 567 | 567 | return $this->default_attachment_mask; |
| 568 | 568 | } |
| 569 | 569 | |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | * @throws MaskNotFoundException |
| 576 | 576 | */ |
| 577 | 577 | public function setDefaultAttachmentMask($mask) { |
| 578 | - if(class_exists($mask)) { |
|
| 578 | + if (class_exists($mask)) { |
|
| 579 | 579 | $this->default_attachment_mask = $mask; |
| 580 | 580 | |
| 581 | 581 | return $this; |