RegexpReplaceSanitizer::getJsonData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace fieldwork\sanitizers;
4
5
class RegexpReplaceSanitizer extends RegexReplaceSanitizer
6
{
7
8
    private $regexp, $regexpmod;
9
10
    public function __construct ($from, $regexp, $to, $regexpmod = 'g')
11
    {
12
        parent::__construct($from, $to);
13
        $this->regexp    = $regexp;
14
        $this->regexpmod = $regexpmod;
15
    }
16
17
    public function isLive ()
18
    {
19
        return true;
20
    }
21
22
    public function describeObject ()
23
    {
24
        return 'regexp';
25
    }
26
27
    public function getJsonData ()
28
    {
29
        return array_merge(parent::getJsonData(), array(
30
            'regexp'    => $this->regexp,
31
            'regexpmod' => $this->regexpmod,
32
            'replace'   => $this->to
33
        ));
34
    }
35
}