RegexpReplaceSanitizer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 1
cbo 1
dl 0
loc 31
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A isLive() 0 4 1
A describeObject() 0 4 1
A getJsonData() 0 8 1
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
}