Escape   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
A escape() 0 4 1
1
<?php
2
3
namespace Faulancer\View\Helper;
4
5
use Faulancer\View\AbstractViewHelper;
6
7
/**
8
 * Class Escape | Escape.php
9
 *
10
 * @package Faulancer\View\Helper
11
 * @author  Florian Knapp <[email protected]>
12
 */
13
class Escape extends AbstractViewHelper
14
{
15
16
    /**
17
     * Gets called within view
18
     *
19
     * @param string $data The data which should be escaped
20
     *
21
     * @return mixed
22
     */
23
    public function __invoke(string $data)
24
    {
25
        return $this->escape($data);
26
    }
27
28
    /**
29
     * Escape string
30
     *
31
     * @param string $data The data which should be escaped
32
     *
33
     * @return string
34
     */
35
    protected function escape(string $data)
36
    {
37
        return htmlspecialchars($data);
38
    }
39
40
}