EmptyTag   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A render() 0 6 1
1
<?php
2
namespace RoyallTheFourth\HtmlDocument\Tag;
3
4
use RoyallTheFourth\HtmlDocument\Set\AttributeSet;
5
6
final class EmptyTag implements TagInterface
7
{
8
    private $attributes;
9
    private $name;
10
11
    public function __construct(string $name, AttributeSet $attributes = null)
12
    {
13
        $this->attributes = $attributes ?? new AttributeSet();
14
        $this->name = $name;
15
    }
16
17
    public function render(): string
18
    {
19
        $attributes = $this->attributes->render();
20
21
        return "<{$this->name}{$attributes}>\n";
22
    }
23
}
24