Body::valid()   A
last analyzed

Complexity

Conditions 2
Paths 2

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 2
eloc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid\View;
6
7
use Psi\Component\Grid\ColumnFactory;
8
use Psi\Component\Grid\GridContext;
9
use Psi\Component\Grid\Metadata\GridMetadata;
10
11
class Body implements \Iterator
12
{
13
    private $cellFactory;
14
    private $gridMetadata;
15
    private $gridContext;
16
    private $collection;
17
18 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
        ColumnFactory $cellFactory,
20
        GridMetadata $gridMetadata,
21
        GridContext $gridContext,
22
        \Iterator $collection
23
    ) {
24
        $this->cellFactory = $cellFactory;
25
        $this->gridMetadata = $gridMetadata;
26
        $this->gridContext = $gridContext;
27
        $this->collection = $collection;
28
    }
29
30
    public function current()
31
    {
32
        return new Row(
33
            $this->cellFactory,
34
            $this->gridMetadata,
35
            $this->gridContext,
36
            $this->collection->current()
37
        );
38
    }
39
40
    public function next()
41
    {
42
        return $this->collection->next();
43
    }
44
45
    public function key()
46
    {
47
        return $this->collection->key();
48
    }
49
50
    public function rewind()
51
    {
52
        return $this->collection->rewind();
53
    }
54
55
    public function valid()
56
    {
57
        return $this->collection->valid() ? true : false;
58
    }
59
}
60