mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 09:45:29 +00:00
chore: code format
This commit is contained in:
parent
28fb5f2fc3
commit
10e573e483
@ -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 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 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]+$'");
|
$this->addSql("DELETE FROM entity WHERE handle ~ '^[0-9]+$'");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
public function down(Schema $schema): void
|
||||||
|
|||||||
@ -92,7 +92,6 @@ class Entity
|
|||||||
#[Groups(['entity:item', 'domain:item'])]
|
#[Groups(['entity:item', 'domain:item'])]
|
||||||
private ?string $registrarNameIANA = null;
|
private ?string $registrarNameIANA = null;
|
||||||
|
|
||||||
|
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
#[Groups(['entity:item', 'domain:item'])]
|
#[Groups(['entity:item', 'domain:item'])]
|
||||||
private ?string $rdapBaseUrlIANA = null;
|
private ?string $rdapBaseUrlIANA = null;
|
||||||
|
|||||||
@ -121,7 +121,9 @@ class Tld
|
|||||||
public function setTld(string $tld): static
|
public function setTld(string $tld): static
|
||||||
{
|
{
|
||||||
$this->tld = RDAPService::convertToIdn($tld);
|
$this->tld = RDAPService::convertToIdn($tld);
|
||||||
if($this->tld === '') $this->tld = '.';
|
if ('' === $this->tld) {
|
||||||
|
$this->tld = '.';
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,6 @@ final readonly class UpdateRdapServersHandler
|
|||||||
$throws[] = $throwable;
|
$throws[] = $throwable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->RDAPService->updateRegistrarListIANA();
|
$this->RDAPService->updateRegistrarListIANA();
|
||||||
} catch (\Throwable $throwable) {
|
} catch (\Throwable $throwable) {
|
||||||
|
|||||||
@ -550,7 +550,7 @@ readonly class RDAPService
|
|||||||
'tld' => $tld,
|
'tld' => $tld,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if(null === $entity) {
|
if (null === $entity) {
|
||||||
$entity = $this->entityRepository->findOneBy([
|
$entity = $this->entityRepository->findOneBy([
|
||||||
'handle' => $rdapEntity['handle'],
|
'handle' => $rdapEntity['handle'],
|
||||||
'tld' => null,
|
'tld' => null,
|
||||||
@ -567,11 +567,11 @@ readonly class RDAPService
|
|||||||
|
|
||||||
$entity->setHandle($rdapEntity['handle']);
|
$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']);
|
$entity->setRemarks($rdapEntity['remarks']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($rdapEntity['vcardArray']) && $entity->getStatusIANA() === null) {
|
if (isset($rdapEntity['vcardArray']) && null === $entity->getStatusIANA()) {
|
||||||
if (empty($entity->getJCard())) {
|
if (empty($entity->getJCard())) {
|
||||||
if (!array_key_exists('elements', $rdapEntity['vcardArray'])) {
|
if (!array_key_exists('elements', $rdapEntity['vcardArray'])) {
|
||||||
$entity->setJCard($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;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,7 +713,7 @@ readonly class RDAPService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
|
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
|
||||||
if($tldEntity === null) {
|
if (null === $tldEntity) {
|
||||||
$tldEntity = (new Tld())->setTld($tld)->setType(TldType::gTLD);
|
$tldEntity = (new Tld())->setTld($tld)->setType(TldType::gTLD);
|
||||||
$this->em->persist($tldEntity);
|
$this->em->persist($tldEntity);
|
||||||
}
|
}
|
||||||
@ -816,17 +816,19 @@ readonly class RDAPService
|
|||||||
|
|
||||||
$data = new \SimpleXMLElement($registrarList->getContent());
|
$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]);
|
$entity = $this->entityRepository->findOneBy(['handle' => $registrar->value, 'tld' => null]);
|
||||||
if($entity === null) $entity = new Entity();
|
if (null === $entity) {
|
||||||
|
$entity = new Entity();
|
||||||
|
}
|
||||||
$entity
|
$entity
|
||||||
->setHandle(strval($registrar->value))->setTld(null)
|
->setHandle(strval($registrar->value))->setTld(null)
|
||||||
->setRegistrarNameIANA(strval($registrar->name))
|
->setRegistrarNameIANA(strval($registrar->name))
|
||||||
->setStatusIANA(RegistrarStatus::from(strval($registrar->status)))
|
->setStatusIANA(RegistrarStatus::from(strval($registrar->status)))
|
||||||
->setRdapBaseUrlIANA($registrar->rdapurl->count() ? strval($registrar->rdapurl->server) : null)
|
->setRdapBaseUrlIANA($registrar->rdapurl->count() ? strval($registrar->rdapurl->server) : null)
|
||||||
->setUpdatedIANA($registrar->attributes()->updated !== null ? new \DateTimeImmutable(strval($registrar->attributes()->updated)) : null)
|
->setUpdatedIANA(null !== $registrar->attributes()->updated ? new \DateTimeImmutable(strval($registrar->attributes()->updated)) : null)
|
||||||
->setDateIANA($registrar->attributes()->date !== null ? new \DateTimeImmutable(strval($registrar->attributes()->date)) : null)
|
->setDateIANA(null !== $registrar->attributes()->date ? new \DateTimeImmutable(strval($registrar->attributes()->date)) : null)
|
||||||
->setJCard(["vcard", [["version", [], "text", "4.0"], ["fn", [], "text", $entity->getRegistrarNameIANA()]]])
|
->setJCard(['vcard', [['version', [], 'text', '4.0'], ['fn', [], 'text', $entity->getRegistrarNameIANA()]]])
|
||||||
->setRemarks(null);
|
->setRemarks(null);
|
||||||
|
|
||||||
$this->em->persist($entity);
|
$this->em->persist($entity);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user