Passed
Branch etl-core (c0e492)
by Jean Paul
01:52
created

Row   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 92
Duplicated Lines 0 %

Importance

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

13 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
A transform() 0 2 1
1
<?php
2
3
namespace Coco\SourceWatcher\Core;
4
5
use ArrayAccess;
6
7
class Row implements ArrayAccess, ArrayListAccess
8
{
9
    /**
10
     * @var array
11
     */
12
    private array $attributes;
13
14
    /**
15
     * Row constructor.
16
     * @param array $attributes
17
     */
18
    public function __construct ( array $attributes )
19
    {
20
        $this->attributes = $attributes;
21
    }
22
23
    /**
24
     * @return array
25
     */
26
    public function getAttributes () : array
27
    {
28
        return $this->attributes;
29
    }
30
31
    /**
32
     * @param array $attributes
33
     */
34
    public function setAttributes ( array $attributes ) : void
35
    {
36
        $this->attributes = $attributes;
37
    }
38
39
    public function transform ()
40
    {
41
42
    }
43
44
    /**
45
     * @inheritDoc
46
     */
47
    public function offsetExists ( $offset )
48
    {
49
        return array_key_exists( $offset, $this->attributes );
50
    }
51
52
    /**
53
     * @inheritDoc
54
     */
55
    public function offsetGet ( $offset )
56
    {
57
        return $this->attributes[$offset];
58
    }
59
60
    /**
61
     * @inheritDoc
62
     */
63
    public function offsetSet ( $offset, $value )
64
    {
65
        $this->attributes[$offset] = $value;
66
    }
67
68
    /**
69
     * @inheritDoc
70
     */
71
    public function offsetUnset ( $offset )
72
    {
73
        unset( $this->attributes[$offset] );
74
    }
75
76
    public function get ( string $key )
77
    {
78
        return $this->attributes[$key] ?? null;
79
    }
80
81
    public function set ( string $key, $value ) : void
82
    {
83
        $this->attributes[$key] = $value;
84
    }
85
86
    public function remove ( string $key ) : void
87
    {
88
        unset( $this->attributes[$key] );
89
    }
90
91
    public function __get ( $key )
92
    {
93
        return $this->attributes[$key];
94
    }
95
96
    public function __set ( $key, $value )
97
    {
98
        $this->attributes[$key] = $value;
99
    }
100
}
101