From 10e573e483432418761751a1d8894857bd0ea476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Wed, 10 Sep 2025 21:39:17 +0200 Subject: [PATCH] chore: code format --- migrations/Version20250910171544.php | 2 -- src/Entity/Entity.php | 1 - src/Entity/Tld.php | 4 +++- .../UpdateRdapServersHandler.php | 1 - src/Service/RDAPService.php | 22 ++++++++++--------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/migrations/Version20250910171544.php b/migrations/Version20250910171544.php index a1050d4..95df1a7 100644 --- a/migrations/Version20250910171544.php +++ b/migrations/Version20250910171544.php @@ -32,8 +32,6 @@ final class Version20250910171544 extends AbstractMigration $this->addSql("DELETE FROM entity_event ev USING entity e WHERE ev.entity_uid = e.id AND e.handle ~ '^[0-9]+$'"); $this->addSql("DELETE FROM nameserver_entity ne USING entity e WHERE ne.entity_uid = e.id AND e.handle ~ '^[0-9]+$'"); $this->addSql("DELETE FROM entity WHERE handle ~ '^[0-9]+$'"); - - } public function down(Schema $schema): void diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index d1b9263..f593f71 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -92,7 +92,6 @@ class Entity #[Groups(['entity:item', 'domain:item'])] private ?string $registrarNameIANA = null; - #[ORM\Column(length: 255, nullable: true)] #[Groups(['entity:item', 'domain:item'])] private ?string $rdapBaseUrlIANA = null; diff --git a/src/Entity/Tld.php b/src/Entity/Tld.php index 8bda5b5..21ab3dc 100644 --- a/src/Entity/Tld.php +++ b/src/Entity/Tld.php @@ -121,7 +121,9 @@ class Tld public function setTld(string $tld): static { $this->tld = RDAPService::convertToIdn($tld); - if($this->tld === '') $this->tld = '.'; + if ('' === $this->tld) { + $this->tld = '.'; + } return $this; } diff --git a/src/MessageHandler/UpdateRdapServersHandler.php b/src/MessageHandler/UpdateRdapServersHandler.php index 49b1d9e..d73b2f7 100644 --- a/src/MessageHandler/UpdateRdapServersHandler.php +++ b/src/MessageHandler/UpdateRdapServersHandler.php @@ -65,7 +65,6 @@ final readonly class UpdateRdapServersHandler $throws[] = $throwable; } - try { $this->RDAPService->updateRegistrarListIANA(); } catch (\Throwable $throwable) { diff --git a/src/Service/RDAPService.php b/src/Service/RDAPService.php index b6520af..2374ff6 100644 --- a/src/Service/RDAPService.php +++ b/src/Service/RDAPService.php @@ -550,7 +550,7 @@ readonly class RDAPService 'tld' => $tld, ]); - if(null === $entity) { + if (null === $entity) { $entity = $this->entityRepository->findOneBy([ 'handle' => $rdapEntity['handle'], 'tld' => null, @@ -567,11 +567,11 @@ readonly class RDAPService $entity->setHandle($rdapEntity['handle']); - if (isset($rdapEntity['remarks']) && is_array($rdapEntity['remarks']) && $entity->getStatusIANA() === null) { + if (isset($rdapEntity['remarks']) && is_array($rdapEntity['remarks']) && null === $entity->getStatusIANA()) { $entity->setRemarks($rdapEntity['remarks']); } - if (isset($rdapEntity['vcardArray']) && $entity->getStatusIANA() === null) { + if (isset($rdapEntity['vcardArray']) && null === $entity->getStatusIANA()) { if (empty($entity->getJCard())) { if (!array_key_exists('elements', $rdapEntity['vcardArray'])) { $entity->setJCard($rdapEntity['vcardArray']); @@ -605,7 +605,7 @@ readonly class RDAPService } } - if ($isIANAid || !isset($rdapEntity['events']) || $entity->getStatusIANA() !== null) { + if ($isIANAid || !isset($rdapEntity['events']) || null !== $entity->getStatusIANA()) { return $entity; } @@ -713,7 +713,7 @@ readonly class RDAPService } $tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]); - if($tldEntity === null) { + if (null === $tldEntity) { $tldEntity = (new Tld())->setTld($tld)->setType(TldType::gTLD); $this->em->persist($tldEntity); } @@ -816,17 +816,19 @@ readonly class RDAPService $data = new \SimpleXMLElement($registrarList->getContent()); - foreach($data->registry->record as $registrar) { + foreach ($data->registry->record as $registrar) { $entity = $this->entityRepository->findOneBy(['handle' => $registrar->value, 'tld' => null]); - if($entity === null) $entity = new Entity(); + if (null === $entity) { + $entity = new Entity(); + } $entity ->setHandle(strval($registrar->value))->setTld(null) ->setRegistrarNameIANA(strval($registrar->name)) ->setStatusIANA(RegistrarStatus::from(strval($registrar->status))) ->setRdapBaseUrlIANA($registrar->rdapurl->count() ? strval($registrar->rdapurl->server) : null) - ->setUpdatedIANA($registrar->attributes()->updated !== null ? new \DateTimeImmutable(strval($registrar->attributes()->updated)) : null) - ->setDateIANA($registrar->attributes()->date !== null ? new \DateTimeImmutable(strval($registrar->attributes()->date)) : null) - ->setJCard(["vcard", [["version", [], "text", "4.0"], ["fn", [], "text", $entity->getRegistrarNameIANA()]]]) + ->setUpdatedIANA(null !== $registrar->attributes()->updated ? new \DateTimeImmutable(strval($registrar->attributes()->updated)) : null) + ->setDateIANA(null !== $registrar->attributes()->date ? new \DateTimeImmutable(strval($registrar->attributes()->date)) : null) + ->setJCard(['vcard', [['version', [], 'text', '4.0'], ['fn', [], 'text', $entity->getRegistrarNameIANA()]]]) ->setRemarks(null); $this->em->persist($entity);