Failed Conditions
Push — master ( 8fb951...fb1394 )
by Arnold
03:15
created

EntryLoader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A prepareNext() 0 15 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jasny\Container\Loader;
6
7
use function Jasny\expect_type;
8
9
/**
10
 * Load entries from declaration PHP files
11
 */
12
class EntryLoader extends AbstractLoader
13
{
14
    /**
15
     * Load new entries
16
     *
17
     * @return void
18
     */
19 8
    protected function prepareNext(): void
20
    {
21 8
        if (!$this->items->valid()) {
22 2
            return;
23
        }
24
25 6
        $file = $this->items->current();
26
27 6
        $entries = include $file;
28 6
        expect_type($entries, 'array', \UnexpectedValueException::class,
29 6
            "Failed to load container entries from '$file': Invalid or no return value");
30
31 6
        $this->entries = new \ArrayIterator($entries);
32
33 6
        $this->items->next();
34 6
    }
35
}
36