Element   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 158
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 2
cbo 0
dl 0
loc 158
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isVoid() 0 4 1
A isElement() 0 4 1
1
<?php
2
3
namespace BestServedCold\HTMLBuilder\Html\Node;
4
5
/**
6
 * Class Element
7
 * 
8
 * @package BestServedCold\HTMLBuilder\Html\Node
9
 */
10
abstract class Element
11
{
12
    /**
13
     * @var array $elements
14
     */
15
    private  static $elements = [
16
        'a',
17
        'abbr',
18
        'address',
19
        'area',
20
        'article',
21
        'aside',
22
        'audio',
23
        'b',
24
        'base',
25
        'bdi',
26
        'bdo',
27
        'blockquote',
28
        'body',
29
        'br',
30
        'button',
31
        'canvas',
32
        'caption',
33
        'cite',
34
        'code',
35
        'col',
36
        'colgroup',
37
        'datalist',
38
        'dd',
39
        'del',
40
        'details',
41
        'dfn',
42
        'dialog',
43
        'div',
44
        'dl',
45
        'dt',
46
        'em',
47
        'embed',
48
        'fieldset',
49
        'figcaption',
50
        'figure',
51
        'footer',
52
        'form',
53
        'h1',
54
        'h2',
55
        'h3',
56
        'h4',
57
        'h5',
58
        'h6',
59
        'head',
60
        'header',
61
        'hr',
62
        'html',
63
        'i',
64
        'iframe',
65
        'img',
66
        'input',
67
        'ins',
68
        'kbd',
69
        'keygen',
70
        'label',
71
        'legend',
72
        'li',
73
        'link',
74
        'main',
75
        'map',
76
        'mark',
77
        'menu',
78
        'menuitem',
79
        'meta',
80
        'meter',
81
        'nav',
82
        'noscript',
83
        'object',
84
        'ol',
85
        'optgroup',
86
        'option',
87
        'output',
88
        'p',
89
        'param',
90
        'picture',
91
        'pre',
92
        'progress',
93
        'q',
94
        'rp',
95
        'rt',
96
        'ruby',
97
        's',
98
        'samp',
99
        'script',
100
        'section',
101
        'select',
102
        'small',
103
        'source',
104
        'span',
105
        'strong',
106
        'style',
107
        'sub',
108
        'summary',
109
        'sup',
110
        'table',
111
        'tbody',
112
        'td',
113
        'textarea',
114
        'tfoot',
115
        'th',
116
        'thead',
117
        'time',
118
        'title',
119
        'tr',
120
        'track',
121
        'u',
122
        'ul',
123
        'var',
124
        'video',
125
        'wbr'
126
    ];
127
128
    /**
129
     * @var array $voidElements
130
     */
131
    private  static $voidElements = [
132
        'area',
133
        'base',
134
        'br',
135
        'col',
136
        'command',
137
        'embed',
138
        'hr',
139
        'img',
140
        'input',
141
        'keygen',
142
        'link',
143
        'meta',
144
        'param',
145
        'source',
146
        'track',
147
        'wbr'
148
    ];
149
150
    /**
151
     * @param  $element
152
     * @return bool
153
     */
154 2
    public static function isVoid($element)
155
    {
156 2
        return in_array($element, self::$voidElements);
157
    }
158
159
    /**
160
     * @param  $element
161
     * @return bool
162
     */
163 2
    public static function isElement($element)
164
    {
165 2
        return in_array($element, self::$elements);
166
    }
167
}
168