Enumerating   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
c 3
b 0
f 0
lcom 1
cbo 2
dl 0
loc 20
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A step() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Arnaud LEMAIRE  <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Fp\Reducer;
13
14
class Enumerating implements Reducer
15
{
16
    use Mixin\Stateless;
17
18
    protected $next_reducer;
19
    protected $counter;
20
21 3
    public function __construct(Reducer $next_reducer, $start = 0)
22
    {
23 3
        $this->next_reducer = $next_reducer;
24 3
        $this->counter = $start;
25 3
    }
26
27 2
    public function step($result, $current)
28
    {
29 2
        $index = $this->counter++;
30
31 2
        return $this->next_reducer->step($result, [$index, $current]);
32
    }
33
}
34