| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace MGModule\DNSManager2\mgLibs\custom\dns\submodules\OpenProvider\Adapters;
- use MGModule\DNSManager2\mgLibs\custom\dns\record\Record;
- use MGModule\DNSManager2\mgLibs\custom\dns\submodules\OpenProvider\OPRecordAdapterType;
- class SRVAdapter extends Record
- {
- /**
- * SRVAdapter constructor.
- * @param Record $record
- */
- public function __construct( Record $record)
- {
- $this->line = $record->line;
- $this->name = $record->name;
- $this->type = 'SRV';
- $this->class = $record->class;
- $this->ttl = $record->ttl;
- $this->rdlength = $record->rdlength;
- $this->rdata = new OPRecordAdapterType();
- $this->rdata->priority = $record->rdata->priority;
- $this->rdata->weight = $record->rdata->weight;
- $this->rdata->port = $record->rdata->port;
- $this->rdata->target = $record->rdata->target;
- $this->absoluteName = $record->absoluteName;
- $this->customData = $record->customData;
- }
- public function toDnsManagerRecord($record)
- {
- $valueArray = explode(' ', $record['value'], 3);
- $templateData = [
- 'name' => $record['name'],
- 'type' => $record['type'],
- 'priority' => $record['prio'],
- 'ttl' => $record['ttl'],
- 'weight' => $valueArray[0],
- 'port' => $valueArray[1],
- 'target' => $valueArray[2],
- ];
- return Record::tryToCreateFromArray($templateData);
- }
- }
|