Passed
Push — master ( 32cb6d...84b76e )
by Sergey
04:44
created

DnsZoneDomainNameValidator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 9 2
1
<?php
2
/**
3
 * @author: Viskov Sergey
4
 * @date  : 4/12/16
5
 * @time  : 1:00 PM
6
 */
7
8
namespace LTDBeget\dns\configurator\validators;
9
10
/**
11
 * Class DnsZoneDomainNameValidator
12
 *
13
 * @package beget\lib\dns\lib\validators
14
 */
15
class DnsZoneDomainNameValidator
16
{
17
    /**
18
     * @param $hostname
19
     * @return bool
20
     */
21 1
    public static function validate(string $hostname) : bool 
22
    {
23 1
        $hostname = preg_replace('/^\*\./', '', $hostname);
24 1
        if(in_array($hostname, ['@', '*', '.'])) {
25 1
            return true;
26
        }
27
28 1
        return OriginValidator::validate($hostname);
29
    }
30
}
31