forked from apisnetworks/apiscp-dns-vultr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Record.php
42 lines (39 loc) · 1.11 KB
/
Record.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php declare(strict_types=1);
/**
* Copyright (C) Apis Networks, Inc - All Rights Reserved.
*
* Unauthorized copying of this file, via any medium, is
* strictly prohibited without consent. Any dissemination of
* material herein is prohibited.
*
* For licensing inquiries email <[email protected]>
*
* Written by Matt Saladna <[email protected]>, March 2019
*/
namespace Opcenter\Dns\Providers\Vultr;
class Record extends \Opcenter\Dns\Record
{
/**
* Override broken TXT formatting in Vultr
*/
protected function formatTxt()
{
if ($this->parameter && $this->parameter[0] === '"' && $this->parameter[0] === $this->parameter[-1]) {
$this->parameter = '"' . trim($this->parameter, '"') . '"';
}
}
/**
* Override broken CAA formatting in Vultr
*/
protected function formatCaa()
{
$data = $this->getMeta('data');
if ($data[-1] === '"') {
// prevent doubly-escaping
return;
}
$this->setMeta('data', '"' . rtrim($data, '.') . '"');
$this->parameter = $this->getMeta('flags') . ' ' .
$this->getMeta('tag') . ' ' . $this->getMeta('data');
}
}