Passed
Push — master ( 0db193...9534e6 )
by Rob
04:00
created

Xss   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setLocalName() 0 4 1
A process() 0 11 2
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 Xss extends Base
13
{
14
15
    public function process()
16
    {
17
        $this->initWrapper($this->setLocalName());
18
19
        $xss = $this->soteria->xss(true);
20
        $xss->clean($this->getReference());
21
22
        if (!$xss->result()->isValid()) {
23
            $this->setScore($this->getRealScore());
24
            $this->setOutput($xss->result()->getOutput());
25
            $this->setResult();
26
        }
27
28
    }
29
30
    private function setLocalName()
31
    {
32
        $name = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);
33
        return str_replace('Wrapper', '', $name);
34
    }
35
}