Completed
Push — master ( 1972af...cf5cf8 )
by Rob
02:06
created

XssWrapper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 22
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
A setLocalName() 0 4 1
1
<?php
2
3
namespace devtoolboxuk\cerberus\Wrappers;
4
5
/**
6
 *
7
 * Detect if XSS has been passed through
8
 *
9
 * Class XssWrapper
10
 * @package devtoolboxuk\cerberus\Wrappers
11
 */
12
class XssWrapper extends Base
13
{
14
15 2
    public function process()
16
    {
17 2
        $this->initWrapper($this->setLocalName());
18
19 2
        $xss = $this->soteria->xss(true);
20 2
        $xss->clean($this->getReference());
21 2
22 1
        if (!$xss->result()->isValid()) {
23 1
            $this->setScore($this->getRealScore());
24
            $this->setOutput($xss->result()->getOutput());
25
            $this->setResult();
26 2
        }
27
28 2
    }
29
30 2
    private function setLocalName()
31 2
    {
32
        $name = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);
33
        return str_replace('Wrapper', '', $name);
34
    }
35
}