clrghouz/app/Traits/ParseZNFPDomain.php
2019-05-06 22:29:29 +10:00

26 lines
606 B
PHP

<?php
namespace App\Traits;
trait ParseZNFPDomain
{
private function parse_znfp_domain(string $data,$create=TRUE)
{
$z = substr($data,0,strpos($data,':'));
$x = strpos($data,':')+1;
$n = substr($data,$x,strpos($data,'/')-$x);
$x = strpos($data,'/')+1;
$f = substr($data,$x,(strpos($data,'.') OR strpos($data,'@')) ?: strlen($data)-$x);
$x = strpos($data,'.');
$p = $x ? substr($data,$x+1,strpos($data,'@') ?: strlen($data)-$x) : 0;
// @todo We dont handle domain yet.
$x = strpos($data,'@');
$d = $x ? substr($data,$x+1) : 0;
return $this->get_node($z,$n,$f,$p,$create);
}
}