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

midcom_helper_xsspreventer::escape_element()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 8
ccs 0
cts 6
cp 0
crap 2
rs 10
c 0
b 0
f 0
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