Failed Conditions
Push — perf-tests ( 50942d...2fc93e )
by Adrien
14:53
created

ODS::escape()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Box\Spout\Common\Escaper;
4
5
use Box\Spout\Common\Singleton;
6
7
/**
8
 * Class ODS
9
 * Provides functions to escape and unescape data for ODS files
10
 *
11
 * @package Box\Spout\Common\Escaper
12
 */
13
class ODS implements EscaperInterface
14
{
15
    use Singleton;
16
17
    /**
18
     * Escapes the given string to make it compatible with XLSX
19
     *
20
     * @param string $string The string to escape
21
     * @return string The escaped string
22
     */
23
    public function escape($string)
24
    {
25
        return htmlspecialchars($string, ENT_QUOTES);
26
    }
27
28
    /**
1 ignored issue
show
introduced by
Instead of declaring the constructor as final, maybe you should declare the entire class as final.
Loading history...
29
     * Unescapes the given string to make it compatible with XLSX
30
     *
31
     * @param string $string The string to unescape
32
     * @return string The unescaped string
33
     */
34
    public function unescape($string)
35
    {
36
        return htmlspecialchars_decode($string, ENT_QUOTES);
37
    }
38
}
39