WildcardDomain   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 0 3 1
A match() 0 6 1
1
<?php
2
3
namespace Whitelist\Definition;
4
5
/**
6
 * Represents a wildcard domain definition
7
 *
8
 * @author Sam Stenvall <[email protected]>
9
 * @copyright Copyright &copy; Sam Stenvall 2014-
10
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
11
 */
12
class WildcardDomain extends Definition
13
{
14
15
    public function validate()
16
    {
17
        return true;
18
    }
19
20
    public function match($value)
21
    {
22
        // Remove the wildcard part and check if it matches the end of $value
23
        $domain = substr($this->_definition, 1);
24
25
        return substr($value, -strlen($domain)) === $domain;
26
    }
27
28
}
29