Completed
Push — master ( f15fe2...9a8393 )
by Pavel
07:23 queued 11s
created

ArrayGridItem   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 6 2
A has() 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
}