dot   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 52
dl 0
loc 105
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 4
A recipientOfMinorInSemverVersionAsStringIs() 0 6 1
A recipientOfSemverVersionAsStringIs() 0 58 1
A recipientOfPatchInSemverVersionAsStringIs() 0 6 1
A recipientOfMajorInSemverVersionAsStringIs() 0 6 1
1
<?php namespace norsys\score\composer\depedency\version\semver\converter\toString;
2
3
use norsys\score\{ trampoline, composer\depedency\version\semver, php };
4
5
class dot
6
	implements
7
		semver\converter\toString
8
{
9
	private
10
		$majorToString,
11
		$minorToString,
12
		$patchToString
13
	;
14
15
	function __construct(semver\number\converter\toString $majorToString = null, semver\number\converter\toString $minorToString = null, semver\number\converter\toString $patchToString = null)
16
	{
17
		$this->majorToString = $majorToString ?: new semver\number\converter\toString\identical;
18
		$this->minorToString = $minorToString ?: new semver\number\converter\toString\identical;
19
		$this->patchToString = $patchToString ?: new semver\number\converter\toString\identical;
20
	}
21
22
	function recipientOfMajorInSemverVersionAsStringIs(semver $semver, 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...
23
	{
24
		$semver
25
			->recipientOfMajorNumberAsStringFromConverterIs(
26
				$this->majorToString,
27
				$recipient
28
			)
29
		;
30
	}
31
32
	function recipientOfMinorInSemverVersionAsStringIs(semver $semver, 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...
33
	{
34
		$semver
35
			->recipientOfMinorNumberAsStringFromConverterIs(
36
				$this->minorToString,
37
				$recipient
38
			)
39
		;
40
	}
41
42
	function recipientOfPatchInSemverVersionAsStringIs(semver $semver, 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...
43
	{
44
		$semver
45
			->recipientOfPatchNumberAsStringFromConverterIs(
46
				$this->patchToString,
47
				$recipient
48
			)
49
		;
50
	}
51
52
	function recipientOfSemverVersionAsStringIs(semver $semver, 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...
53
	{
54
		(
55
			new trampoline\container\fifo(
56
				new trampoline\functor(
57
					function($block) use ($semver)
58
					{
59
						$this
60
							->recipientOfMajorInSemverVersionAsStringIs(
61
								$semver,
62
								new php\string\recipient\block($block)
63
							)
64
						;
65
					}
66
				),
67
				new trampoline\functor(
68
					function($block) use ($semver)
69
					{
70
						$this
71
							->recipientOfMinorInSemverVersionAsStringIs(
72
								$semver,
73
								new php\string\recipient\block($block)
74
							)
75
						;
76
					}
77
				),
78
				new trampoline\functor(
79
					function($block) use ($semver)
80
					{
81
						$this
82
							->recipientOfPatchInSemverVersionAsStringIs(
83
								$semver,
84
								new php\string\recipient\block($block)
85
							)
86
						;
87
					}
88
				)
89
			)
90
		)
91
			->argumentsForBlockAre(
92
				new php\block\functor(
93
					function($recipient, $major, $minor, $patch)
94
					{
95
						(
96
							new php\string\operator\unary\join(
97
								$major,
98
								$minor,
99
								$patch
100
							)
101
						)
102
							->recipientOfStringOperationWithStringIs(
103
								'.',
104
								$recipient
105
							)
106
						;
107
					}
108
				),
109
				$recipient
110
			)
111
		;
112
	}
113
}
114