HtmlElement   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 27
ccs 0
cts 10
cp 0
rs 10
c 2
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A renderHtmlMarkup() 0 3 1
A getTag() 0 3 1
A __construct() 0 6 1
A getInnerHtml() 0 3 1
1
<?php
2
3
namespace WebTheory\Html;
4
5
use WebTheory\Html\Contracts\HtmlInterface;
6
7
class HtmlElement extends AbstractHtmlElement implements HtmlInterface
8
{
9
    protected string $tag;
10
11
    protected string $innerHtml = '';
12
13
    public function __construct(string $tag, ?string $innerHtml = null)
14
    {
15
        $this->tag = $tag;
16
        $this->innerHtml = $innerHtml ?? $this->innerHtml;
17
18
        parent::__construct();
19
    }
20
21
    public function getTag(): string
22
    {
23
        return $this->tag;
24
    }
25
26
    public function getInnerHtml(): string
27
    {
28
        return $this->innerHtml;
29
    }
30
31
    protected function renderHtmlMarkup(): string
32
    {
33
        return $this->tag($this->tag, $this->attributes, $this->innerHtml);
34
    }
35
}
36