@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $this->boot(); |
| 193 | 193 | |
| 194 | 194 | $default_mask = $client->getDefaultMessageMask(); |
| 195 | - if($default_mask != null) { |
|
| 195 | + if ($default_mask != null) { |
|
| 196 | 196 | $this->mask = $default_mask; |
| 197 | 197 | } |
| 198 | 198 | $this->events["message"] = $client->getDefaultEvents("message"); |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | * @throws Exceptions\RuntimeException |
| 247 | 247 | * @throws Exceptions\MessageNotFoundException |
| 248 | 248 | */ |
| 249 | - public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null){ |
|
| 249 | + public static function make($uid, $msglist, Client $client, $raw_header, $raw_body, $raw_flags, $fetch_options = null, $sequence = null) { |
|
| 250 | 250 | $reflection = new ReflectionClass(self::class); |
| 251 | 251 | /** @var self $instance */ |
| 252 | 252 | $instance = $reflection->newInstanceWithoutConstructor(); |
| 253 | 253 | $instance->boot(); |
| 254 | 254 | |
| 255 | 255 | $default_mask = $client->getDefaultMessageMask(); |
| 256 | - if($default_mask != null) { |
|
| 256 | + if ($default_mask != null) { |
|
| 257 | 257 | $instance->setMask($default_mask); |
| 258 | 258 | } |
| 259 | 259 | $instance->setEvents([ |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | /** |
| 279 | 279 | * Boot a new instance |
| 280 | 280 | */ |
| 281 | - public function boot(){ |
|
| 281 | + public function boot() { |
|
| 282 | 282 | $this->attributes = []; |
| 283 | 283 | |
| 284 | 284 | $this->config = ClientManager::get('options'); |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | * @throws MethodNotFoundException |
| 298 | 298 | */ |
| 299 | 299 | public function __call($method, $arguments) { |
| 300 | - if(strtolower(substr($method, 0, 3)) === 'get') { |
|
| 300 | + if (strtolower(substr($method, 0, 3)) === 'get') { |
|
| 301 | 301 | $name = Str::snake(substr($method, 3)); |
| 302 | 302 | return $this->get($name); |
| 303 | 303 | }elseif (strtolower(substr($method, 0, 3)) === 'set') { |
| 304 | 304 | $name = Str::snake(substr($method, 3)); |
| 305 | 305 | |
| 306 | - if(in_array($name, array_keys($this->attributes))) { |
|
| 306 | + if (in_array($name, array_keys($this->attributes))) { |
|
| 307 | 307 | return $this->__set($name, array_pop($arguments)); |
| 308 | 308 | } |
| 309 | 309 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | * @return Attribute|mixed|null |
| 343 | 343 | */ |
| 344 | 344 | public function get($name) { |
| 345 | - if(isset($this->attributes[$name])) { |
|
| 345 | + if (isset($this->attributes[$name])) { |
|
| 346 | 346 | return $this->attributes[$name]; |
| 347 | 347 | } |
| 348 | 348 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | * |
| 417 | 417 | * @throws InvalidMessageDateException |
| 418 | 418 | */ |
| 419 | - public function parseRawHeader($raw_header){ |
|
| 419 | + public function parseRawHeader($raw_header) { |
|
| 420 | 420 | $this->header = new Header($raw_header); |
| 421 | 421 | } |
| 422 | 422 | |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | public function parseRawFlags($raw_flags) { |
| 428 | 428 | $this->flags = FlagCollection::make([]); |
| 429 | 429 | |
| 430 | - foreach($raw_flags as $flag) { |
|
| 431 | - if (strpos($flag, "\\") === 0){ |
|
| 430 | + foreach ($raw_flags as $flag) { |
|
| 431 | + if (strpos($flag, "\\") === 0) { |
|
| 432 | 432 | $flag = substr($flag, 1); |
| 433 | 433 | } |
| 434 | 434 | $flag_key = strtolower($flag); |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | * @throws MessageFlagException |
| 502 | 502 | * @throws Exceptions\RuntimeException |
| 503 | 503 | */ |
| 504 | - public function peek(){ |
|
| 504 | + public function peek() { |
|
| 505 | 505 | if ($this->fetch_options == IMAP::FT_PEEK) { |
| 506 | 506 | if ($this->getFlags()->get("seen") == null) { |
| 507 | 507 | $this->unsetFlag("Seen"); |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | private function fetchPart(Part $part) { |
| 551 | 551 | if ($part->isAttachment()) { |
| 552 | 552 | $this->fetchAttachment($part); |
| 553 | - }else{ |
|
| 553 | + }else { |
|
| 554 | 554 | $encoding = $this->getEncoding($part); |
| 555 | 555 | |
| 556 | 556 | $content = $this->decodeString($part->content, $part->encoding); |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | if (isset($this->bodies[$subtype])) { |
| 577 | 577 | $this->bodies[$subtype] .= "\n".$content; |
| 578 | - }else{ |
|
| 578 | + }else { |
|
| 579 | 579 | $this->bodies[$subtype] = $content; |
| 580 | 580 | } |
| 581 | 581 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | if ($oAttachment->getName() !== null && $oAttachment->getSize() > 0) { |
| 592 | 592 | if ($oAttachment->getId() !== null) { |
| 593 | 593 | $this->attachments->put($oAttachment->getId(), $oAttachment); |
| 594 | - } else { |
|
| 594 | + }else { |
|
| 595 | 595 | $this->attachments->push($oAttachment); |
| 596 | 596 | } |
| 597 | 597 | } |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | |
| 726 | 726 | if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { |
| 727 | 727 | return @iconv($from, $to.'//IGNORE', $str); |
| 728 | - } else { |
|
| 728 | + }else { |
|
| 729 | 729 | if (!$from) { |
| 730 | 730 | return mb_convert_encoding($str, $to); |
| 731 | 731 | } |
@@ -746,9 +746,9 @@ discard block |
||
| 746 | 746 | return EncodingAliases::get($parameter->value); |
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | - }elseif (property_exists($structure, 'charset')){ |
|
| 749 | + }elseif (property_exists($structure, 'charset')) { |
|
| 750 | 750 | return EncodingAliases::get($structure->charset); |
| 751 | - }elseif (is_string($structure) === true){ |
|
| 751 | + }elseif (is_string($structure) === true) { |
|
| 752 | 752 | return mb_detect_encoding($structure); |
| 753 | 753 | } |
| 754 | 754 | |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | * @throws Exceptions\FolderFetchingException |
| 764 | 764 | * @throws Exceptions\RuntimeException |
| 765 | 765 | */ |
| 766 | - public function getFolder(){ |
|
| 766 | + public function getFolder() { |
|
| 767 | 767 | return $this->client->getFolderByPath($this->folder_path); |
| 768 | 768 | } |
| 769 | 769 | |
@@ -779,13 +779,13 @@ discard block |
||
| 779 | 779 | * @throws Exceptions\GetMessagesFailedException |
| 780 | 780 | * @throws Exceptions\RuntimeException |
| 781 | 781 | */ |
| 782 | - public function thread($sent_folder = null, &$thread = null, $folder = null){ |
|
| 782 | + public function thread($sent_folder = null, &$thread = null, $folder = null) { |
|
| 783 | 783 | $thread = $thread ? $thread : MessageCollection::make([]); |
| 784 | - $folder = $folder ? $folder : $this->getFolder(); |
|
| 784 | + $folder = $folder ? $folder : $this->getFolder(); |
|
| 785 | 785 | $sent_folder = $sent_folder ? $sent_folder : $this->client->getFolderByPath(ClientManager::get("options.common_folders.sent", "INBOX/Sent")); |
| 786 | 786 | |
| 787 | 787 | /** @var Message $message */ |
| 788 | - foreach($thread as $message) { |
|
| 788 | + foreach ($thread as $message) { |
|
| 789 | 789 | if ($message->message_id->first() == $this->message_id->first()) { |
| 790 | 790 | return $thread; |
| 791 | 791 | } |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | $this->fetchThreadByInReplyTo($thread, $this->message_id, $sent_folder, $folder, $sent_folder); |
| 797 | 797 | |
| 798 | 798 | if (is_array($this->in_reply_to)) { |
| 799 | - foreach($this->in_reply_to as $in_reply_to) { |
|
| 799 | + foreach ($this->in_reply_to as $in_reply_to) { |
|
| 800 | 800 | $this->fetchThreadByMessageId($thread, $in_reply_to, $folder, $folder, $sent_folder); |
| 801 | 801 | $this->fetchThreadByMessageId($thread, $in_reply_to, $sent_folder, $folder, $sent_folder); |
| 802 | 802 | } |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | * @throws Exceptions\GetMessagesFailedException |
| 818 | 818 | * @throws Exceptions\RuntimeException |
| 819 | 819 | */ |
| 820 | - protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder){ |
|
| 820 | + protected function fetchThreadByInReplyTo(&$thread, $in_reply_to, $primary_folder, $secondary_folder, $sent_folder) { |
|
| 821 | 821 | $primary_folder->query()->inReplyTo($in_reply_to) |
| 822 | 822 | ->setFetchBody($this->getFetchBodyOption()) |
| 823 | 823 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | * @throws Exceptions\GetMessagesFailedException |
| 839 | 839 | * @throws Exceptions\RuntimeException |
| 840 | 840 | */ |
| 841 | - protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder){ |
|
| 841 | + protected function fetchThreadByMessageId(&$thread, $message_id, $primary_folder, $secondary_folder, $sent_folder) { |
|
| 842 | 842 | $primary_folder->query()->messageId($message_id) |
| 843 | 843 | ->setFetchBody($this->getFetchBodyOption()) |
| 844 | 844 | ->leaveUnread()->get()->each(function($message) use(&$thread, $secondary_folder, $sent_folder){ |
@@ -934,14 +934,14 @@ discard block |
||
| 934 | 934 | * @throws MessageFlagException |
| 935 | 935 | * @throws MessageHeaderFetchingException |
| 936 | 936 | */ |
| 937 | - protected function fetchNewMail($folder, $next_uid, $event, $expunge){ |
|
| 938 | - if($expunge) $this->client->expunge(); |
|
| 937 | + protected function fetchNewMail($folder, $next_uid, $event, $expunge) { |
|
| 938 | + if ($expunge) $this->client->expunge(); |
|
| 939 | 939 | |
| 940 | 940 | $this->client->openFolder($folder->path); |
| 941 | 941 | |
| 942 | 942 | if ($this->sequence === IMAP::ST_UID) { |
| 943 | 943 | $sequence_id = $next_uid; |
| 944 | - }else{ |
|
| 944 | + }else { |
|
| 945 | 945 | $sequence_id = $this->client->getConnection()->getMessageNumber($next_uid); |
| 946 | 946 | } |
| 947 | 947 | |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | */ |
| 965 | 965 | public function delete($expunge = true) { |
| 966 | 966 | $status = $this->setFlag("Deleted"); |
| 967 | - if($expunge) $this->client->expunge(); |
|
| 967 | + if ($expunge) $this->client->expunge(); |
|
| 968 | 968 | |
| 969 | 969 | $event = $this->getEvent("message", "deleted"); |
| 970 | 970 | $event::dispatch($this); |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | */ |
| 985 | 985 | public function restore($expunge = true) { |
| 986 | 986 | $status = $this->unsetFlag("Deleted"); |
| 987 | - if($expunge) $this->client->expunge(); |
|
| 987 | + if ($expunge) $this->client->expunge(); |
|
| 988 | 988 | |
| 989 | 989 | $event = $this->getEvent("message", "restored"); |
| 990 | 990 | $event::dispatch($this); |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | * |
| 1090 | 1090 | * @return AttachmentCollection |
| 1091 | 1091 | */ |
| 1092 | - public function attachments(){ |
|
| 1092 | + public function attachments() { |
|
| 1093 | 1093 | return $this->getAttachments(); |
| 1094 | 1094 | } |
| 1095 | 1095 | |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | * |
| 1188 | 1188 | * @return FlagCollection |
| 1189 | 1189 | */ |
| 1190 | - public function flags(){ |
|
| 1190 | + public function flags() { |
|
| 1191 | 1191 | return $this->getFlags(); |
| 1192 | 1192 | } |
| 1193 | 1193 | |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | * |
| 1197 | 1197 | * @return Structure|null |
| 1198 | 1198 | */ |
| 1199 | - public function getStructure(){ |
|
| 1199 | + public function getStructure() { |
|
| 1200 | 1200 | return $this->structure; |
| 1201 | 1201 | } |
| 1202 | 1202 | |
@@ -1222,7 +1222,7 @@ discard block |
||
| 1222 | 1222 | * |
| 1223 | 1223 | * @return array |
| 1224 | 1224 | */ |
| 1225 | - public function getAttributes(){ |
|
| 1225 | + public function getAttributes() { |
|
| 1226 | 1226 | return array_merge($this->attributes, $this->header->getAttributes()); |
| 1227 | 1227 | } |
| 1228 | 1228 | |
@@ -1232,8 +1232,8 @@ discard block |
||
| 1232 | 1232 | * |
| 1233 | 1233 | * @return $this |
| 1234 | 1234 | */ |
| 1235 | - public function setMask($mask){ |
|
| 1236 | - if(class_exists($mask)){ |
|
| 1235 | + public function setMask($mask) { |
|
| 1236 | + if (class_exists($mask)) { |
|
| 1237 | 1237 | $this->mask = $mask; |
| 1238 | 1238 | } |
| 1239 | 1239 | |
@@ -1245,7 +1245,7 @@ discard block |
||
| 1245 | 1245 | * |
| 1246 | 1246 | * @return string |
| 1247 | 1247 | */ |
| 1248 | - public function getMask(){ |
|
| 1248 | + public function getMask() { |
|
| 1249 | 1249 | return $this->mask; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
@@ -1256,9 +1256,9 @@ discard block |
||
| 1256 | 1256 | * @return mixed |
| 1257 | 1257 | * @throws MaskNotFoundException |
| 1258 | 1258 | */ |
| 1259 | - public function mask($mask = null){ |
|
| 1259 | + public function mask($mask = null) { |
|
| 1260 | 1260 | $mask = $mask !== null ? $mask : $this->mask; |
| 1261 | - if(class_exists($mask)){ |
|
| 1261 | + if (class_exists($mask)) { |
|
| 1262 | 1262 | return new $mask($this); |
| 1263 | 1263 | } |
| 1264 | 1264 | |
@@ -1271,7 +1271,7 @@ discard block |
||
| 1271 | 1271 | * |
| 1272 | 1272 | * @return $this |
| 1273 | 1273 | */ |
| 1274 | - public function setFolderPath($folder_path){ |
|
| 1274 | + public function setFolderPath($folder_path) { |
|
| 1275 | 1275 | $this->folder_path = $folder_path; |
| 1276 | 1276 | |
| 1277 | 1277 | return $this; |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | * |
| 1284 | 1284 | * @return $this |
| 1285 | 1285 | */ |
| 1286 | - public function setConfig($config){ |
|
| 1286 | + public function setConfig($config) { |
|
| 1287 | 1287 | $this->config = $config; |
| 1288 | 1288 | |
| 1289 | 1289 | return $this; |
@@ -1295,7 +1295,7 @@ discard block |
||
| 1295 | 1295 | * |
| 1296 | 1296 | * @return $this |
| 1297 | 1297 | */ |
| 1298 | - public function setAvailableFlags($available_flags){ |
|
| 1298 | + public function setAvailableFlags($available_flags) { |
|
| 1299 | 1299 | $this->available_flags = $available_flags; |
| 1300 | 1300 | |
| 1301 | 1301 | return $this; |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | * |
| 1308 | 1308 | * @return $this |
| 1309 | 1309 | */ |
| 1310 | - public function setAttachments($attachments){ |
|
| 1310 | + public function setAttachments($attachments) { |
|
| 1311 | 1311 | $this->attachments = $attachments; |
| 1312 | 1312 | |
| 1313 | 1313 | return $this; |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | * |
| 1320 | 1320 | * @return $this |
| 1321 | 1321 | */ |
| 1322 | - public function setFlags($flags){ |
|
| 1322 | + public function setFlags($flags) { |
|
| 1323 | 1323 | $this->flags = $flags; |
| 1324 | 1324 | |
| 1325 | 1325 | return $this; |
@@ -1333,7 +1333,7 @@ discard block |
||
| 1333 | 1333 | * @throws Exceptions\RuntimeException |
| 1334 | 1334 | * @throws Exceptions\ConnectionFailedException |
| 1335 | 1335 | */ |
| 1336 | - public function setClient($client){ |
|
| 1336 | + public function setClient($client) { |
|
| 1337 | 1337 | $this->client = $client; |
| 1338 | 1338 | $this->client->openFolder($this->folder_path); |
| 1339 | 1339 | |
@@ -1348,7 +1348,7 @@ discard block |
||
| 1348 | 1348 | * @throws Exceptions\MessageNotFoundException |
| 1349 | 1349 | * @throws Exceptions\ConnectionFailedException |
| 1350 | 1350 | */ |
| 1351 | - public function setUid($uid){ |
|
| 1351 | + public function setUid($uid) { |
|
| 1352 | 1352 | $this->uid = $uid; |
| 1353 | 1353 | $this->msgn = $this->client->getConnection()->getMessageNumber($this->uid); |
| 1354 | 1354 | $this->msglist = null; |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | * @throws Exceptions\MessageNotFoundException |
| 1366 | 1366 | * @throws Exceptions\ConnectionFailedException |
| 1367 | 1367 | */ |
| 1368 | - public function setMsgn($msgn, $msglist = null){ |
|
| 1368 | + public function setMsgn($msgn, $msglist = null) { |
|
| 1369 | 1369 | $this->msgn = $msgn; |
| 1370 | 1370 | $this->msglist = $msglist; |
| 1371 | 1371 | $this->uid = $this->client->getConnection()->getUid($this->msgn); |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | * |
| 1379 | 1379 | * @return int |
| 1380 | 1380 | */ |
| 1381 | - public function getSequence(){ |
|
| 1381 | + public function getSequence() { |
|
| 1382 | 1382 | return $this->sequence; |
| 1383 | 1383 | } |
| 1384 | 1384 | |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | * |
| 1388 | 1388 | * @return int |
| 1389 | 1389 | */ |
| 1390 | - public function getSequenceId(){ |
|
| 1390 | + public function getSequenceId() { |
|
| 1391 | 1391 | return $this->sequence === IMAP::ST_UID ? $this->uid : $this->msgn; |
| 1392 | 1392 | } |
| 1393 | 1393 | |
@@ -1399,11 +1399,11 @@ discard block |
||
| 1399 | 1399 | * @throws Exceptions\ConnectionFailedException |
| 1400 | 1400 | * @throws Exceptions\MessageNotFoundException |
| 1401 | 1401 | */ |
| 1402 | - public function setSequenceId($uid, $msglist = null){ |
|
| 1402 | + public function setSequenceId($uid, $msglist = null) { |
|
| 1403 | 1403 | if ($this->getSequence() === IMAP::ST_UID) { |
| 1404 | 1404 | $this->setUid($uid); |
| 1405 | 1405 | $this->setMsglist($msglist); |
| 1406 | - }else{ |
|
| 1406 | + }else { |
|
| 1407 | 1407 | $this->setMsgn($uid, $msglist); |
| 1408 | 1408 | } |
| 1409 | 1409 | } |
@@ -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 |
@@ -86,7 +86,9 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function toDate(){ |
| 88 | 88 | $date = $this->first(); |
| 89 | - if ($date instanceof Carbon) return $date; |
|
| 89 | + if ($date instanceof Carbon) { |
|
| 90 | + return $date; |
|
| 91 | + } |
|
| 90 | 92 | |
| 91 | 93 | return Carbon::parse($date); |
| 92 | 94 | } |
@@ -146,7 +148,7 @@ discard block |
||
| 146 | 148 | public function add($value, $strict = false) { |
| 147 | 149 | if (is_array($value)) { |
| 148 | 150 | return $this->merge($value, $strict); |
| 149 | - }elseif ($value !== null) { |
|
| 151 | + } elseif ($value !== null) { |
|
| 150 | 152 | $this->attach($value, $strict); |
| 151 | 153 | } |
| 152 | 154 | |
@@ -195,7 +197,7 @@ discard block |
||
| 195 | 197 | if ($this->contains($value) === false) { |
| 196 | 198 | $this->values[] = $value; |
| 197 | 199 | } |
| 198 | - }else{ |
|
| 200 | + } else{ |
|
| 199 | 201 | $this->values[] = $value; |
| 200 | 202 | } |
| 201 | 203 | } |