ReverseOperation::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * File was created 06.05.2015 22:14
4
 *
5
 * @author Karsten J. Gerber <[email protected]>
6
 */
7
8
namespace PeekAndPoke\Component\Psi\Operation\FullSet;
9
10
use PeekAndPoke\Component\Psi\FullSetOperation;
11
12
/**
13
 * ReverseOperation
14
 *
15
 * @author Karsten J. Gerber <[email protected]>
16
 */
17
class ReverseOperation implements FullSetOperation
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 3
    public function apply(\Iterator $set)
23
    {
24 3
        $data = iterator_to_array($set);
25
26 3
        $reversed = array_reverse($data);
27
28 3
        return new \ArrayIterator($reversed);
29
    }
30
}
31