AwakingCursorIterator::current()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Created by IntelliJ IDEA.
4
 * User: gerk
5
 * Date: 06.01.17
6
 * Time: 20:24
7
 */
8
9
namespace PeekAndPoke\Component\Slumber\Data;
10
11
use PeekAndPoke\Component\Slumber\Core\Codec\Awaker;
12
13
14
/**
15
 * @author Karsten J. Gerber <[email protected]>
16
 */
17
class AwakingCursorIterator extends \IteratorIterator
18
{
19
    /** @var Awaker */
20
    private $awaker;
21
    /** @var \ReflectionClass */
22
    private $entityClass;
23
24
    /**
25
     * @param \Traversable     $inner
26
     * @param Awaker           $awaker
27
     * @param \ReflectionClass $entityClass
28
     */
29 4
    public function __construct(\Traversable $inner, Awaker $awaker, \ReflectionClass $entityClass)
30
    {
31 4
        parent::__construct($inner);
32
33 4
        $this->awaker      = $awaker;
34 4
        $this->entityClass = $entityClass;
35 4
    }
36
37
    /**
38
     * @return mixed
39
     */
40 4
    public function current()
41
    {
42 4
        $value = parent::current();
43
44 4
        return $this->awaker->awake($value, $this->entityClass);
45
    }
46
}
47