Failed Conditions
Push — master ( 01d6ae...9ca6d9 )
by Philippe
534:14 queued 469:10
created

MultipleSource   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 25
rs 10
c 0
b 0
f 0
ccs 9
cts 9
cp 1
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toTexts() 0 5 3
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpSpellcheck\Source;
6
7
use Webmozart\Assert\Assert;
8
9
class MultipleSource implements SourceInterface
10
{
11
    /**
12
     * @var iterable<SourceInterface>
13
     */
14
    private $sources;
15
16 1
17
    /**
18 1
     * @param iterable<SourceInterface> $sources
19 1
     */
20 1
    public function __construct(iterable $sources)
21
    {
22
        Assert::allIsInstanceOf($sources, SourceInterface::class);
23
        $this->sources = $sources;
24
    }
25 1
26
    /**
27 1
     * {@inheritDoc}
28 1
     */
29 1
    public function toTexts(array $context = []): iterable
30
    {
31
        foreach ($this->sources as $source) {
32 1
            foreach ($source->toTexts($context) as $text) {
33
                yield $text->mergeContext($context, true);
34
            }
35
        }
36
    }
37
}
38