Passed
Push — master ( 42f7e7...125d75 )
by Frédéric
02:06
created

any::recipientOfPatchNumberInSemverIs()   A

Complexity

Conditions 1
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 1
nc 1
nop 1
1
<?php namespace norsys\score\composer\depedency\version\semver;
2
3
use norsys\score\{ composer\depedency\version\semver, php };
4
5
class any
6
	implements
7
		semver
8
{
9
	private
10
		$major,
11
		$minor,
12
		$patch,
13
		$semverToStringConverter
14
	;
15
16
	function __construct(semver\number $major = null, semver\number $minor = null, semver\number $patch = null, semver\converter\toString $semverToStringConverter = null)
17
	{
18
		$this->major = self::numberIs($major);
19
		$this->minor = self::numberIs($minor);
20
		$this->patch = self::numberIs($patch);
21
		$this->semverToStringConverter = $semverToStringConverter ?: new semver\converter\toString\dot\aggregator;
22
	}
23
24
	function recipientOfMajorNumberInSemverIs(semver\number\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...
25
	{
26
		$recipient->semverVersionNumberIs($this->major);
27
	}
28
29
	function recipientOfMajorNumberAsStringFromConverterIs(semver\number\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...
30
	{
31
		$converter->recipientOfSemverNumberAsStringIs($this->major, $recipient);
32
	}
33
34
	function recipientOfMinorNumberInSemverIs(semver\number\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...
35
	{
36
		$recipient->semverVersionNumberIs($this->minor);
37
	}
38
39
	function recipientOfMinorNumberAsStringFromConverterIs(semver\number\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...
40
	{
41
		$converter->recipientOfSemverNumberAsStringIs($this->minor, $recipient);
42
	}
43
44
	function recipientOfPatchNumberInSemverIs(semver\number\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...
45
	{
46
		$recipient->semverVersionNumberIs($this->patch);
47
	}
48
49
	function recipientOfPatchNumberAsStringFromConverterIs(semver\number\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...
50
	{
51
		$converter->recipientOfSemverNumberAsStringIs($this->patch, $recipient);
52
	}
53
54
	function recipientOfStringIs(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...
55
	{
56
		$this->semverToStringConverter
57
			->recipientOfSemverVersionAsStringIs(
58
				$this,
59
				$recipient
60
			)
61
		;
62
	}
63
64
	private static function numberIs($variable)
65
	{
66
		return $variable ?: new semver\number\any;
67
	}
68
}
69