Completed
Push — master ( 00ba75...7df479 )
by Pol
03:33
created

Value::render()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
crap 2
1
<?php
2
3
namespace drupol\tagattributes\Plugins\Attribute;
4
5
use drupol\tagattributes\AttributeBase;
6
use drupol\tagattributes\AttributeInterface;
7
8
/**
9
 * Class Value.
10
 *
11
 * @package drupol\tagattributes\Plugins\Attribute
12
 */
13
class Value extends AttributeBase implements AttributeInterface
14
{
15
16
    const ATTRIBUTE = 'value';
17
18
    /**
19
     * {inheritdoc}
20
     */
21 2
    public function render()
22
    {
23 2
        $output = $this->getName();
24
25 2
        if (!empty($this->getValue())) {
26 2
            $output .= sprintf('="%s"', htmlspecialchars(implode(' ', $this->getValue()), ENT_COMPAT));
27
        }
28
29 2
        return $output;
30
    }
31
}
32