-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathBIMI1.php
35 lines (29 loc) · 890 Bytes
/
BIMI1.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
<?php
namespace Spatie\Dns\TXTRecords;
class BIMI1 extends V {
public string $l;
public string $a;
function __construct(string $value)
{
$this->type = 'BIMI';
$this->version = 1;
$this->l = $this->cast('l',$value);
$this->a = $this->cast('a',$value);
}
function castL(string $value): string
{
preg_match('/l=(https\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}\/\S*)?/', $value, $matches);
if(count($matches) < 2){
return "";
}
return str_replace(";", "",$this->prepareText($matches[1]));
}
function castA(string $value): string
{
preg_match('/a=(https\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}\/\S*)?/', $value, $matches);
if(count($matches) < 2){
return "";
}
return str_replace(";", "",$this->prepareText($matches[1]));
}
}