ConfigIterator::current()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PublishingKit\Config;
6
7
use ArrayIterator;
8
9
final class ConfigIterator extends ArrayIterator
10
{
11 3
    /**
12
     * @return Config|scalar
13 3
     */
14 3
    public function current()
15 3
    {
16
        /** @var array<array-key, array|scalar>|scalar **/
17 3
        $result = parent::current();
18
        if (is_array($result)) {
19
            return new Config($result);
20 2
        }
21
        return $result;
22
    }
23
}
24