ArrayGridItem   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 6 2
A has() 0 3 1
A __call() 0 3 1
1
<?php
2
3
4
namespace Pfilsx\DataGrid\Grid\Items;
5
6
7
use Pfilsx\DataGrid\DataGridException;
8
9
class ArrayGridItem extends DataGridItem
10
{
11
    public function has(string $attribute): bool
12
    {
13
        return array_key_exists($attribute, $this->data);
14
    }
15
16
    public function get(string $attribute)
17
    {
18
        if ($this->has($attribute)){
19
            return $this->data[$attribute];
20
        }
21
        throw new DataGridException('Unknown property ' . $attribute);
22
    }
23
24
    public function __call(string $name, array $arguments)
25
    {
26
        throw new DataGridException('ArrayGridItem does not support methods invoke');
27
    }
28
}