Total Complexity | 5 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 90% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class XSSFilterMiddleware extends TransformsRequest |
||
9 | { |
||
10 | /** |
||
11 | * @var \Alkhwlani\XssMiddleware\Repository |
||
|
|||
12 | */ |
||
13 | protected $config; |
||
14 | |||
15 | /** |
||
16 | * @var \GrahamCampbell\SecurityCore\Security |
||
17 | */ |
||
18 | protected $security; |
||
19 | |||
20 | 2 | public function __construct(Repository $config) |
|
21 | { |
||
22 | 2 | $this->security = app('security'); |
|
23 | 2 | $this->config = $config->get('xss-middleware'); |
|
24 | 2 | } |
|
25 | |||
26 | /** |
||
27 | * Transform the given value. |
||
28 | * |
||
29 | * @param string $key |
||
30 | * @param mixed $value |
||
31 | * |
||
32 | * @return mixed |
||
33 | */ |
||
34 | 2 | protected function transform($key, $value) |
|
35 | { |
||
36 | 2 | if ($this->shouldIgnore($key, $value)) { |
|
37 | return $value; |
||
38 | } |
||
39 | |||
40 | 2 | return $this->security->clean($value); |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * determine if should ignore the field. |
||
45 | * |
||
46 | * @param $key |
||
47 | * @param $value |
||
48 | * @return bool |
||
49 | */ |
||
50 | 2 | protected function shouldIgnore($key, $value): bool |
|
53 | } |
||
54 | } |
||
55 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths