Cells::offsetGet()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Foo\Grid\Collection;
6
7
use Foo\Grid\Cell\ICell;
8
use InvalidArgumentException;
9
use LogicException;
10
11
class Cells extends BaseCollection
12
{
13
    const HEAD = 'thead';
14
15
    /** @var ICell[] */
16
    protected $components = [];
17
18
    /**
19
     * @return ICell
20
     * @throws LogicException
21
     */
22 5
    public function current()
23
    {
24
        /** @var ICell $object */
25 5
        $object = parent::current();
26
27 5
        $this->verifyReturn($object, ICell::class);
28
29 5
        return $object;
30
    }
31
32
    /**
33
     * @param int|null $offset
34
     * @param ICell    $value
35
     *
36
     * @throws InvalidArgumentException
37
     */
38 12
    public function offsetSet($offset, $value)
39
    {
40 12
        $this->verifyArgument($value, ICell::class);
41
42 11
        parent::offsetSet($offset, $value);
43 11
    }
44
45
    /**
46
     * @param int $offset
47
     *
48
     * @return ICell|null
49
     * @throws LogicException
50
     */
51 1
    public function offsetGet($offset)
52
    {
53
        /** @var ICell $object */
54 1
        $object = parent::offsetGet($offset);
55
56 1
        $this->verifyReturn($object, ICell::class);
57
58 1
        return $object;
59
    }
60
}
61