@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $this->part_number = $part->part_number; |
95 | 95 | |
96 | 96 | $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask(); |
97 | - if($default_mask != null) { |
|
97 | + if ($default_mask != null) { |
|
98 | 98 | $this->mask = $default_mask; |
99 | 99 | } |
100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function __call(string $method, array $arguments) { |
114 | 114 | if (strtolower(substr($method, 0, 3)) === 'get') { |
115 | 115 | $name = Str::snake(substr($method, 3)); |
116 | - if(isset($this->attributes[$name])) { |
|
116 | + if (isset($this->attributes[$name])) { |
|
117 | 117 | return $this->attributes[$name]; |
118 | 118 | } |
119 | 119 | return null; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return mixed|null |
148 | 148 | */ |
149 | 149 | public function __get($name) { |
150 | - if(isset($this->attributes[$name])) { |
|
150 | + if (isset($this->attributes[$name])) { |
|
151 | 151 | return $this->attributes[$name]; |
152 | 152 | } |
153 | 153 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->part->type) { |
218 | 218 | if ($this->part->ifdescription) { |
219 | 219 | $this->setName($this->part->description); |
220 | - } else { |
|
220 | + }else { |
|
221 | 221 | $this->setName($this->part->subtype); |
222 | 222 | } |
223 | 223 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | public function setName($name): void { |
244 | 244 | $decoder = $this->config['decoder']['attachment']; |
245 | 245 | if ($name !== null) { |
246 | - if($decoder === 'utf-8' && extension_loaded('imap')) { |
|
246 | + if ($decoder === 'utf-8' && extension_loaded('imap')) { |
|
247 | 247 | $this->name = \imap_utf8($name); |
248 | - }else{ |
|
248 | + }else { |
|
249 | 249 | $this->name = mb_decode_mimeheader($name); |
250 | 250 | } |
251 | 251 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return string|false |
258 | 258 | */ |
259 | - public function getMimeType(){ |
|
259 | + public function getMimeType() { |
|
260 | 260 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
261 | 261 | } |
262 | 262 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function getExtension(): ?string{ |
269 | 269 | $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser"; |
270 | - if (class_exists($deprecated_guesser) !== false){ |
|
270 | + if (class_exists($deprecated_guesser) !== false) { |
|
271 | 271 | /** @var \Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser $deprecated_guesser */ |
272 | 272 | return $deprecated_guesser::getInstance()->guess($this->getMimeType()); |
273 | 273 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @return $this |
301 | 301 | */ |
302 | 302 | public function setMask(string $mask): self { |
303 | - if(class_exists($mask)){ |
|
303 | + if (class_exists($mask)) { |
|
304 | 304 | $this->mask = $mask; |
305 | 305 | } |
306 | 306 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function mask($mask = null): object { |
327 | 327 | $mask ??= $this->mask; |
328 | - if(class_exists($mask)){ |
|
328 | + if (class_exists($mask)) { |
|
329 | 329 | return new $mask($this); |
330 | 330 | } |
331 | 331 |
@@ -33,11 +33,11 @@ |
||
33 | 33 | * @param object $object |
34 | 34 | */ |
35 | 35 | public function __construct($object) { |
36 | - if (property_exists($object, "personal")){ $this->personal = $object->personal; } |
|
37 | - if (property_exists($object, "mailbox")){ $this->mailbox = $object->mailbox; } |
|
38 | - if (property_exists($object, "host")){ $this->host = $object->host; } |
|
39 | - if (property_exists($object, "mail")){ $this->mail = $object->mail; } |
|
40 | - if (property_exists($object, "full")){ $this->full = $object->full; } |
|
36 | + if (property_exists($object, "personal")) { $this->personal = $object->personal; } |
|
37 | + if (property_exists($object, "mailbox")) { $this->mailbox = $object->mailbox; } |
|
38 | + if (property_exists($object, "host")) { $this->host = $object->host; } |
|
39 | + if (property_exists($object, "mail")) { $this->mail = $object->mail; } |
|
40 | + if (property_exists($object, "full")) { $this->full = $object->full; } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private function setAccountConfig(string $key, array $config, array $default_config): void { |
205 | 205 | $value = $this->default_account_config[$key]; |
206 | - if(isset($config[$key])) { |
|
206 | + if (isset($config[$key])) { |
|
207 | 207 | $value = $config[$key]; |
208 | - }elseif(isset($default_config[$key])) { |
|
208 | + }elseif (isset($default_config[$key])) { |
|
209 | 209 | $value = $default_config[$key]; |
210 | 210 | } |
211 | 211 | $this->$key = $value; |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | */ |
218 | 218 | protected function setEventsFromConfig($config): void { |
219 | 219 | $events = ClientManager::get("events"); |
220 | - if(isset($config['events'])){ |
|
221 | - foreach($config['events'] as $section => $events) { |
|
220 | + if (isset($config['events'])) { |
|
221 | + foreach ($config['events'] as $section => $events) { |
|
222 | 222 | $events[$section] = array_merge($events[$section], $events); |
223 | 223 | } |
224 | 224 | } |
@@ -232,45 +232,45 @@ discard block |
||
232 | 232 | * @throws MaskNotFoundException |
233 | 233 | */ |
234 | 234 | protected function setMaskFromConfig($config): void { |
235 | - $default_config = ClientManager::get("masks"); |
|
235 | + $default_config = ClientManager::get("masks"); |
|
236 | 236 | |
237 | - if(isset($config['masks'])){ |
|
238 | - if(isset($config['masks']['message'])) { |
|
239 | - if(class_exists($config['masks']['message'])) { |
|
237 | + if (isset($config['masks'])) { |
|
238 | + if (isset($config['masks']['message'])) { |
|
239 | + if (class_exists($config['masks']['message'])) { |
|
240 | 240 | $this->default_message_mask = $config['masks']['message']; |
241 | - }else{ |
|
241 | + }else { |
|
242 | 242 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['message']); |
243 | 243 | } |
244 | - }else{ |
|
245 | - if(class_exists($default_config['message'])) { |
|
244 | + }else { |
|
245 | + if (class_exists($default_config['message'])) { |
|
246 | 246 | $this->default_message_mask = $default_config['message']; |
247 | - }else{ |
|
247 | + }else { |
|
248 | 248 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
249 | 249 | } |
250 | 250 | } |
251 | - if(isset($config['masks']['attachment'])) { |
|
252 | - if(class_exists($config['masks']['attachment'])) { |
|
251 | + if (isset($config['masks']['attachment'])) { |
|
252 | + if (class_exists($config['masks']['attachment'])) { |
|
253 | 253 | $this->default_attachment_mask = $config['masks']['attachment']; |
254 | - }else{ |
|
254 | + }else { |
|
255 | 255 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
256 | 256 | } |
257 | - }else{ |
|
258 | - if(class_exists($default_config['attachment'])) { |
|
257 | + }else { |
|
258 | + if (class_exists($default_config['attachment'])) { |
|
259 | 259 | $this->default_attachment_mask = $default_config['attachment']; |
260 | - }else{ |
|
260 | + }else { |
|
261 | 261 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
262 | 262 | } |
263 | 263 | } |
264 | - }else{ |
|
265 | - if(class_exists($default_config['message'])) { |
|
264 | + }else { |
|
265 | + if (class_exists($default_config['message'])) { |
|
266 | 266 | $this->default_message_mask = $default_config['message']; |
267 | - }else{ |
|
267 | + }else { |
|
268 | 268 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['message']); |
269 | 269 | } |
270 | 270 | |
271 | - if(class_exists($default_config['attachment'])) { |
|
271 | + if (class_exists($default_config['attachment'])) { |
|
272 | 272 | $this->default_attachment_mask = $default_config['attachment']; |
273 | - }else{ |
|
273 | + }else { |
|
274 | 274 | throw new MaskNotFoundException("Unknown mask provided: ".$default_config['attachment']); |
275 | 275 | } |
276 | 276 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $this->connection = new ImapProtocol($this->validate_cert, $this->encryption); |
335 | 335 | $this->connection->setConnectionTimeout($this->timeout); |
336 | 336 | $this->connection->setProxy($this->proxy); |
337 | - }else{ |
|
337 | + }else { |
|
338 | 338 | if (extension_loaded('imap') === false) { |
339 | 339 | throw new ConnectionFailedException("connection setup failed", 0, new ProtocolNotSupportedException($protocol." is an unsupported protocol")); |
340 | 340 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | |
356 | 356 | try { |
357 | 357 | $this->connection->connect($this->host, $this->port); |
358 | - } catch (ErrorException|Exceptions\RuntimeException $e) { |
|
358 | + } catch (ErrorException | Exceptions\RuntimeException $e) { |
|
359 | 359 | throw new ConnectionFailedException("connection setup failed", 0, $e); |
360 | 360 | } |
361 | 361 | $this->authenticate(); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | // Set delimiter to false to force selection via getFolderByName (maybe useful for uncommon folder names) |
415 | 415 | $delimiter = is_null($delimiter) ? ClientManager::get('options.delimiter', "/") : $delimiter; |
416 | - if (strpos($folder_name, (string)$delimiter) !== false) { |
|
416 | + if (strpos($folder_name, (string) $delimiter) !== false) { |
|
417 | 417 | return $this->getFolderByPath($folder_name); |
418 | 418 | } |
419 | 419 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
466 | 466 | $items = $this->connection->folders('', $pattern); |
467 | 467 | |
468 | - if(is_array($items)){ |
|
468 | + if (is_array($items)) { |
|
469 | 469 | foreach ($items as $folder_name => $item) { |
470 | 470 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
471 | 471 | |
@@ -517,10 +517,10 @@ discard block |
||
517 | 517 | $this->checkConnection(); |
518 | 518 | $status = $this->connection->createFolder($folder); |
519 | 519 | |
520 | - if($expunge) $this->expunge(); |
|
520 | + if ($expunge) $this->expunge(); |
|
521 | 521 | |
522 | 522 | $folder = $this->getFolder($folder); |
523 | - if($status && $folder) { |
|
523 | + if ($status && $folder) { |
|
524 | 524 | $event = $this->getEvent("folder", "new"); |
525 | 525 | $event::dispatch($folder); |
526 | 526 | } |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * @throws MaskNotFoundException |
649 | 649 | */ |
650 | 650 | public function setDefaultMessageMask(string $mask): self { |
651 | - if(class_exists($mask)) { |
|
651 | + if (class_exists($mask)) { |
|
652 | 652 | $this->default_message_mask = $mask; |
653 | 653 | |
654 | 654 | return $this; |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @throws MaskNotFoundException |
675 | 675 | */ |
676 | 676 | public function setDefaultAttachmentMask(string $mask): self { |
677 | - if(class_exists($mask)) { |
|
677 | + if (class_exists($mask)) { |
|
678 | 678 | $this->default_attachment_mask = $mask; |
679 | 679 | |
680 | 680 | return $this; |
@@ -44,9 +44,9 @@ |
||
44 | 44 | * @param array<string, array<string, string>> $events |
45 | 45 | */ |
46 | 46 | public function setEvents($events): void { |
47 | - foreach($events as $section => $sectionEvents) { |
|
47 | + foreach ($events as $section => $sectionEvents) { |
|
48 | 48 | assert(is_string($section)); |
49 | - foreach($sectionEvents as $event => $class) { |
|
49 | + foreach ($sectionEvents as $event => $class) { |
|
50 | 50 | assert(is_string($event)); |
51 | 51 | assert(is_string($class) && is_a($class, Event::class, true)); |
52 | 52 | } |