Completed
Push — master ( df5bb2...a0585b )
by Frédéric
03:38
created

rfc3986   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 14
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 1
A recipientOfPortInUriSchemeAsStringFromConverterIs() 0 3 1
1
<?php namespace norsys\score\net\uri\scheme;
2
3
use norsys\score\{
4
	php,
5
	net\port,
6
	net\uri\scheme
7
};
8
9
class rfc3986 extends php\string\lowercase
10
	implements
11
		scheme
12
{
13
	private $port;
14
15
	function __construct(string $string, port $port, \exception $exception = null)
16
	{
17
		parent::__construct($string);
18
19
		(
20
			new php\test\match\regex(
21
				new php\string\regex\pcre('/^[a-z][a-z0-9+-.]*$/'),
22
				$this
23
			)
24
		)
25
			->recipientOfTestIs(
26
				new php\test\recipient\ifFalse\exception\fallback(
27
					new \invalidArgumentException('Scheme must follow ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )'),
28
					$exception
29
				)
30
			)
31
		;
32
33
		$this->port = $port;
34
	}
35
36
	function recipientOfPortInUriSchemeAsStringFromConverterIs(port\converter\toString $converter, php\string\recipient $recipient) :void
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...
37
	{
38
		$converter->recipientOfNetPortAsStringIs($this->port, $recipient);
39
	}
40
}
41