2024-07-18 20:20:08 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\MessageHandler;
|
|
|
|
|
|
|
|
|
|
use App\Message\UpdateRdapServers;
|
|
|
|
|
use App\Service\RDAPService;
|
|
|
|
|
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
2024-07-19 01:17:33 +02:00
|
|
|
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
|
|
|
|
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
|
|
|
|
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
|
|
|
|
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|
|
|
|
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
2024-07-18 20:20:08 +02:00
|
|
|
|
|
|
|
|
#[AsMessageHandler]
|
|
|
|
|
final readonly class UpdateRdapServersHandler
|
|
|
|
|
{
|
|
|
|
|
public function __construct(private RDAPService $RDAPService)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-19 01:17:33 +02:00
|
|
|
/**
|
|
|
|
|
* @throws TransportExceptionInterface
|
|
|
|
|
* @throws ServerExceptionInterface
|
|
|
|
|
* @throws RedirectionExceptionInterface
|
|
|
|
|
* @throws DecodingExceptionInterface
|
2024-08-02 23:24:52 +02:00
|
|
|
* @throws ClientExceptionInterface|\Throwable
|
2024-07-19 01:17:33 +02:00
|
|
|
*/
|
2024-07-18 20:20:08 +02:00
|
|
|
public function __invoke(UpdateRdapServers $message): void
|
|
|
|
|
{
|
2024-08-02 23:24:52 +02:00
|
|
|
/** @var \Throwable[] $throws */
|
2024-07-19 18:59:21 +02:00
|
|
|
$throws = [];
|
|
|
|
|
try {
|
|
|
|
|
$this->RDAPService->updateTldListIANA();
|
|
|
|
|
$this->RDAPService->updateGTldListICANN();
|
2024-08-02 23:24:52 +02:00
|
|
|
} catch (\Throwable $throwable) {
|
2024-07-19 18:59:21 +02:00
|
|
|
$throws[] = $throwable;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
$this->RDAPService->updateRDAPServers();
|
2024-08-02 23:24:52 +02:00
|
|
|
} catch (\Throwable $throwable) {
|
2024-07-19 18:59:21 +02:00
|
|
|
$throws[] = $throwable;
|
|
|
|
|
}
|
2024-08-02 23:24:52 +02:00
|
|
|
if (!empty($throws)) {
|
|
|
|
|
throw $throws[0];
|
|
|
|
|
}
|
2024-07-18 20:20:08 +02:00
|
|
|
}
|
|
|
|
|
}
|