GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Clean   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A aggressive() 0 4 1
A xss() 0 20 1
1
<?php
2
/**
3
 * Util
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT License
7
 */
8
namespace Pimf\Util\Character;
9
10
/**
11
 * String
12
 *
13
 * @package Util_String
14
 * @author  Gjero Krsteski <[email protected]>
15
 */
16
class Clean
17
{
18
    /**
19
     * An aggressive cleaning - all tags and stuff inside will be removed.
20
     *
21
     * @param string $string The string.
22
     *
23
     * @return string
24
     */
25
    public static function aggressive($string)
26
    {
27
        return (string)preg_replace("/<.*?>/", "", (string)$string);
28
    }
29
30
    /**
31
     * Cleans against XSS.
32
     *
33
     * @param string $string  String to check
34
     * @param string $charset Character set (default ISO-8859-1)
35
     *
36
     * @return string $value Sanitized string
37
     */
38
    public static function xss($string, $charset = 'ISO-8859-1')
39
    {
40
        $sanitize = new Sanitize();
41
42
        $string = $sanitize::removeNullCharacters($string);
43
        $string = $sanitize::validateStandardCharacterEntities($string);
44
        $string = $sanitize::validateUTF16TwoByteEncoding($string);
45
        $string = $sanitize::strangeThingsAreSubmitted($string);
46
        $string = $sanitize::convertCharacterEntitiesToASCII($string, $charset);
47
        $string = $sanitize::convertAllTabsToSpaces($string);
48
        $string = $sanitize::makesPhpTagsSafe($string);
49
        $string = $sanitize::compactAnyExplodedWords($string);
50
        $string = $sanitize::removeDisallowedJavaScriptInLinksOrImgTags($string);
51
        $string = $sanitize::removeJavaScriptEventHandlers($string);
52
        $string = $sanitize::healNaughtyHTMLElements($string);
53
        $string = $sanitize::healNaughtyScriptingElements($string);
54
        $string = $sanitize::removeJavaScriptHardRedirects($string);
55
56
        return $string;
57
    }
58
}
59