official::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 2
nc 1
nop 1
1
<?php namespace norsys\score\php\version\converter\toString;
2
3
use norsys\score\php\{ version\converter\toString, version, string\recipient, block };
4
use norsys\score\trampoline;
5
6
class official
7
	implements
8
		toString
9
{
10
	private
11
		$converter
12
	;
13
14
	function __construct(version\number\converter\toString $converter = null)
15
	{
16
		$this->converter = $converter ?: new version\number\converter\toString\asInteger;
17
	}
18
19
	function recipientOfPhpVersionAsStringIs(version $version, 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...
20
	{
21
		(
22
			new trampoline\container\fifo(
23
				new trampoline\functor(
24
					function($block, $version)
25
					{
26
						$version
27
							->toStringConverterOfMajorNumberInPhpVersionForRecipientIs(
28
								new recipient\block($block),
29
								$this->converter
30
							)
31
						;
32
					}
33
				),
34
				new trampoline\functor(
35
					function($block, $version)
36
					{
37
						$version
38
							->toStringConverterOfMinorNumberInPhpVersionForRecipientIs(
39
								new recipient\block($block),
40
								$this->converter
41
							)
42
						;
43
					}
44
				),
45
				new trampoline\functor(
46
					function($block, $version)
47
					{
48
						$version
49
							->toStringConverterOfReleaseNumberInPhpVersionForRecipientIs(
50
								new recipient\block($block),
51
								$this->converter
52
							)
53
						;
54
					}
55
				)
56
			)
57
		)
58
			->argumentsForBlockAre(
59
				new block\functor(
60
					function ($version, $recipient, $major, $minor, $release)
61
					{
62
						$recipient->stringIs($major . '.' . $minor . '.' . $release);
63
					}
64
				),
65
				$version,
66
				$recipient
67
			)
68
		;
69
	}
70
}
71