*/ 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:----lBkKcv9fSd2q3dCKwOTB5B8GG5Zy9Nau2EkVaDiS5aIEUcuv2pIpSB50jmbNeXQLl8twoxi8ZH5+kQIiJWcjetK0RVX7Btlw0yhJQVnSc475zwxIivKHyNfxkrfzTgPPnAMpPyvso/WmAW5EVpQvwspfp2KXc0iVLq6T8vbKXSZWZvQQe9Z+2MFW0APC4agdSauMA8/IojBKCvz6MWtBCcPUwlbnDi+J9LOyayZ/4ZKQTvxumw5xzbdzNVwCczvUYvd43JxyXIzOlHR3EY1yDOaZoDXlj9/4eEtSVfoE3cdHEoKHRiunc5fp90CL3rgt8bcfM0bXF1jsmCkW/evfzijLdlc54qd/yrz1KuDuFI8nedACoQcYvCJi1irv9CNHutXEr1XKh2pkqITFUA37gvupZWzxNGWm7PNzKdxqT3vgYDca7nTSuAEdaTiBGfqQcNVbLg1ofcaKv8qV2A5wD4kz8wZPOKj6wLXeE0RQpO9BHA8WTXCKcrr15j2PXSHfnfyeChnv26Mkf+N7Q9XFIJxrHJyVPG/6he2pzIPst/HL0xdyETBpxFoSgmSWZiQjzaztu+TGAJVG4a3RvJsROBPwUuzZHT9hPrwF6T9e+d08h+TiPxwp84ArmI0LesTywXx5FtcrsdimB2WBD7ineKKenD1ja3ykXP0jm0OslU0=----ATTACHMENT:----NDY2MjQwNzM1Nzg1NTA5MyAyMDI5MjcwMDU4MDk1NDY1IDQ3OTg3NjQ1MzAxNzg4Mzg=