Passed
Push — main ( 6c9276...76dcd0 )
by Anatoly
06:53 queued 02:07
created

Collection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 23
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A offsetSet() 0 3 1
A offsetUnset() 0 3 1
A offsetGet() 0 4 1
A offsetExists() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Sunrise\Hydrator\Tests\Stub;
6
7
use ArrayAccess;
8
use ReturnTypeWillChange;
9
10
class Collection implements ArrayAccess
11
{
12
    public array $elements = [];
13
14
    public function offsetExists($offset): bool
15
    {
16
        return isset($this->elements[$offset]);
17
    }
18
19
    #[ReturnTypeWillChange]
20
    public function offsetGet($offset)
21
    {
22
        return $this->elements[$offset] ?? null;
23
    }
24
25
    public function offsetSet($offset, $value): void
26
    {
27
        $this->elements[$offset] = $value;
28
    }
29
30
    public function offsetUnset($offset): void
31
    {
32
        unset($this->elements[$offset]);
33
    }
34
}
35