Completed
Push — master ( 955ba6...0ff49e )
by Chris
04:38
created

TagData   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 28
c 0
b 0
f 0
ccs 0
cts 8
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setTagValue() 0 3 1
A removeTagValue() 0 3 1
A hasTagValue() 0 3 1
A getTagValue() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace DaveRandom\Jom;
4
5
trait TagData
6
{
7
    protected $tagData = [];
8
9
    final public function hasTagValue(string $key): bool
10
    {
11
        return \array_key_exists($key, $this->tagData);
12
    }
13
14
    /**
15
     * @return mixed
16
     */
17
    final public function getTagValue(string $key)
18
    {
19
        return $this->tagData[$key] ?? null;
20
    }
21
22
    /**
23
     * @param mixed $value
24
     */
25
    final public function setTagValue(string $key, $value): void
26
    {
27
        $this->tagData[$key] = $value;
28
    }
29
30
    final public function removeTagValue(string $key): void
31
    {
32
        unset($this->tagData[$key]);
33
    }
34
}
35