Various updates
This commit is contained in:
@ -1,12 +1,13 @@
|
||||
<?php
|
||||
namespace ProVM\Common\Command;
|
||||
|
||||
use ProVM\Common\Service\Communicator;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use ProVM\Common\Service\Communicator;
|
||||
use function Safe\json_decode;
|
||||
|
||||
#[AsCommand(
|
||||
name: 'messages:grab',
|
||||
@ -36,12 +37,12 @@ class Messages extends Command
|
||||
protected function getMailboxes(): array
|
||||
{
|
||||
$response = $this->getCommunicator()->get('/mailboxes/registered');
|
||||
return \Safe\json_decode($response->getBody()->getContents())->mailboxes;
|
||||
return json_decode($response->getBody()->getContents())->mailboxes;
|
||||
}
|
||||
protected function grabMessages(string $mailbox): int
|
||||
{
|
||||
$response = $this->getCommunicator()->put('/messages/grab', ['mailboxes' => [$mailbox]]);
|
||||
$body = \Safe\json_decode($response->getBody()->getContents());
|
||||
$body = json_decode($response->getBody()->getContents());
|
||||
return $body->message_count;
|
||||
}
|
||||
|
||||
@ -63,4 +64,4 @@ class Messages extends Command
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user