Completed
Pull Request — master (#10)
by
unknown
01:00
created

IPAddress   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A match() 0 14 2
1
<?php
2
3
namespace Safelist\Definition;
4
5
/**
6
 * Represents an IP address 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
abstract class IPAddress extends Definition
13
{
14
15
	public function match($value)
16
	{
17
		try
18
		{
19
			$address = \IpUtils\Factory::getAddress($this->_definition);
20
			$otherAddress = \IpUtils\Factory::getExpression($value);
21
			return $address->matches($otherAddress);
22
		}
23
		catch (\Exception $e)
24
		{
25
			unset($e);
26
			return false;
27
		}
28
	}
29
30
}
31