Completed
Pull Request — master (#21)
by Daniel
02:31
created

Body::rewind()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid\View;
6
7
use Psi\Component\Grid\Metadata\GridMetadata;
8
use Psi\Component\Grid\CellFactory;
9
10
class Body implements \Iterator
11
{
12
    private $cellFactory;
13
    private $gridMetadata;
14
    private $collection;
15
16
    public function __construct(
17
        CellFactory $cellFactory,
18
        GridMetadata $gridMetadata,
19
        \Iterator $collection
20
    ) {
21
        $this->cellFactory = $cellFactory;
22
        $this->gridMetadata = $gridMetadata;
23
        $this->collection = $collection;
24
    }
25
26
    public function current()
27
    {
28
        return new Row(
29
            $this->cellFactory,
30
            $this->gridMetadata,
31
            $this->collection->current()
32
        );
33
    }
34
35
    public function next()
36
    {
37
        return $this->collection->next();
38
    }
39
40
    public function key()
41
    {
42
        return $this->collection->key();
43
    }
44
45
    public function rewind()
46
    {
47
        return $this->collection->rewind();
48
    }
49
50
    public function valid()
51
    {
52
        return $this->collection->valid() ? true : false;
53
    }
54
}
55