AwakingCursorIterator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A current() 0 6 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