EscapeViewHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A execute() 0 6 2
1
<?php
2
namespace Fwk\Core\Components\ViewHelper;
3
4
class EscapeViewHelper extends AbstractViewHelper implements ViewHelper
5
{
6
    protected $quoteStyle;
7
    protected $charset;
8
    
9
    public function __construct($quoteStyle = ENT_QUOTES, $charset = "utf-8")
10
    {
11
        $this->quoteStyle = $quoteStyle;
12
        $this->charset = $charset;
13
    }
14
    
15
    public function execute(array $arguments)
16
    {
17
        $str = (isset($arguments[0]) ? $arguments[0] : "");
18
        
19
        return htmlentities($str, $this->quoteStyle, $this->charset);
20
    }
21
}