HtmlAttribute   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A tokenize() 0 3 1
A setValue() 0 5 1
A __construct() 0 3 1
A parse() 0 3 1
1
<?php
2
3
namespace WebTheory\Html\Attributes;
4
5
use Stringable;
6
use WebTheory\Html\Contracts\HtmlAttributeInterface;
7
8
class HtmlAttribute extends AbstractHtmlAttribute implements HtmlAttributeInterface
9
{
10
    /**
11
     * @var string|int|float|bool|null|Stringable
12
     */
13
    protected $value = '';
14
15
    public function __construct(string $name)
16
    {
17
        $this->name = $name;
18
    }
19
20
    /**
21
     * @param string|int|float|bool|null|Stringable $value
22
     *
23
     * @return $this
24
     */
25
    public function setValue($value): HtmlAttribute
26
    {
27
        $this->value = $value;
28
29
        return $this;
30
    }
31
32
    public function parse(): string
33
    {
34
        return (string) $this->value;
35
    }
36
37
    public function tokenize(string $attribute): string
38
    {
39
        return $attribute;
40
    }
41
}
42