Completed
Push — master ( d26e7d...811b94 )
by Lars
02:24
created

ArrayyRewindableExtendedGenerator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 11
ccs 6
cts 6
cp 1
crap 1
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arrayy;
6
7
/**
8
 * @template   XKey of array-key
9
 * @template   X
10
 * @extends    ArrayyRewindableGenerator<XKey,X>
11
 *
12
 * @internal
13
 */
14
class ArrayyRewindableExtendedGenerator extends ArrayyRewindableGenerator
15
{
16 1
    public function __construct(
17
        callable $generatorConstructionFunction,
18
        callable $onRewind = null,
19
        string $class = ''
20
    ) {
21 1
        parent::__construct(
22 1
            $generatorConstructionFunction,
23 1
            $onRewind,
24 1
            $class
25
        );
26 1
    }
27
28
    /**
29
     * Return the current element.
30
     *
31
     * @return mixed
32
     *
33
     * @see  http://php.net/manual/en/iterator.current.php
34
     * @see  Iterator::current
35
     *
36
     * @phpstan-return X
37
     */
38 1 View Code Duplication
    public function current()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40 1
        $value = $this->generator->current();
41
42 1
        if (\is_array($value)) {
43
            $value = \call_user_func([$this->class, 'create'], $value, static::class, false);
44
        }
45
46 1
        return $value;
47
    }
48
}
49