|
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 |
|
|
|
|
|
|
23
|
|
|
{ |
|
24
|
|
|
$semver |
|
25
|
|
|
->recipientOfMajorNumberAsStringFromConverterIs( |
|
26
|
|
|
$this->majorToString, |
|
27
|
|
|
$recipient |
|
28
|
|
|
) |
|
29
|
|
|
; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
function recipientOfMinorInSemverVersionAsStringIs(semver $semver, php\string\recipient $recipient) :void |
|
|
|
|
|
|
33
|
|
|
{ |
|
34
|
|
|
$semver |
|
35
|
|
|
->recipientOfMinorNumberAsStringFromConverterIs( |
|
36
|
|
|
$this->minorToString, |
|
37
|
|
|
$recipient |
|
38
|
|
|
) |
|
39
|
|
|
; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
function recipientOfPatchInSemverVersionAsStringIs(semver $semver, php\string\recipient $recipient) :void |
|
|
|
|
|
|
43
|
|
|
{ |
|
44
|
|
|
$semver |
|
45
|
|
|
->recipientOfPatchNumberAsStringFromConverterIs( |
|
46
|
|
|
$this->patchToString, |
|
47
|
|
|
$recipient |
|
48
|
|
|
) |
|
49
|
|
|
; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
function recipientOfSemverVersionAsStringIs(semver $semver, php\string\recipient $recipient) :void |
|
|
|
|
|
|
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
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.