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

TagData::getTagValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
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