utf8::stringIs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 18
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php namespace norsys\score\php\string\recipient;
2
3
use norsys\score\php\{ string\recipient, test\variable\isTrue\strictly as isTrue, test\recipient\ifTrue\functor as ifTrue };
4
5
class utf8
6
	implements
7
		recipient
8
{
9
	private
10
		$recipient
11
	;
12
13
	function __construct(recipient $recipient)
14
	{
15
		$this->recipient = $recipient;
16
	}
17
18
	function stringIs(string $string) :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...
19
	{
20
		(
21
			new isTrue(
22
				utf8_decode($string) == $string
23
			)
24
		)
25
			->recipientOfTestIs(
26
				new ifTrue(
27
					function() use (& $string)
28
					{
29
						$string = utf8_encode($string);
30
					}
31
				)
32
			)
33
		;
34
35
		$this->recipient->stringIs($string);
36
	}
37
}
38