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

MultipleSource::toTexts()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 3

Importance

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