HasAttributesTrait::getAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Del\Form\Traits;
4
5
6
trait HasAttributesTrait
7
{
8
    private array $attributes = [];
9
10 68
    public function getAttribute(string $key): mixed
11
    {
12 68
        return isset($this->attributes[$key]) ? $this->attributes[$key] : null;
13
    }
14
15 71
    public function setAttribute(string $key, $value): void
16
    {
17 71
        $this->attributes[$key] = $value;
18
    }
19
20 1
    public function setAttributes(array $attributes): void
21
    {
22 1
        $this->attributes = $attributes;
23
    }
24
25 36
    public function getAttributes(): array
26
    {
27 36
        return $this->attributes;
28
    }
29
}
30