DSAdapter.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace MGModule\DNSManager2\mgLibs\custom\dns\submodules\cPanel;
  3. use MGModule\DNSManager2\mgLibs\custom\dns\record\Record;
  4. class DSAdapter extends Record
  5. {
  6. /**
  7. * DSAdapter constructor.
  8. * @param Record $record
  9. */
  10. public function __construct( Record $record )
  11. {
  12. $this->type = 'DS';
  13. $this->name = $record->name;
  14. $this->absoluteName = $record->absoluteName;
  15. $this->ttl = (int)$record->ttl;
  16. $this->class = $record->class;
  17. $this->line = $record->line;
  18. $this->customData = $record->customData;
  19. $this->rdlength = $record->rdlength;
  20. $this->rdata = new CpanelRecordAdapterType();
  21. $this->rdata->keyname = (int)$record->rdata->keytag;
  22. $this->rdata->digitype = (int)$record->rdata->digesttype;
  23. $this->rdata->algorithm = (int)$record->rdata->algorithm;
  24. }
  25. public static function toDnsManagerRecord(array $recordArray)
  26. {
  27. $recordArray['keytag'] = $recordArray['keyname'];
  28. $recordArray['digesttype'] = $recordArray['digitype'];
  29. unset($recordArray['keyname'],$recordArray['digitype']);
  30. return Record::tryToCreateFromArray($recordArray);
  31. }
  32. }