@@ -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> |
@@ -31,11 +31,14 @@ |
||
| 31 | 31 | <td><?php echo $folder->search()->unseen()->setFetchBody(false)->count(); ?></td> |
| 32 | 32 | </tr> |
| 33 | 33 | <?php endforeach; ?> |
| 34 | - <?php else: ?> |
|
| 34 | + <?php else { |
|
| 35 | + : ?> |
|
| 35 | 36 | <tr> |
| 36 | 37 | <td colspan="4">No folders found</td> |
| 37 | 38 | </tr> |
| 38 | - <?php endif; ?> |
|
| 39 | + <?php endif; |
|
| 40 | +} |
|
| 41 | +?> |
|
| 39 | 42 | </tbody> |
| 40 | 43 | </table> |
| 41 | 44 | |
@@ -121,7 +121,7 @@ |
||
| 121 | 121 | protected function parse(){ |
| 122 | 122 | if ($this->header === null) { |
| 123 | 123 | $body = $this->findHeaders(); |
| 124 | - }else{ |
|
| 124 | + } else{ |
|
| 125 | 125 | $body = $this->raw; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @throws InvalidMessageDateException |
| 161 | 161 | */ |
| 162 | - protected function parse(){ |
|
| 162 | + protected function parse() { |
|
| 163 | 163 | if ($this->header === null) { |
| 164 | 164 | $body = $this->findHeaders(); |
| 165 | - }else{ |
|
| 165 | + }else { |
|
| 166 | 166 | $body = $this->raw; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | $this->name = $this->header->get("name"); |
| 175 | 175 | $this->filename = $this->header->get("filename"); |
| 176 | 176 | |
| 177 | - if(!empty($this->header->get("id"))) { |
|
| 177 | + if (!empty($this->header->get("id"))) { |
|
| 178 | 178 | $this->id = $this->header->get("id"); |
| 179 | - } else if(!empty($this->header->get("x_attachment_id"))){ |
|
| 179 | + }else if (!empty($this->header->get("x_attachment_id"))) { |
|
| 180 | 180 | $this->id = $this->header->get("x_attachment_id"); |
| 181 | - } else if(!empty($this->header->get("content_id"))){ |
|
| 181 | + }else if (!empty($this->header->get("content_id"))) { |
|
| 182 | 182 | $this->id = strtr($this->header->get("content_id"), [ |
| 183 | 183 | '<' => '', |
| 184 | 184 | '>' => '' |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | $content_types = $this->header->get("content_type"); |
| 189 | - if(!empty($content_types)){ |
|
| 189 | + if (!empty($content_types)) { |
|
| 190 | 190 | $this->subtype = $this->parseSubtype($content_types); |
| 191 | 191 | $content_type = $content_types; |
| 192 | 192 | if (is_array($content_types)) { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @return string |
| 208 | 208 | * @throws InvalidMessageDateException |
| 209 | 209 | */ |
| 210 | - private function findHeaders(){ |
|
| 210 | + private function findHeaders() { |
|
| 211 | 211 | $body = $this->raw; |
| 212 | 212 | while (($pos = strpos($body, "\r\n")) > 0) { |
| 213 | 213 | $body = substr($body, $pos + 2); |
@@ -226,16 +226,16 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @return string |
| 228 | 228 | */ |
| 229 | - private function parseSubtype($content_type){ |
|
| 229 | + private function parseSubtype($content_type) { |
|
| 230 | 230 | if (is_array($content_type)) { |
| 231 | - foreach ($content_type as $part){ |
|
| 232 | - if ((strpos($part, "/")) !== false){ |
|
| 231 | + foreach ($content_type as $part) { |
|
| 232 | + if ((strpos($part, "/")) !== false) { |
|
| 233 | 233 | return $this->parseSubtype($part); |
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | return null; |
| 237 | 237 | } |
| 238 | - if (($pos = strpos($content_type, "/")) !== false){ |
|
| 238 | + if (($pos = strpos($content_type, "/")) !== false) { |
|
| 239 | 239 | return substr($content_type, $pos + 1); |
| 240 | 240 | } |
| 241 | 241 | return null; |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | /** |
| 245 | 245 | * Try to parse the disposition if any is present |
| 246 | 246 | */ |
| 247 | - private function parseDisposition(){ |
|
| 247 | + private function parseDisposition() { |
|
| 248 | 248 | $content_disposition = $this->header->get("content_disposition"); |
| 249 | - if($content_disposition !== null) { |
|
| 249 | + if ($content_disposition !== null) { |
|
| 250 | 250 | $this->ifdisposition = true; |
| 251 | 251 | $this->disposition = (is_array($content_disposition)) ? implode(' ', $content_disposition) : $content_disposition; |
| 252 | 252 | } |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | /** |
| 256 | 256 | * Try to parse the description if any is present |
| 257 | 257 | */ |
| 258 | - private function parseDescription(){ |
|
| 258 | + private function parseDescription() { |
|
| 259 | 259 | $content_description = $this->header->get("content_description"); |
| 260 | - if($content_description !== null) { |
|
| 260 | + if ($content_description !== null) { |
|
| 261 | 261 | $this->ifdescription = true; |
| 262 | 262 | $this->description = $content_description; |
| 263 | 263 | } |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | /** |
| 267 | 267 | * Try to parse the encoding if any is present |
| 268 | 268 | */ |
| 269 | - private function parseEncoding(){ |
|
| 269 | + private function parseEncoding() { |
|
| 270 | 270 | $encoding = $this->header->get("content_transfer_encoding"); |
| 271 | - if($encoding !== null) { |
|
| 271 | + if ($encoding !== null) { |
|
| 272 | 272 | switch (strtolower($encoding)) { |
| 273 | 273 | case "quoted-printable": |
| 274 | 274 | $this->encoding = IMAP::MESSAGE_ENC_QUOTED_PRINTABLE; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | * |
| 299 | 299 | * @return bool |
| 300 | 300 | */ |
| 301 | - public function isAttachment(){ |
|
| 301 | + public function isAttachment() { |
|
| 302 | 302 | $valid_disposition = in_array(strtolower($this->disposition), ClientManager::get('options.dispositions')); |
| 303 | 303 | |
| 304 | 304 | if ($this->type == IMAP::MESSAGE_TYPE_TEXT && ($this->ifdisposition == 0 || (empty($this->disposition))) && !$valid_disposition) { |
@@ -252,7 +252,7 @@ |
||
| 252 | 252 | */ |
| 253 | 253 | public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){ |
| 254 | 254 | if ( |
| 255 | - $page === null |
|
| 255 | + $page === null |
|
| 256 | 256 | && isset($_GET[$page_name]) |
| 257 | 257 | && $_GET[$page_name] > 0 |
| 258 | 258 | ) { |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | $this->setClient($client); |
| 81 | 81 | |
| 82 | 82 | $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN); |
| 83 | - if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
| 83 | + if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) { |
|
| 84 | + $this->leaveUnread(); |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | if (ClientManager::get('options.fetch_order') === 'desc') { |
| 86 | 88 | $this->fetch_order = 'desc'; |
@@ -124,7 +126,9 @@ discard block |
||
| 124 | 126 | * @throws MessageSearchValidationException |
| 125 | 127 | */ |
| 126 | 128 | protected function parse_date($date) { |
| 127 | - if($date instanceof \Carbon\Carbon) return $date; |
|
| 129 | + if($date instanceof \Carbon\Carbon) { |
|
| 130 | + return $date; |
|
| 131 | + } |
|
| 128 | 132 | |
| 129 | 133 | try { |
| 130 | 134 | $date = Carbon::parse($date); |
@@ -322,7 +326,7 @@ discard block |
||
| 322 | 326 | } else { |
| 323 | 327 | if($statement[1] === null){ |
| 324 | 328 | $query .= $statement[0]; |
| 325 | - }else{ |
|
| 329 | + } else{ |
|
| 326 | 330 | $query .= $statement[0].' "'.$statement[1].'"'; |
| 327 | 331 | } |
| 328 | 332 | } |
@@ -352,7 +356,9 @@ discard block |
||
| 352 | 356 | * @return $this |
| 353 | 357 | */ |
| 354 | 358 | public function limit($limit, $page = 1) { |
| 355 | - if($page >= 1) $this->page = $page; |
|
| 359 | + if($page >= 1) { |
|
| 360 | + $this->page = $page; |
|
| 361 | + } |
|
| 356 | 362 | $this->limit = $limit; |
| 357 | 363 | |
| 358 | 364 | return $this; |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | $this->setClient($client); |
| 81 | 81 | |
| 82 | 82 | $this->sequence = ClientManager::get('options.sequence', IMAP::ST_MSGN); |
| 83 | - if(ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
| 83 | + if (ClientManager::get('options.fetch') === IMAP::FT_PEEK) $this->leaveUnread(); |
|
| 84 | 84 | |
| 85 | 85 | if (ClientManager::get('options.fetch_order') === 'desc') { |
| 86 | 86 | $this->fetch_order = 'desc'; |
| 87 | - } else { |
|
| 87 | + }else { |
|
| 88 | 88 | $this->fetch_order = 'asc'; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * Instance boot method for additional functionality |
| 100 | 100 | */ |
| 101 | - protected function boot(){} |
|
| 101 | + protected function boot() {} |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * Parse a given value |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return string |
| 108 | 108 | */ |
| 109 | - protected function parse_value($value){ |
|
| 110 | - switch(true){ |
|
| 109 | + protected function parse_value($value) { |
|
| 110 | + switch (true) { |
|
| 111 | 111 | case $value instanceof \Carbon\Carbon: |
| 112 | 112 | $value = $value->format($this->date_format); |
| 113 | 113 | break; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @throws MessageSearchValidationException |
| 125 | 125 | */ |
| 126 | 126 | protected function parse_date($date) { |
| 127 | - if($date instanceof \Carbon\Carbon) return $date; |
|
| 127 | + if ($date instanceof \Carbon\Carbon) return $date; |
|
| 128 | 128 | |
| 129 | 129 | try { |
| 130 | 130 | $date = Carbon::parse($date); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @return Collection |
| 176 | 176 | * @throws GetMessagesFailedException |
| 177 | 177 | */ |
| 178 | - protected function search(){ |
|
| 178 | + protected function search() { |
|
| 179 | 179 | $this->generate_query(); |
| 180 | 180 | |
| 181 | 181 | try { |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $raw_flag = isset($raw_flags[$uid]) ? $raw_flags[$uid] : []; |
| 241 | 241 | |
| 242 | 242 | $message = Message::make($uid, $msglist, $this->getClient(), $raw_header, $raw_content, $raw_flag, $this->getFetchOptions(), $this->sequence); |
| 243 | - switch ($message_key){ |
|
| 243 | + switch ($message_key) { |
|
| 244 | 244 | case 'number': |
| 245 | 245 | $key = $message->getMessageNo(); |
| 246 | 246 | break; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | return $messages; |
| 264 | 264 | } catch (\Exception $e) { |
| 265 | - throw new GetMessagesFailedException($e->getMessage(),0, $e); |
|
| 265 | + throw new GetMessagesFailedException($e->getMessage(), 0, $e); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException |
| 282 | 282 | * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException |
| 283 | 283 | */ |
| 284 | - public function getMessage($uid, $msglist = null, $sequence = null){ |
|
| 284 | + public function getMessage($uid, $msglist = null, $sequence = null) { |
|
| 285 | 285 | return new Message($uid, $msglist, $this->getClient(), $this->getFetchOptions(), $this->getFetchBody(), $this->getFetchFlags(), $sequence ? $sequence : $this->sequence); |
| 286 | 286 | } |
| 287 | 287 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException |
| 300 | 300 | * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException |
| 301 | 301 | */ |
| 302 | - public function getMessageByMsgn($msgn, $msglist = null){ |
|
| 302 | + public function getMessageByMsgn($msgn, $msglist = null) { |
|
| 303 | 303 | return $this->getMessage($msgn, $msglist, IMAP::ST_MSGN); |
| 304 | 304 | } |
| 305 | 305 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException |
| 317 | 317 | * @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException |
| 318 | 318 | */ |
| 319 | - public function getMessageByUid($uid){ |
|
| 319 | + public function getMessageByUid($uid) { |
|
| 320 | 320 | return $this->getMessage($uid, null, IMAP::ST_UID); |
| 321 | 321 | } |
| 322 | 322 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @return LengthAwarePaginator |
| 330 | 330 | * @throws GetMessagesFailedException |
| 331 | 331 | */ |
| 332 | - public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){ |
|
| 332 | + public function paginate($per_page = 5, $page = null, $page_name = 'imap_page') { |
|
| 333 | 333 | if ( |
| 334 | 334 | $page === null |
| 335 | 335 | && isset($_GET[$page_name]) |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | $this->query->each(function($statement) use(&$query) { |
| 356 | 356 | if (count($statement) == 1) { |
| 357 | 357 | $query .= $statement[0]; |
| 358 | - } else { |
|
| 359 | - if($statement[1] === null){ |
|
| 358 | + }else { |
|
| 359 | + if ($statement[1] === null) { |
|
| 360 | 360 | $query .= $statement[0]; |
| 361 | - }else{ |
|
| 361 | + }else { |
|
| 362 | 362 | $query .= $statement[0].' "'.$statement[1].'"'; |
| 363 | 363 | } |
| 364 | 364 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * @return $this |
| 389 | 389 | */ |
| 390 | 390 | public function limit($limit, $page = 1) { |
| 391 | - if($page >= 1) $this->page = $page; |
|
| 391 | + if ($page >= 1) $this->page = $page; |
|
| 392 | 392 | $this->limit = $limit; |
| 393 | 393 | |
| 394 | 394 | return $this; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $this->part_number = $part->part_number; |
| 105 | 105 | |
| 106 | 106 | $default_mask = $this->oMessage->getClient()->getDefaultAttachmentMask(); |
| 107 | - if($default_mask != null) { |
|
| 107 | + if ($default_mask != null) { |
|
| 108 | 108 | $this->mask = $default_mask; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | * @throws MethodNotFoundException |
| 122 | 122 | */ |
| 123 | 123 | public function __call($method, $arguments) { |
| 124 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 124 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 125 | 125 | $name = Str::snake(substr($method, 3)); |
| 126 | 126 | |
| 127 | - if(isset($this->attributes[$name])) { |
|
| 127 | + if (isset($this->attributes[$name])) { |
|
| 128 | 128 | return $this->attributes[$name]; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @return mixed|null |
| 161 | 161 | */ |
| 162 | 162 | public function __get($name) { |
| 163 | - if(isset($this->attributes[$name])) { |
|
| 163 | + if (isset($this->attributes[$name])) { |
|
| 164 | 164 | return $this->attributes[$name]; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -223,14 +223,14 @@ discard block |
||
| 223 | 223 | $this->setName($name); |
| 224 | 224 | }elseif (($filename = $this->part->filename) !== null) { |
| 225 | 225 | $this->setName($filename); |
| 226 | - } else { |
|
| 226 | + }else { |
|
| 227 | 227 | $this->setName("undefined"); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->part->type) { |
| 231 | 231 | if ($this->part->ifdescription) { |
| 232 | 232 | $this->setName($this->part->description); |
| 233 | - } else { |
|
| 233 | + }else { |
|
| 234 | 234 | $this->setName($this->part->subtype); |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | public function setName($name) { |
| 257 | 257 | $decoder = $this->config['decoder']['attachment']; |
| 258 | 258 | if ($name !== null) { |
| 259 | - if($decoder === 'utf-8' && extension_loaded('imap')) { |
|
| 259 | + if ($decoder === 'utf-8' && extension_loaded('imap')) { |
|
| 260 | 260 | $this->name = \imap_utf8($name); |
| 261 | - }else{ |
|
| 261 | + }else { |
|
| 262 | 262 | $this->name = mb_decode_mimeheader($name); |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return string|null |
| 271 | 271 | */ |
| 272 | - public function getMimeType(){ |
|
| 272 | + public function getMimeType() { |
|
| 273 | 273 | return (new \finfo())->buffer($this->getContent(), FILEINFO_MIME_TYPE); |
| 274 | 274 | } |
| 275 | 275 | |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @return string|null |
| 280 | 280 | */ |
| 281 | - public function getExtension(){ |
|
| 281 | + public function getExtension() { |
|
| 282 | 282 | $deprecated_guesser = "\Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser"; |
| 283 | - if (class_exists($deprecated_guesser) !== false){ |
|
| 283 | + if (class_exists($deprecated_guesser) !== false) { |
|
| 284 | 284 | return $deprecated_guesser::getInstance()->guess($this->getMimeType()); |
| 285 | 285 | } |
| 286 | 286 | $guesser = "\Symfony\Component\Mime\MimeTypes"; |
@@ -293,14 +293,14 @@ discard block |
||
| 293 | 293 | * |
| 294 | 294 | * @return array |
| 295 | 295 | */ |
| 296 | - public function getAttributes(){ |
|
| 296 | + public function getAttributes() { |
|
| 297 | 297 | return $this->attributes; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** |
| 301 | 301 | * @return Message |
| 302 | 302 | */ |
| 303 | - public function getMessage(){ |
|
| 303 | + public function getMessage() { |
|
| 304 | 304 | return $this->oMessage; |
| 305 | 305 | } |
| 306 | 306 | |
@@ -310,8 +310,8 @@ discard block |
||
| 310 | 310 | * |
| 311 | 311 | * @return $this |
| 312 | 312 | */ |
| 313 | - public function setMask($mask){ |
|
| 314 | - if(class_exists($mask)){ |
|
| 313 | + public function setMask($mask) { |
|
| 314 | + if (class_exists($mask)) { |
|
| 315 | 315 | $this->mask = $mask; |
| 316 | 316 | } |
| 317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * |
| 324 | 324 | * @return string |
| 325 | 325 | */ |
| 326 | - public function getMask(){ |
|
| 326 | + public function getMask() { |
|
| 327 | 327 | return $this->mask; |
| 328 | 328 | } |
| 329 | 329 | |
@@ -334,9 +334,9 @@ discard block |
||
| 334 | 334 | * @return mixed |
| 335 | 335 | * @throws MaskNotFoundException |
| 336 | 336 | */ |
| 337 | - public function mask($mask = null){ |
|
| 337 | + public function mask($mask = null) { |
|
| 338 | 338 | $mask = $mask !== null ? $mask : $this->mask; |
| 339 | - if(class_exists($mask)){ |
|
| 339 | + if (class_exists($mask)) { |
|
| 340 | 340 | return new $mask($this); |
| 341 | 341 | } |
| 342 | 342 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | return null; |
| 132 | - }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 132 | + } elseif (strtolower(substr($method, 0, 3)) === 'set') { |
|
| 133 | 133 | $name = Str::snake(substr($method, 3)); |
| 134 | 134 | |
| 135 | 135 | $this->attributes[$name] = array_pop($arguments); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | if (($name = $this->part->name) !== null) { |
| 223 | 223 | $this->setName($name); |
| 224 | - }elseif (($filename = $this->part->filename) !== null) { |
|
| 224 | + } elseif (($filename = $this->part->filename) !== null) { |
|
| 225 | 225 | $this->setName($filename); |
| 226 | 226 | } else { |
| 227 | 227 | $this->setName("undefined"); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | if ($name !== null) { |
| 259 | 259 | if($decoder === 'utf-8' && extension_loaded('imap')) { |
| 260 | 260 | $this->name = \imap_utf8($name); |
| 261 | - }else{ |
|
| 261 | + } else{ |
|
| 262 | 262 | $this->name = mb_decode_mimeheader($name); |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -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 | } |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | * @param array $config |
| 202 | 202 | * @param array $default_config |
| 203 | 203 | */ |
| 204 | - private function setAccountConfig($key, $config, $default_config){ |
|
| 204 | + private function setAccountConfig($key, $config, $default_config) { |
|
| 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,9 +217,9 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | protected function setEventsFromConfig($config) { |
| 219 | 219 | $this->events = ClientManager::get("events"); |
| 220 | - if(isset($config['events'])){ |
|
| 221 | - if(isset($config['events'])) { |
|
| 222 | - foreach($config['events'] as $section => $events) { |
|
| 220 | + if (isset($config['events'])) { |
|
| 221 | + if (isset($config['events'])) { |
|
| 222 | + foreach ($config['events'] as $section => $events) { |
|
| 223 | 223 | $this->events[$section] = array_merge($this->events[$section], $events); |
| 224 | 224 | } |
| 225 | 225 | } |
@@ -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_message_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_message_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_message_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 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | $pattern = $parent_folder.($hierarchical ? '%' : '*'); |
| 459 | 459 | $items = $this->connection->folders('', $pattern); |
| 460 | 460 | |
| 461 | - if(is_array($items)){ |
|
| 461 | + if (is_array($items)) { |
|
| 462 | 462 | foreach ($items as $folder_name => $item) { |
| 463 | 463 | $folder = new Folder($this, $folder_name, $item["delimiter"], $item["flags"]); |
| 464 | 464 | |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | return $folders; |
| 476 | - }else{ |
|
| 476 | + }else { |
|
| 477 | 477 | throw new FolderFetchingException("failed to fetch any folders"); |
| 478 | 478 | } |
| 479 | 479 | } |
@@ -511,10 +511,10 @@ discard block |
||
| 511 | 511 | $this->checkConnection(); |
| 512 | 512 | $status = $this->connection->createFolder($folder); |
| 513 | 513 | |
| 514 | - if($expunge) $this->expunge(); |
|
| 514 | + if ($expunge) $this->expunge(); |
|
| 515 | 515 | |
| 516 | 516 | $folder = $this->getFolder($folder); |
| 517 | - if($status && $folder) { |
|
| 517 | + if ($status && $folder) { |
|
| 518 | 518 | $event = $this->getEvent("folder", "new"); |
| 519 | 519 | $event::dispatch($folder); |
| 520 | 520 | } |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | * |
| 541 | 541 | * @return Folder |
| 542 | 542 | */ |
| 543 | - public function getFolderPath(){ |
|
| 543 | + public function getFolderPath() { |
|
| 544 | 544 | return $this->active_folder; |
| 545 | 545 | } |
| 546 | 546 | |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * |
| 597 | 597 | * @return int |
| 598 | 598 | */ |
| 599 | - public function getTimeout($type){ |
|
| 599 | + public function getTimeout($type) { |
|
| 600 | 600 | return $this->connection->getConnectionTimeout(); |
| 601 | 601 | } |
| 602 | 602 | |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | * |
| 606 | 606 | * @return string |
| 607 | 607 | */ |
| 608 | - public function getDefaultMessageMask(){ |
|
| 608 | + public function getDefaultMessageMask() { |
|
| 609 | 609 | return $this->default_message_mask; |
| 610 | 610 | } |
| 611 | 611 | |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | * |
| 616 | 616 | * @return array |
| 617 | 617 | */ |
| 618 | - public function getDefaultEvents($section){ |
|
| 618 | + public function getDefaultEvents($section) { |
|
| 619 | 619 | return $this->events[$section]; |
| 620 | 620 | } |
| 621 | 621 | |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | * @throws MaskNotFoundException |
| 628 | 628 | */ |
| 629 | 629 | public function setDefaultMessageMask($mask) { |
| 630 | - if(class_exists($mask)) { |
|
| 630 | + if (class_exists($mask)) { |
|
| 631 | 631 | $this->default_message_mask = $mask; |
| 632 | 632 | |
| 633 | 633 | return $this; |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | * |
| 642 | 642 | * @return string |
| 643 | 643 | */ |
| 644 | - public function getDefaultAttachmentMask(){ |
|
| 644 | + public function getDefaultAttachmentMask() { |
|
| 645 | 645 | return $this->default_attachment_mask; |
| 646 | 646 | } |
| 647 | 647 | |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | * @throws MaskNotFoundException |
| 654 | 654 | */ |
| 655 | 655 | public function setDefaultAttachmentMask($mask) { |
| 656 | - if(class_exists($mask)) { |
|
| 656 | + if (class_exists($mask)) { |
|
| 657 | 657 | $this->default_attachment_mask = $mask; |
| 658 | 658 | |
| 659 | 659 | return $this; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $value = $this->default_account_config[$key]; |
| 206 | 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; |
@@ -239,39 +239,39 @@ discard block |
||
| 239 | 239 | if(isset($config['masks']['message'])) { |
| 240 | 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{ |
|
| 245 | + } else{ |
|
| 246 | 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 | 252 | if(isset($config['masks']['attachment'])) { |
| 253 | 253 | if(class_exists($config['masks']['attachment'])) { |
| 254 | 254 | $this->default_message_mask = $config['masks']['attachment']; |
| 255 | - }else{ |
|
| 255 | + } else{ |
|
| 256 | 256 | throw new MaskNotFoundException("Unknown mask provided: ".$config['masks']['attachment']); |
| 257 | 257 | } |
| 258 | - }else{ |
|
| 258 | + } else{ |
|
| 259 | 259 | if(class_exists($default_config['attachment'])) { |
| 260 | 260 | $this->default_message_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{ |
|
| 265 | + } else{ |
|
| 266 | 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 | 272 | if(class_exists($default_config['attachment'])) { |
| 273 | 273 | $this->default_message_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 | } |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | return $folders; |
| 476 | - }else{ |
|
| 476 | + } else{ |
|
| 477 | 477 | throw new FolderFetchingException("failed to fetch any folders"); |
| 478 | 478 | } |
| 479 | 479 | } |
@@ -511,7 +511,9 @@ discard block |
||
| 511 | 511 | $this->checkConnection(); |
| 512 | 512 | $status = $this->connection->createFolder($folder); |
| 513 | 513 | |
| 514 | - if($expunge) $this->expunge(); |
|
| 514 | + if($expunge) { |
|
| 515 | + $this->expunge(); |
|
| 516 | + } |
|
| 515 | 517 | |
| 516 | 518 | $folder = $this->getFolder($folder); |
| 517 | 519 | if($status && $folder) { |
@@ -232,7 +232,9 @@ discard block |
||
| 232 | 232 | public function move($new_name, $expunge = true) { |
| 233 | 233 | $this->client->checkConnection(); |
| 234 | 234 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
| 235 | - if($expunge) $this->client->expunge(); |
|
| 235 | + if($expunge) { |
|
| 236 | + $this->client->expunge(); |
|
| 237 | + } |
|
| 236 | 238 | |
| 237 | 239 | $folder = $this->client->getFolder($new_name); |
| 238 | 240 | $event = $this->getEvent("folder", "moved"); |
@@ -306,7 +308,9 @@ discard block |
||
| 306 | 308 | */ |
| 307 | 309 | public function delete($expunge = true) { |
| 308 | 310 | $status = $this->client->getConnection()->deleteFolder($this->path); |
| 309 | - if($expunge) $this->client->expunge(); |
|
| 311 | + if($expunge) { |
|
| 312 | + $this->client->expunge(); |
|
| 313 | + } |
|
| 310 | 314 | |
| 311 | 315 | $event = $this->getEvent("folder", "deleted"); |
| 312 | 316 | $event::dispatch($this); |
@@ -374,7 +378,7 @@ discard block |
||
| 374 | 378 | |
| 375 | 379 | $connection->idle(); |
| 376 | 380 | } |
| 377 | - }catch (Exceptions\RuntimeException $e) { |
|
| 381 | + } catch (Exceptions\RuntimeException $e) { |
|
| 378 | 382 | if(strpos($e->getMessage(), "connection closed") === false) { |
| 379 | 383 | throw $e; |
| 380 | 384 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $this->setDelimiter($delimiter); |
| 127 | 127 | $this->path = $folder_name; |
| 128 | - $this->full_name = $this->decodeName($folder_name); |
|
| 128 | + $this->full_name = $this->decodeName($folder_name); |
|
| 129 | 129 | $this->name = $this->getSimpleName($this->delimiter, $this->full_name); |
| 130 | 130 | |
| 131 | 131 | $this->parseAttributes($attributes); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @throws Exceptions\ConnectionFailedException |
| 140 | 140 | * @throws Exceptions\RuntimeException |
| 141 | 141 | */ |
| 142 | - public function query($charset = 'UTF-8'){ |
|
| 142 | + public function query($charset = 'UTF-8') { |
|
| 143 | 143 | $this->getClient()->checkConnection(); |
| 144 | 144 | $this->getClient()->openFolder($this->path); |
| 145 | 145 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @throws Exceptions\ConnectionFailedException |
| 152 | 152 | * @throws Exceptions\RuntimeException |
| 153 | 153 | */ |
| 154 | - public function search($charset = 'UTF-8'){ |
|
| 154 | + public function search($charset = 'UTF-8') { |
|
| 155 | 155 | return $this->query($charset); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @throws Exceptions\ConnectionFailedException |
| 161 | 161 | * @throws Exceptions\RuntimeException |
| 162 | 162 | */ |
| 163 | - public function messages($charset = 'UTF-8'){ |
|
| 163 | + public function messages($charset = 'UTF-8') { |
|
| 164 | 164 | return $this->query($charset); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | public function move($new_name, $expunge = true) { |
| 236 | 236 | $this->client->checkConnection(); |
| 237 | 237 | $status = $this->client->getConnection()->renameFolder($this->full_name, $new_name); |
| 238 | - if($expunge) $this->client->expunge(); |
|
| 238 | + if ($expunge) $this->client->expunge(); |
|
| 239 | 239 | |
| 240 | 240 | $folder = $this->client->getFolder($new_name); |
| 241 | 241 | $event = $this->getEvent("folder", "moved"); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @throws ConnectionFailedException |
| 253 | 253 | * @throws Exceptions\RuntimeException |
| 254 | 254 | */ |
| 255 | - public function overview($sequence = null){ |
|
| 255 | + public function overview($sequence = null) { |
|
| 256 | 256 | $this->client->openFolder($this->path); |
| 257 | 257 | $sequence = $sequence === null ? "1:*" : $sequence; |
| 258 | 258 | $uid = ClientManager::get('options.sequence', IMAP::ST_MSGN) == IMAP::ST_UID; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | |
| 279 | 279 | if ($internal_date != null) { |
| 280 | - if ($internal_date instanceof Carbon){ |
|
| 280 | + if ($internal_date instanceof Carbon) { |
|
| 281 | 281 | $internal_date = $internal_date->format('d-M-Y H:i:s O'); |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public function delete($expunge = true) { |
| 313 | 313 | $status = $this->client->getConnection()->deleteFolder($this->path); |
| 314 | - if($expunge) $this->client->expunge(); |
|
| 314 | + if ($expunge) $this->client->expunge(); |
|
| 315 | 315 | |
| 316 | 316 | $event = $this->getEvent("folder", "deleted"); |
| 317 | 317 | $event::dispatch($this); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | try { |
| 372 | 372 | $line = $connection->nextLine(); |
| 373 | 373 | if (($pos = strpos($line, "EXISTS")) !== false) { |
| 374 | - $msgn = (int) substr($line, 2, $pos -2); |
|
| 374 | + $msgn = (int) substr($line, 2, $pos - 2); |
|
| 375 | 375 | $connection->done(); |
| 376 | 376 | |
| 377 | 377 | $this->client->openFolder($this->path, true); |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $connection->idle(); |
| 386 | 386 | } |
| 387 | - }catch (Exceptions\RuntimeException $e) { |
|
| 388 | - if(strpos($e->getMessage(), "connection closed") === false) { |
|
| 387 | + } catch (Exceptions\RuntimeException $e) { |
|
| 388 | + if (strpos($e->getMessage(), "connection closed") === false) { |
|
| 389 | 389 | throw $e; |
| 390 | 390 | } |
| 391 | 391 | if ($auto_reconnect === true) { |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | * Set the delimiter |
| 431 | 431 | * @param $delimiter |
| 432 | 432 | */ |
| 433 | - public function setDelimiter($delimiter){ |
|
| 434 | - if(in_array($delimiter, [null, '', ' ', false]) === true) { |
|
| 433 | + public function setDelimiter($delimiter) { |
|
| 434 | + if (in_array($delimiter, [null, '', ' ', false]) === true) { |
|
| 435 | 435 | $delimiter = ClientManager::get('options.delimiter', '/'); |
| 436 | 436 | } |
| 437 | 437 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | throw new AuthFailedException($message); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if(!$this->stream) { |
|
| 90 | + if (!$this->stream) { |
|
| 91 | 91 | $errors = \imap_errors(); |
| 92 | 92 | $message = implode("; ", (is_array($errors) ? $errors : array())); |
| 93 | 93 | throw new AuthFailedException($message); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | if (!$this->cert_validation) { |
| 119 | 119 | $address .= '/novalidate-cert'; |
| 120 | 120 | } |
| 121 | - if (in_array($this->encryption,['tls', 'notls', 'ssl'])) { |
|
| 121 | + if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) { |
|
| 122 | 122 | $address .= '/'.$this->encryption; |
| 123 | 123 | } elseif ($this->encryption === "starttls") { |
| 124 | 124 | $address .= '/tls'; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @return bool |
| 148 | 148 | */ |
| 149 | - public function connected(){ |
|
| 149 | + public function connected() { |
|
| 150 | 150 | return !$this->stream; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @return array |
| 220 | 220 | */ |
| 221 | - public function headers($uids, $rfc = "RFC822", $uid = false){ |
|
| 221 | + public function headers($uids, $rfc = "RFC822", $uid = false) { |
|
| 222 | 222 | $result = []; |
| 223 | 223 | $uids = is_array($uids) ? $uids : [$uids]; |
| 224 | 224 | foreach ($uids as $uid) { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @return array |
| 236 | 236 | */ |
| 237 | - public function flags($uids, $uid = false){ |
|
| 237 | + public function flags($uids, $uid = false) { |
|
| 238 | 238 | $result = []; |
| 239 | 239 | $uids = is_array($uids) ? $uids : [$uids]; |
| 240 | 240 | foreach ($uids as $uid) { |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | $flags = []; |
| 243 | 243 | if (is_array($raw_flags) && isset($raw_flags[0])) { |
| 244 | 244 | $raw_flags = (array) $raw_flags[0]; |
| 245 | - foreach($raw_flags as $flag => $value) { |
|
| 246 | - if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false){ |
|
| 245 | + foreach ($raw_flags as $flag => $value) { |
|
| 246 | + if ($value === 1 && in_array($flag, ["size", "uid", "msgno", "update"]) === false) { |
|
| 247 | 247 | $flags[] = "\\".ucfirst($flag); |
| 248 | 248 | } |
| 249 | 249 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | if ($id === null) { |
| 265 | 265 | $overview = $this->overview("1:*"); |
| 266 | 266 | $uids = []; |
| 267 | - foreach($overview as $set){ |
|
| 267 | + foreach ($overview as $set) { |
|
| 268 | 268 | $uids[$set->msgno] = $set->uid; |
| 269 | 269 | } |
| 270 | 270 | return $uids; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @return array |
| 291 | 291 | */ |
| 292 | 292 | public function overview($sequence, $uid = false) { |
| 293 | - return \imap_fetch_overview($this->stream, $sequence,$uid ? IMAP::FT_UID : IMAP::NIL); |
|
| 293 | + return \imap_fetch_overview($this->stream, $sequence, $uid ? IMAP::FT_UID : IMAP::NIL); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | $result = []; |
| 306 | 306 | |
| 307 | 307 | $items = \imap_getmailboxes($this->stream, $this->getAddress(), $reference.$folder); |
| 308 | - if(is_array($items)){ |
|
| 308 | + if (is_array($items)) { |
|
| 309 | 309 | foreach ($items as $item) { |
| 310 | 310 | $name = $this->decodeFolderName($item->name); |
| 311 | 311 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 312 | 312 | } |
| 313 | - }else{ |
|
| 313 | + }else { |
|
| 314 | 314 | throw new RuntimeException(\imap_last_error()); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -332,9 +332,9 @@ discard block |
||
| 332 | 332 | public function store(array $flags, $from, $to = null, $mode = null, $silent = true, $uid = false) { |
| 333 | 333 | $flag = trim(is_array($flags) ? implode(" ", $flags) : $flags); |
| 334 | 334 | |
| 335 | - if ($mode == "+"){ |
|
| 335 | + if ($mode == "+") { |
|
| 336 | 336 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 337 | - }else{ |
|
| 337 | + }else { |
|
| 338 | 338 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | public function appendMessage($folder, $message, $flags = null, $date = null) { |
| 358 | 358 | if ($date != null) { |
| 359 | - if ($date instanceof \Carbon\Carbon){ |
|
| 359 | + if ($date instanceof \Carbon\Carbon) { |
|
| 360 | 360 | $date = $date->format('d-M-Y H:i:s O'); |
| 361 | 361 | } |
| 362 | 362 | return \imap_append($this->stream, $folder, $message, $flags, $date); |
@@ -493,14 +493,14 @@ discard block |
||
| 493 | 493 | /** |
| 494 | 494 | * Enable the debug mode |
| 495 | 495 | */ |
| 496 | - public function enableDebug(){ |
|
| 496 | + public function enableDebug() { |
|
| 497 | 497 | $this->debug = true; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
| 501 | 501 | * Disable the debug mode |
| 502 | 502 | */ |
| 503 | - public function disableDebug(){ |
|
| 503 | + public function disableDebug() { |
|
| 504 | 504 | $this->debug = false; |
| 505 | 505 | } |
| 506 | 506 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $name = $this->decodeFolderName($item->name); |
| 311 | 311 | $result[$name] = ['delimiter' => $item->delimiter, 'flags' => []]; |
| 312 | 312 | } |
| 313 | - }else{ |
|
| 313 | + } else{ |
|
| 314 | 314 | throw new RuntimeException(\imap_last_error()); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | if ($mode == "+"){ |
| 336 | 336 | $status = \imap_setflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 337 | - }else{ |
|
| 337 | + } else{ |
|
| 338 | 338 | $status = \imap_clearflag_full($this->stream, $from, $flag, $uid ? IMAP::FT_UID : IMAP::NIL); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public function add($value, $strict = false) { |
| 75 | 75 | if (is_array($value)) { |
| 76 | 76 | return $this->merge($value, $strict); |
| 77 | - }elseif ($value !== null) { |
|
| 77 | + } elseif ($value !== null) { |
|
| 78 | 78 | $this->attach($value, $strict); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | if ($this->contains($value) === false) { |
| 124 | 124 | $this->values[] = $value; |
| 125 | 125 | } |
| 126 | - }else{ |
|
| 126 | + } else{ |
|
| 127 | 127 | $this->values[] = $value; |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public function toString(){ |
|
| 63 | + public function toString() { |
|
| 64 | 64 | return $this->__toString(); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return array |
| 71 | 71 | */ |
| 72 | - public function __serialize(){ |
|
| 72 | + public function __serialize() { |
|
| 73 | 73 | return $this->values; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return array |
| 80 | 80 | */ |
| 81 | - public function toArray(){ |
|
| 81 | + public function toArray() { |
|
| 82 | 82 | return $this->__serialize(); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if ($this->contains($value) === false) { |
| 142 | 142 | $this->values[] = $value; |
| 143 | 143 | } |
| 144 | - }else{ |
|
| 144 | + }else { |
|
| 145 | 145 | $this->values[] = $value; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @return Attribute |
| 154 | 154 | */ |
| 155 | - public function setName($name){ |
|
| 155 | + public function setName($name) { |
|
| 156 | 156 | $this->name = $name; |
| 157 | 157 | |
| 158 | 158 | return $this; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @return string |
| 165 | 165 | */ |
| 166 | - public function getName(){ |
|
| 166 | + public function getName() { |
|
| 167 | 167 | return $this->name; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return array |
| 174 | 174 | */ |
| 175 | - public function get(){ |
|
| 175 | + public function get() { |
|
| 176 | 176 | return $this->values; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * |
| 182 | 182 | * @return array |
| 183 | 183 | */ |
| 184 | - public function all(){ |
|
| 184 | + public function all() { |
|
| 185 | 185 | return $this->get(); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @return mixed|null |
| 192 | 192 | */ |
| 193 | - public function first(){ |
|
| 193 | + public function first() { |
|
| 194 | 194 | if (count($this->values) > 0) { |
| 195 | 195 | return $this->values[0]; |
| 196 | 196 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * |
| 203 | 203 | * @return mixed|null |
| 204 | 204 | */ |
| 205 | - public function last(){ |
|
| 205 | + public function last() { |
|
| 206 | 206 | $cnt = count($this->values); |
| 207 | 207 | if ($cnt > 0) { |
| 208 | 208 | return $this->values[$cnt - 1]; |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | * @param object $object |
| 45 | 45 | */ |
| 46 | 46 | public function __construct($object) { |
| 47 | - if (property_exists($object, "personal")){ $this->personal = $object->personal; } |
|
| 48 | - if (property_exists($object, "mailbox")){ $this->mailbox = $object->mailbox; } |
|
| 49 | - if (property_exists($object, "host")){ $this->host = $object->host; } |
|
| 50 | - if (property_exists($object, "mail")){ $this->mail = $object->mail; } |
|
| 51 | - if (property_exists($object, "full")){ $this->full = $object->full; } |
|
| 47 | + if (property_exists($object, "personal")) { $this->personal = $object->personal; } |
|
| 48 | + if (property_exists($object, "mailbox")) { $this->mailbox = $object->mailbox; } |
|
| 49 | + if (property_exists($object, "host")) { $this->host = $object->host; } |
|
| 50 | + if (property_exists($object, "mail")) { $this->mail = $object->mail; } |
|
| 51 | + if (property_exists($object, "full")) { $this->full = $object->full; } |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -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 [ |
| 71 | 71 | "personal" => $this->personal, |
| 72 | 72 | "mailbox" => $this->mailbox, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return array |
| 83 | 83 | */ |
| 84 | - public function toArray(){ |
|
| 84 | + public function toArray() { |
|
| 85 | 85 | return $this->__serialize(); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | - public function toString(){ |
|
| 93 | + public function toString() { |
|
| 94 | 94 | return $this->__toString(); |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | \ No newline at end of file |