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

ArrayGridItem::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
rs 10
c 1
b 0
f 0
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
}