rfc3986::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 19
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 3
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