@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return string |
59 | 59 | */ |
60 | - public function toString(){ |
|
60 | + public function toString() { |
|
61 | 61 | return $this->__toString(); |
62 | 62 | } |
63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return array |
68 | 68 | */ |
69 | - public function __serialize(){ |
|
69 | + public function __serialize() { |
|
70 | 70 | return $this->values; |
71 | 71 | } |
72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return array |
77 | 77 | */ |
78 | - public function toArray(){ |
|
78 | + public function toArray() { |
|
79 | 79 | return $this->__serialize(); |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return Carbon|null |
86 | 86 | */ |
87 | - public function toDate(){ |
|
87 | + public function toDate() { |
|
88 | 88 | $date = $this->first(); |
89 | 89 | if ($date instanceof Carbon) return $date; |
90 | 90 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function offsetSet($key, $value) { |
122 | 122 | if (is_null($key)) { |
123 | 123 | $this->values[] = $value; |
124 | - } else { |
|
124 | + }else { |
|
125 | 125 | $this->values[$key] = $value; |
126 | 126 | } |
127 | 127 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | if ($this->contains($value) === false) { |
196 | 196 | $this->values[] = $value; |
197 | 197 | } |
198 | - }else{ |
|
198 | + }else { |
|
199 | 199 | $this->values[] = $value; |
200 | 200 | } |
201 | 201 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return Attribute |
208 | 208 | */ |
209 | - public function setName($name){ |
|
209 | + public function setName($name) { |
|
210 | 210 | $this->name = $name; |
211 | 211 | |
212 | 212 | return $this; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return string |
219 | 219 | */ |
220 | - public function getName(){ |
|
220 | + public function getName() { |
|
221 | 221 | return $this->name; |
222 | 222 | } |
223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return array |
228 | 228 | */ |
229 | - public function get(){ |
|
229 | + public function get() { |
|
230 | 230 | return $this->values; |
231 | 231 | } |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return array |
237 | 237 | */ |
238 | - public function all(){ |
|
238 | + public function all() { |
|
239 | 239 | return $this->get(); |
240 | 240 | } |
241 | 241 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return mixed|null |
246 | 246 | */ |
247 | - public function first(){ |
|
247 | + public function first() { |
|
248 | 248 | if ($this->offsetExists(0)) { |
249 | 249 | return $this->values[0]; |
250 | 250 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return mixed|null |
258 | 258 | */ |
259 | - public function last(){ |
|
259 | + public function last() { |
|
260 | 260 | if (($cnt = $this->count()) > 0) { |
261 | 261 | return $this->values[$cnt - 1]; |
262 | 262 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return int |
270 | 270 | */ |
271 | - public function count(){ |
|
271 | + public function count() { |
|
272 | 272 | return count($this->values); |
273 | 273 | } |
274 | 274 | } |
275 | 275 | \ No newline at end of file |
@@ -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,8 +219,8 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function setEventsFromConfig($config) { |
221 | 221 | $this->events = ClientManager::get("events"); |
222 | - if(isset($config['events'])){ |
|
223 | - foreach($config['events'] as $section => $events) { |
|
222 | + if (isset($config['events'])) { |
|
223 | + foreach ($config['events'] as $section => $events) { |
|
224 | 224 | $this->events[$section] = array_merge($this->events[$section], $events); |
225 | 225 | } |
226 | 226 | } |
@@ -233,45 +233,45 @@ discard block |
||
233 | 233 | * @throws MaskNotFoundException |
234 | 234 | */ |
235 | 235 | protected function setMaskFromConfig($config) { |
236 | - $default_config = ClientManager::get("masks"); |
|
236 | + $default_config = ClientManager::get("masks"); |
|
237 | 237 | |
238 | - if(isset($config['masks'])){ |
|
239 | - if(isset($config['masks']['message'])) { |
|
240 | - if(class_exists($config['masks']['message'])) { |
|
238 | + if (isset($config['masks'])) { |
|
239 | + if (isset($config['masks']['message'])) { |
|
240 | + if (class_exists($config['masks']['message'])) { |
|
241 | 241 | $this->default_message_mask = $config['masks']['message']; |
242 | - }else{ |
|
242 | + }else { |
|
243 | 243 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
244 | 244 | } |
245 | - }else{ |
|
246 | - if(class_exists($default_config['message'])) { |
|
245 | + }else { |
|
246 | + if (class_exists($default_config['message'])) { |
|
247 | 247 | $this->default_message_mask = $default_config['message']; |
248 | - }else{ |
|
248 | + }else { |
|
249 | 249 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
250 | 250 | } |
251 | 251 | } |
252 | - if(isset($config['masks']['attachment'])) { |
|
253 | - if(class_exists($config['masks']['attachment'])) { |
|
252 | + if (isset($config['masks']['attachment'])) { |
|
253 | + if (class_exists($config['masks']['attachment'])) { |
|
254 | 254 | $this->default_attachment_mask = $config['masks']['attachment']; |
255 | - }else{ |
|
255 | + }else { |
|
256 | 256 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
257 | 257 | } |
258 | - }else{ |
|
259 | - if(class_exists($default_config['attachment'])) { |
|
258 | + }else { |
|
259 | + if (class_exists($default_config['attachment'])) { |
|
260 | 260 | $this->default_attachment_mask = $default_config['attachment']; |
261 | - }else{ |
|
261 | + }else { |
|
262 | 262 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
263 | 263 | } |
264 | 264 | } |
265 | - }else{ |
|
266 | - if(class_exists($default_config['message'])) { |
|
265 | + }else { |
|
266 | + if (class_exists($default_config['message'])) { |
|
267 | 267 | $this->default_message_mask = $default_config['message']; |
268 | - }else{ |
|
268 | + }else { |
|
269 | 269 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
270 | 270 | } |
271 | 271 | |
272 | - if(class_exists($default_config['attachment'])) { |
|
272 | + if (class_exists($default_config['attachment'])) { |
|
273 | 273 | $this->default_attachment_mask = $default_config['attachment']; |
274 | - }else{ |
|
274 | + }else { |
|
275 | 275 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
276 | 276 | } |
277 | 277 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $this->connection = new ImapProtocol($this->validate_cert, $this->encryption); |
336 | 336 | $this->connection->setConnectionTimeout($this->timeout); |
337 | 337 | $this->connection->setProxy($this->proxy); |
338 | - }else{ |
|
338 | + }else { |
|
339 | 339 | if (extension_loaded('imap') === false) { |
340 | 340 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
341 | 341 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | // Set delimiter to false to force selection via getFolderByName (maybe useful for uncommon folder names) |
410 | 410 | $delimiter = is_null($delimiter) ? ClientManager::get('options.delimiter', "/") : $delimiter; |
411 | - if (strpos($folder_name, (string)$delimiter) !== false) { |
|
411 | + if (strpos($folder_name, (string) $delimiter) !== false) { |
|
412 | 412 | return $this->getFolderByPath($folder_name); |
413 | 413 | } |
414 | 414 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
461 | 461 | $items = $this->connection->folders('', $pattern); |
462 | 462 | |
463 | - if(is_array($items)){ |
|
463 | + if (is_array($items)) { |
|
464 | 464 | foreach ($items as $folder_name => $item) { |
465 | 465 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
466 | 466 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | |
477 | 477 | return $folders; |
478 | - }else{ |
|
478 | + }else { |
|
479 | 479 | throw new FolderFetchingException("failed to fetch any folders"); |
480 | 480 | } |
481 | 481 | } |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | $this->checkConnection(); |
514 | 514 | $status = $this->connection->createFolder($folder); |
515 | 515 | |
516 | - if($expunge) $this->expunge(); |
|
516 | + if ($expunge) $this->expunge(); |
|
517 | 517 | |
518 | 518 | $folder = $this->getFolder($folder); |
519 | - if($status && $folder) { |
|
519 | + if ($status && $folder) { |
|
520 | 520 | $event = $this->getEvent("folder", "new"); |
521 | 521 | $event::dispatch($folder); |
522 | 522 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | * |
543 | 543 | * @return string |
544 | 544 | */ |
545 | - public function getFolderPath(){ |
|
545 | + public function getFolderPath() { |
|
546 | 546 | return $this->active_folder; |
547 | 547 | } |
548 | 548 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | * @return int |
601 | 601 | * @throws ConnectionFailedException |
602 | 602 | */ |
603 | - public function getTimeout(){ |
|
603 | + public function getTimeout() { |
|
604 | 604 | $this->checkConnection(); |
605 | 605 | return $this->connection->getConnectionTimeout(); |
606 | 606 | } |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | * |
611 | 611 | * @return string |
612 | 612 | */ |
613 | - public function getDefaultMessageMask(){ |
|
613 | + public function getDefaultMessageMask() { |
|
614 | 614 | return $this->default_message_mask; |
615 | 615 | } |
616 | 616 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | * |
621 | 621 | * @return array |
622 | 622 | */ |
623 | - public function getDefaultEvents($section){ |
|
623 | + public function getDefaultEvents($section) { |
|
624 | 624 | return $this->events[$section]; |
625 | 625 | } |
626 | 626 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @throws MaskNotFoundException |
633 | 633 | */ |
634 | 634 | public function setDefaultMessageMask($mask) { |
635 | - if(class_exists($mask)) { |
|
635 | + if (class_exists($mask)) { |
|
636 | 636 | $this->default_message_mask = $mask; |
637 | 637 | |
638 | 638 | return $this; |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * |
647 | 647 | * @return string |
648 | 648 | */ |
649 | - public function getDefaultAttachmentMask(){ |
|
649 | + public function getDefaultAttachmentMask() { |
|
650 | 650 | return $this->default_attachment_mask; |
651 | 651 | } |
652 | 652 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * @throws MaskNotFoundException |
659 | 659 | */ |
660 | 660 | public function setDefaultAttachmentMask($mask) { |
661 | - if(class_exists($mask)) { |
|
661 | + if (class_exists($mask)) { |
|
662 | 662 | $this->default_attachment_mask = $mask; |
663 | 663 | |
664 | 664 | return $this; |