UniqueStringList   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 27
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A all() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Funivan\CabbageCore\String\StringList\Unique;
6
7
use Funivan\CabbageCore\String\StringList\StringListInterface;
8
9
class UniqueStringList implements StringListInterface
10
{
11
12
    /**
13
     * @var StringListInterface
14
     */
15
    private $original;
16
17
18 1
    public function __construct(StringListInterface $original)
19
    {
20 1
        $this->original = $original;
21 1
    }
22
23
24
    /**
25
     * @return string[]|\Generator
26
     */
27 1
    public function all(): \Generator
28
    {
29 1
        yield from array_values(
30 1
            array_unique(
31 1
                iterator_to_array($this->original->all())
32
            )
33
        );
34 1
    }
35
}
36