EntryLoader   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

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