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

Escape   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

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
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
}