utf8   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A stringIs() 0 18 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