Completed
Push — master ( ffdc94...b14464 )
by Frédéric
02:52
created

any   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 9
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
1
<?php namespace norsys\score\net\host;
2
3
use norsys\score\{
4
	net\host,
5
	php,
6
	php\string\regex\pcre,
7
	php\test\match\regex,
8
	php\test\recipient\ifFalse\exception\fallback as exception
9
};
10
11
class any extends php\string\any
12
	implements
13
		host
14
{
15
	function __construct(string $value, \exception $exception = null)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
16
	{
17
		parent::__construct($value);
18
19
		(
20
			new regex(
21
				new pcre('/^(?:[-a-z0-9._~!$&\'()*+,;=]|%[0-9a-f]{2})*$/'),
22
				$this
23
			)
24
		)
25
			->recipientOfTestIs(
26
				new exception(new \invalidArgumentException('Host must containes only *(ALPHA / DIGIT / "-" / "." / "_" / "~" /" %" HEXDIG HEXDIG / "!" / "$" / "&" / "\'" / "(" / ")" / "*" / "+" / "," / ";" / "=")'), $exception)
27
			)
28
		;
29
	}
30
}
31