Passed
Push — master ( be6fbd...8a140a )
by Andreas
24:16
created

midcom_helper_xsspreventer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 9
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A escape_attribute() 0 4 1
1
<?php
2
/**
3
 * @package midcom.helper
4
 * @author CONTENT CONTROL http://www.contentcontrol-berlin.de/
5
 * @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/
6
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
7
 */
8
9
/**
10
 * Library for escaping user provided values displayed for example in input etc
11
 *
12
 * @package midcom.helper
13
 */
14
class midcom_helper_xsspreventer
15
{
16
    /**
17
     * Escape value of an XML attribute, also adds quotes around it
18
     */
19 4
    public static function escape_attribute(string $input) : string
20
    {
21 4
        $output = str_replace('"', '&quot;', $input);
22 4
        return '"' . $output . '"';
23
    }
24
}
25