Skip to content

Commit

Permalink
Allow to call \Webklex\PHPIMAP\Message::make() without specifying uid
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Jun 10, 2024
1 parent 4ee876c commit 1fd00de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/TestWebklex.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function handle()
$client = \MailHelper::getMailboxClient($mailbox);
$client->openFolder("INBOX");

$message = Message::make($this->option('uid'), null, $client, $raw_header, $raw_body, [0 => "\\Seen"], IMAP::ST_UID);
$message = Message::make(/*$this->option('uid')*/null, null, $client, $raw_header, $raw_body, [/*0 => "\\Seen"*/], IMAP::ST_UID);

$this->line('Headers: ');
$this->info($message->getHeader()->raw);
Expand Down
6 changes: 4 additions & 2 deletions overrides/webklex/php-imap/src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public function __construct(int $uid, $msglist, Client $client, int $fetch_optio
* @throws Exceptions\RuntimeException
* @throws Exceptions\MessageNotFoundException
*/
public static function make(int $uid, $msglist, Client $client, string $raw_header, string $raw_body, array $raw_flags, $fetch_options = null, $sequence = null): Message {
public static function make(/*int*/ $uid, $msglist, Client $client, string $raw_header, string $raw_body, array $raw_flags, $fetch_options = null, $sequence = null): Message {
$reflection = new ReflectionClass(self::class);
/** @var self $instance */
$instance = $reflection->newInstanceWithoutConstructor();
Expand All @@ -265,7 +265,9 @@ public static function make(int $uid, $msglist, Client $client, string $raw_head
$instance->setFetchOption($fetch_options);

$instance->setClient($client);
$instance->setSequenceId($uid, $msglist);
if ($uid !== null) {
$instance->setSequenceId($uid, $msglist);
}

$instance->parseRawHeader($raw_header);
$instance->parseRawFlags($raw_flags);
Expand Down

0 comments on commit 1fd00de

Please sign in to comment.