HtmlspecialcharsFilter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 17
loc 17
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 5 5 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * KumbiaPHP web & app Framework
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the new BSD license that is bundled
8
 * with this package in the file LICENSE.
9
 *
10
 * @category   Kumbia
11
 * @package    Filter
12
 * @subpackage BaseFilter
13
 *
14
 * @copyright  Copyright (c) 2005 - 2019 KumbiaPHP Team (http://www.kumbiaphp.com)
15
 * @license    https://github.com/KumbiaPHP/KumbiaPHP/blob/master/LICENSE   New BSD License
16
 */
17
18
/**
19
 * Filtra una cadena Htmlspecial
20
 *
21
 * @category   Kumbia
22
 * @package    Filter
23
 * @subpackage BaseFilter
24
 */
25 View Code Duplication
class HtmlspecialcharsFilter implements FilterInterface
0 ignored issues
show
Duplication introduced by Emilio Silveira
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
{
27
28
    /**
29
     * Ejecuta el filtro
30
     *
31
     * @param string $s
32
     * @param array $options
33
     * @return string
34
     */
35
    public static function execute($s, $options)
36
    {
37
        $charset = (isset($options['charset'])) ? $options['charset'] : APP_CHARSET;
38
        return htmlspecialchars((string) $s, ENT_QUOTES, $charset);
39
    }
40
41
}