XssWrapper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 12 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
        }
26 2
        $this->setResult();
27
    }
28 2
29
    private function setLocalName()
30 2
    {
31 2
        $name = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);
32
        return str_replace('Wrapper', '', $name);
33
    }
34
}