Completed
Push — master ( d1c7cc...233b03 )
by Marcel
01:43
created

ConditionHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 1
1
<?php
2
3
namespace BeyondCode\TagHelper\Helpers;
4
5
use BeyondCode\TagHelper\Helper;
6
use BeyondCode\TagHelper\Html\HtmlElement;
7
8
class ConditionHelper extends Helper
9
{
10
    protected $targetAttribute = 'if';
11
12
    public function process(HtmlElement $element)
13
    {
14
        $condition = $element->getAttribute('if');
15
16
        $element->removeAttribute('if');
17
18
        $outerText = '@if('.$condition.') ';
19
        $outerText .= $element->getOuterText();
20
        $outerText .= ' @endif';
21
22
        $element->setOuterText($outerText);
23
24
    }
25
}
26