Row   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 62
rs 10
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A offsetUnset() 0 3 1
A offsetSet() 0 3 1
A set() 0 3 1
A setAttributes() 0 3 1
A getAttributes() 0 3 1
A offsetGet() 0 3 1
A __set() 0 3 1
A offsetExists() 0 3 1
A __get() 0 3 1
A remove() 0 3 1
A get() 0 3 1
1
<?php
2
3
namespace Coco\SourceWatcher\Core;
4
5
use ArrayAccess;
6
7
/**
8
 * Class Row
9
 * @package Coco\SourceWatcher\Core
10
 */
11
class Row implements ArrayAccess, ArrayListAccess
12
{
13
    private array $attributes;
14
15
    public function __construct ( array $attributes )
16
    {
17
        $this->attributes = $attributes;
18
    }
19
20
    public function getAttributes () : array
21
    {
22
        return $this->attributes;
23
    }
24
25
    public function setAttributes ( array $attributes ) : void
26
    {
27
        $this->attributes = $attributes;
28
    }
29
30
    public function offsetExists ( $offset )
31
    {
32
        return array_key_exists( $offset, $this->attributes );
33
    }
34
35
    public function offsetGet ( $offset )
36
    {
37
        return $this->attributes[$offset];
38
    }
39
40
    public function offsetSet ( $offset, $value )
41
    {
42
        $this->attributes[$offset] = $value;
43
    }
44
45
    public function offsetUnset ( $offset )
46
    {
47
        unset( $this->attributes[$offset] );
48
    }
49
50
    public function get ( string $key )
51
    {
52
        return $this->attributes[$key] ?? null;
53
    }
54
55
    public function set ( string $key, $value ) : void
56
    {
57
        $this->attributes[$key] = $value;
58
    }
59
60
    public function remove ( string $key ) : void
61
    {
62
        unset( $this->attributes[$key] );
63
    }
64
65
    public function __get ( $key )
66
    {
67
        return $this->attributes[$key];
68
    }
69
70
    public function __set ( $key, $value )
71
    {
72
        $this->attributes[$key] = $value;
73
    }
74
}
75