Failed Conditions
Pull Request — master (#2718)
by Ian
05:13
created

RewindableGenerator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 17
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getIterator() 0 4 1
1
<?php
2
3
namespace Doctrine\DBAL;
4
5
class RewindableGenerator implements \IteratorAggregate
6
{
7
    private $generator;
8
9
    /**
10
     * @param callable $generator
11
     */
12
    public function __construct(callable $generator)
13
    {
14
        $this->generator = $generator;
15
    }
16
17
    public function getIterator()
18
    {
19
        return ($this->generator)();
20
    }
21
}
22