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