DomElementExt::getUserData()   A
last analyzed

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
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace Xml\Impl\Instance;
4
5
class DomElementExt extends \DOMElement
6
{
7
    private $userData = [];
8
9
    /**
10
     * @param mixed $key
11
     * @param mixed $data
12
     * @param mixed $handler
13
     */
14
    public function setUserData($key, $data, $handler): void
15
    {
16
        $this->userData[$key] = $data;
17
    }
18
19
    /**
20
     * @param mixed $key
21
     *
22
     * @return mixed
23
     */
24
    public function getUserData($key)
25
    {
26
        if (array_key_exists($key, $this->userData)) {
27
            return $this->userData[$key];
28
        }
29
        return null;
30
    }
31
}
32