ArrayGridItem::has()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
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
24
    public function __call(string $name, array $arguments)
25
    {
26
        throw new DataGridException('ArrayGridItem does not support methods invoke');
27
    }
28
}