any   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A recipientOfIdentifierFromToStringConverterIs() 0 11 1
A __construct() 0 3 1
A recipientOfStringIs() 0 2 1
1
<?php namespace norsys\score\php\aNamespace;
2
3
use norsys\score\php;
4
5
use norsys\score\php\{
6
	aNamespace,
7
	identifier,
8
	identifier\converter\toString as converter,
9
	string\recipient
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, norsys\score\php\aNamespace\recipient. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
10
};
11
12
use norsys\score\container\{
13
	fifo,
14
	iterator\block\functor as block
15
};
16
17
class any
18
	implements
19
		aNamespace
20
{
21
	private
22
		$identifiers
23
	;
24
25
	function __construct(identifier... $identifiers)
26
	{
27
		$this->identifiers = $identifiers;
28
	}
29
30
	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...
31
	{
32
	}
33
34
	function recipientOfIdentifierFromToStringConverterIs(converter $converter, 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
		(
37
			new fifo(
38
				... $this->identifiers
39
			)
40
		)
41
			->blockForIteratorIs(
42
				new block(
43
					function($iterator, $identifier) use ($converter, $recipient) {
44
						$converter->recipientOfPhpIdentifierAsStringIs($identifier, $recipient);
45
					}
46
				)
47
			)
48
		;
49
	}
50
}
51