Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CentralNic
Badcow-DNS
Commits
666d368f
Commit
666d368f
authored
Feb 19, 2019
by
Samuel Williams
Browse files
CAA no longer extends CNAME.
parent
546b840a
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Rdata/CAA.php
View file @
666d368f
...
...
@@ -20,13 +20,21 @@ namespace Badcow\DNS\Rdata;
*
* @author Samuel Williams <sam@badcow.co>
*/
class
CAA
ext
en
d
s
CNAME
class
CAA
implem
en
t
s
RdataInterface
{
use
RdataTrait
;
const
TYPE
=
'CAA'
;
const
MAX_FLAG
=
255
;
const
ALLOWED_TAGS
=
[
'issue'
,
'issuewild'
,
'iodef'
];
const
TAG_ISSUE
=
'issue'
;
const
TAG_ISSUEWILD
=
'issuewild'
;
const
TAG_IODEF
=
'iodef'
;
const
ALLOWED_TAGS
=
[
self
::
TAG_ISSUE
,
self
::
TAG_ISSUEWILD
,
self
::
TAG_IODEF
];
/**
* It is currently used to represent the critical flag
...
...
@@ -46,6 +54,11 @@ class CAA extends CNAME
*/
private
$tag
;
/**
* @var string
*/
private
$value
;
/**
* @return int
*/
...
...
@@ -69,7 +82,7 @@ class CAA extends CNAME
}
/**
* @return in
t
* @return
str
in
g
*/
public
function
getTag
():
?string
{
...
...
@@ -77,7 +90,7 @@ class CAA extends CNAME
}
/**
* @param in
t
$tag
* @param
str
in
g
$tag
*
* @throws \InvalidArgumentException
*/
...
...
@@ -90,6 +103,22 @@ class CAA extends CNAME
$this
->
tag
=
$tag
;
}
/**
* @return string
*/
public
function
getValue
():
string
{
return
$this
->
value
;
}
/**
* @param string $value
*/
public
function
setValue
(
string
$value
):
void
{
$this
->
value
=
$value
;
}
/**
* {@inheritdoc}
*/
...
...
@@ -98,7 +127,7 @@ class CAA extends CNAME
return
sprintf
(
'%s %s "%s"'
,
$this
->
flag
,
$this
->
tag
,
$this
->
target
$this
->
value
);
}
}
lib/Rdata/Factory.php
View file @
666d368f
...
...
@@ -356,16 +356,16 @@ class Factory
/**
* @param integer $flag
* @param string $tag
* @param string $
target
* @param string $
value
*
* @return CAA
*/
public
static
function
Caa
(
$flag
,
$tag
,
$
target
)
public
static
function
Caa
(
$flag
,
$tag
,
$
value
):
CAA
{
$rdata
=
new
CAA
();
$rdata
->
setFlag
(
$flag
);
$rdata
->
setTag
(
$tag
);
$rdata
->
set
Target
(
$target
);
$rdata
->
set
Value
(
$value
);
return
$rdata
;
}
...
...
lib/Tests/Rdata/CaaRdataTest.php
View file @
666d368f
...
...
@@ -44,4 +44,9 @@ class CaaRdataTest extends \PHPUnit\Framework\TestCase
$srv
=
new
CAA
();
$srv
->
setTag
(
'not_exist'
);
}
public
function
testGetType
()
{
$this
->
assertEquals
(
'CAA'
,
(
new
CAA
)
->
getType
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment