HtmlElement::getTag()   A
last analyzed

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