Filter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 17
c 1
b 0
f 1
dl 0
loc 31
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A filter() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Codeat3\FoaasClient\ResponseFilters;
4
5
class Filter implements FoaasFilter
6
{
7
    protected $decencyLevelMap = [
8
        'low' => [
9
            'search' => 'fuck',
10
            'replace'=> 'f*ck',
11
        ],
12
        'medium' => [
13
            'search' => 'fuck',
14
            'replace'=> 'f*#k',
15
        ],
16
        'high' => [
17
            'search' => 'fuck',
18
            'replace'=> 'f*#$',
19
        ],
20
        'extreme' => [
21
            'search' => 'fuck',
22
            'replace'=> '!*#$',
23
        ],
24
    ];
25
26
    protected $decencyLevel;
27
28
    public function __construct($decency)
29
    {
30
        $this->decencyLevel = $decency;
31
    }
32
33
    public function filter($response)
34
    {
35
        return str_ireplace($this->decencyLevelMap[$this->decencyLevel]['search'], $this->decencyLevelMap[$this->decencyLevel]['replace'], $response);
36
    }
37
}
38