UniqueStringList::all()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 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