IterateArrayStep   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 31
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A next() 0 4 1
A valid() 0 3 1
A describe() 0 3 1
A count() 0 3 1
A getProgress() 0 3 1
A execute() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Darkilliant\ProcessBundle\Step;
6
7
use Darkilliant\ProcessBundle\State\ProcessState;
8
9
class IterateArrayStep extends AbstractConfigurableStep implements IterableStepInterface
10
{
11 9
    public function execute(ProcessState $state)
12
    {
13 9
        $state->setIterator(new \ArrayIterator($state->getData()));
14 9
    }
15
16 7
    public function next(ProcessState $state)
17
    {
18 7
        $state->setData($state->getIterator()->current());
19 7
        $state->getIterator()->next();
20 7
    }
21
22 5
    public function valid(ProcessState $state): bool
23
    {
24 5
        return $state->getIterator()->valid();
25
    }
26
27 9
    public function count(ProcessState $state)
28
    {
29 9
        return $state->getIterator()->count();
30
    }
31
32 2
    public function describe(ProcessState $state)
33
    {
34 2
        $state->info('Each one line of array of {count} lines', ['count' => 'X']);
35 2
    }
36
37 6
    public function getProgress(ProcessState $state)
38
    {
39 6
        return $state->getIterator()->key();
40
    }
41
}
42