SchemaProviderPipeline   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A read() 0 10 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Schema\Provider\Support;
6
7
use Cycle\Schema\Provider\Exception\SchemaProviderException;
8
use Cycle\Schema\Provider\SchemaProviderInterface;
9
10
/**
11
 * A class for working with a group of schema providers.
12
 * When the schema is read, it queues the specified schema providers using the {@see DeferredSchemaProviderDecorator}.
13
 */
14
final class SchemaProviderPipeline extends BaseProviderCollector
15
{
16 15
    public function read(?SchemaProviderInterface $nextProvider = null): ?array
17
    {
18 15
        if ($this->providers === null) {
19 1
            throw new SchemaProviderException(self::class . ' is not configured.');
20
        }
21 14
        if ($this->providers->count() === 0) {
22 4
            return $nextProvider?->read();
23
        }
24
25 11
        return $this->providers[0]->read($nextProvider);
26
    }
27
}
28