Attr   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getProperties() 0 9 2
A isEmpty() 0 8 3
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/WebinoDraw for the canonical source repository
6
 * @copyright   Copyright (c) 2012-2017 Webino, s. r. o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoDraw\Dom;
12
13
/**
14
 * Extended DOMAttr
15
 */
16
class Attr extends \DOMAttr implements NodeInterface
17
{
18
    /**
19
     * Returns the node text value
20
     *
21
     * @param null $prefix
22
     * @return array
23
     */
24
    public function getProperties($prefix = null)
25
    {
26
        $properties = [$prefix . $this::NODE_VALUE_PROPERTY => ''];
27
28
        empty($this->nodeValue)
29
            or $properties[$prefix . $this::NODE_VALUE_PROPERTY] = $this->nodeValue;
30
31
        return $properties;
32
    }
33
34
    /**
35
     * @return bool
36
     */
37
    public function isEmpty()
38
    {
39
        $nodeValue = trim($this->nodeValue);
40
        if (!empty($nodeValue) || is_numeric($nodeValue)) {
41
            return false;
42
        }
43
        return true;
44
    }
45
}
46