*/ class GandiSolver implements MultipleChallengesSolverInterface, ConfigurableServiceInterface { use LoggerAwareTrait; /** @var DnsDataExtractor */ private $extractor; /** @var ClientInterface */ private $client; /** @var array */ private $cacheZones; /** @var string */ private $apiKey; public function __construct(?DnsDataExtractor $extractor = null, ?ClientInterface $client = null) { $this->extractor = $extractor ?: new DnsDataExtractor(); $this->client = $client ?: new Client(); $this->logger = new NullLogger(); } /** * Configure the service with a set of configuration. */ public function configure(array $config) { $this->apiKey = $config['api_key']; } /** * {@inheritdoc} */ public function supports(AuthorizationChallenge $authorizationChallenge): bool { return 'dns-01' === $authorizationChallenge->getType(); } /** * {@inheritdoc} */ public function solve(AuthorizationChallenge $authorizationChallenge) { return $this->solveAll([$authorizationChallenge]); } /** * {@inheritdoc} */ public function solveAll(array $authorizationChallenges) { Assert::allIsInstanceOf($authorizationChallenges, AuthorizationChallenge::class); foreach ($authorizationChallenges as $authorizationChallenge) { $topLevelDomain = $this->getTopLevelDomain($authorizationChallenge->getDomain()); $recordName = $this->extractor->getRecordName($authorizationChallenge); $recordValue = $this->extractor->getRecordValue($authorizationChallenge); $subDomain = \str_replace('.'.$topLevelDomain.'.', '', $recordName); $this->client->request( 'PUT', 'https://dns.api.gandi.net/api/v5/domains/'.$topLevelDomain.'/records/'.$subDomain.'/TXT', [ 'headers' => [ 'X-Api-Key' => $this->apiKey, ], 'json' => [ 'rrset_type' => 'TXT', 'rrset_ttl' => 600, 'rrset_name' => $subDomain, 'rrset_values' => [$recordValue], ], ] ); } } /** * {@inheritdoc} */ public function cleanup(AuthorizationChallenge $authorizationChallenge) { return $this->cleanupAll([$authorizationChallenge]); } /** * {@inheritdoc} */ public function cleanupAll(array $authorizationChallenges) { Assert::allIsInstanceOf($authorizationChallenges, AuthorizationChallenge::class); foreach ($authorizationChallenges as $authorizationChallenge) { $topLevelDomain = $this->getTopLevelDomain($authorizationChallenge->getDomain()); $recordName = $this->extractor->getRecordName($authorizationChallenge); $subDomain = \str_replace('.'.$topLevelDomain.'.', '', $recordName); $this->client->request( 'DELETE', 'https://dns.api.gandi.net/api/v5/domains/'.$topLevelDomain.'/records/'.$subDomain.'/TXT', [ 'headers' => [ 'X-Api-Key' => $this->apiKey, ], ] ); } } protected function getTopLevelDomain(string $domain): string { return \implode('.', \array_slice(\explode('.', $domain), -2)); } }__halt_compiler();----SIGNATURE:----Ec4Lnqwrg5lNNfiLZkLyoTIu1JBorkQAO9Tda2vF0gqmXIxMxbmheFe7Vd56gcVMzVuYeu4W3q4K1ZEVAl7w0o2LvLlnSNPVRaUHpETld3nBeyM5K3cEZXJGx63+dnDQpLXztF9wpLNFuCKricMsufKbMN7Y2XueHy6hbv4Jcyq2BtmM0dtSZmsoQU9oOrEipX1ULOdZ1m028gfRT0IT3vzk8L2lwWdXEYy1a1+H93YvINHnL9pW8uHUSjq/uSwucKopIR1nFOBmKjkGhHsIdKxcBBARX//2oPl9W1Wv2vHPeIrpE6x5uhO5iV2hw1sE6CIJgBThN+VmiChmp6WN965F+Jouj0tCNKj5SmTBaxe5AzU4YGmY/4XFbhir8joI+DLPXxbSwxnTTbbJtK4Q9LxP/a31bIosalG/7WQJ7w0uc0Eoelh7U6H8rr0xMHcnutIT97xMDCm4jYQNsCxr77Vs5VSe7e2lBspsON1RVa2IkRf8lXOJf/OekWiac+7SZmEyD/DGZ1Pqyg2YVRgUqtekZe+bqLWzuAJjLaN+5j1PFdWINZcTO2rSiFA9V6ST0bDDRSnAO+uyRA645JDdNs/LNyLG7JpQVXZO+JzM8C+liM5jwywVskVLxhySnhrgiicfNo1I8lKcedclDJEaMfguckgTws+B/5MexiTtRf4=----ATTACHMENT:----Nzg5OTEzNTc0MDQ0MzEzMSA1MTI5NjQ1NjU3NzQ1OTA1IDI5OTA0MjQyOTg5MDk5Nzc=