Test Failed
Pull Request — master (#19)
by Flo
03:12
created

Escape::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Faulancer\View\Helper;
4
5
use Faulancer\View\AbstractViewHelper;
6
use Faulancer\View\ViewController;
7
8
/**
9
 * Class Escape | Escape.php
10
 *
11
 * @package Faulancer\View\Helper
12
 * @author  Florian Knapp <[email protected]>
13
 */
14
class Escape extends AbstractViewHelper
15
{
16
17
    /**
18
     * Gets called within view
19
     *
20
     * @param ViewController $view The view controller
21
     * @param string         $data The data which should be escaped
22
     *
23
     * @return mixed
24
     */
25
    public function __invoke(ViewController $view, string $data)
26
    {
27
        return $this->escape($data);
28
    }
29
30
    /**
31
     * Escape string
32
     *
33
     * @param string $data The data which should be escaped
34
     *
35
     * @return string
36
     */
37
    protected function escape(string $data)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
38
    {
39
        return htmlspecialchars($data);
40
    }
41
42
}