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: 'attachments:grab',
|
||||
@ -36,12 +37,12 @@ class GrabAttachments extends Command
|
||||
protected function getMessages(): array
|
||||
{
|
||||
$response = $this->getCommunicator()->get('/messages/pending');
|
||||
return \Safe\json_decode($response->getBody()->getContents())->messages;
|
||||
return json_decode($response->getBody()->getContents())->messages;
|
||||
}
|
||||
protected function grabAttachments(int $message_uid): int
|
||||
{
|
||||
$response = $this->getCommunicator()->put('/attachments/grab', ['messages' => [$message_uid]]);
|
||||
return \Safe\json_decode($response->getBody()->getContents())->attachment_count;
|
||||
return json_decode($response->getBody()->getContents())->attachment_count;
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output): int
|
||||
@ -62,4 +63,4 @@ class GrabAttachments extends Command
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user