Completed
Push — develop ( aae47e...e01b9a )
by Tino
08:22
created

TextColumnType::doUnescape()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Copyright (c) by the ACP3 Developers.
5
 * See the LICENSE file at the top-level module directory for licensing details.
6
 */
7
8
namespace ACP3\Core\Model\DataProcessor\ColumnType;
9
10
use ACP3\Core\Helpers\Secure;
11
12
class TextColumnType implements ColumnTypeStrategyInterface
13
{
14
    /**
15
     * @var Secure
16
     */
17
    protected $secure;
18
19
    /**
20
     * TextColumnType constructor.
21
     *
22
     * @param Secure $secure
23
     */
24
    public function __construct(Secure $secure)
25
    {
26
        $this->secure = $secure;
27
    }
28
29
    /**
30
     * @param mixed $value
31
     *
32
     * @return string
33
     */
34
    public function doEscape($value)
35
    {
36
        return $this->secure->strEncode($value);
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function doUnescape($value)
43
    {
44
        return \html_entity_decode($value, ENT_QUOTES, 'UTF-8');
45
    }
46
47
    /**
48
     * @return string|int
49
     */
50
    public function getDefaultValue()
51
    {
52
        return '';
53
    }
54
}
55