| Total Complexity | 3 |
| Total Lines | 86 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | class Util { |
||
| 24 | /** |
||
| 25 | * Holds the unhallowed character pattern. |
||
| 26 | * |
||
| 27 | * @var string|null |
||
| 28 | */ |
||
| 29 | private static $pattern; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Get unhallowed character pattern. |
||
| 33 | * |
||
| 34 | * Karakterset |
||
| 35 | * |
||
| 36 | * @link http://pronamic.nl/wp-content/uploads/2013/02/sisow-rest-api-v3.2.1.pdf |
||
| 37 | * |
||
| 38 | * Hieronder de tabel toegestane karakters. |
||
| 39 | * |
||
| 40 | * Karakter(s) Omschrijving |
||
| 41 | * A-Z Hoofdletters |
||
| 42 | * a-z Kleine letters |
||
| 43 | * 0-9 Cijfers |
||
| 44 | * = Is/gelijk |
||
| 45 | * Spatie |
||
| 46 | * % Procent |
||
| 47 | * * Asterisk |
||
| 48 | * + Plus |
||
| 49 | * - Min |
||
| 50 | * . Punt |
||
| 51 | * / Slash |
||
| 52 | * & Ampersand |
||
| 53 | * @ Apestaart |
||
| 54 | * " Dubbel quote |
||
| 55 | * ' Enkele quote |
||
| 56 | * : Dubbele punt |
||
| 57 | * ; Punt komma |
||
| 58 | * ? Vraagteken |
||
| 59 | * ( Haakje openen |
||
| 60 | * ) Haakje sluiten |
||
| 61 | * $ Dollar |
||
| 62 | * |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | 1 | public static function get_pattern() { |
|
| 66 | 1 | if ( null === self::$pattern ) { |
|
| 67 | $characters = array( |
||
| 68 | 1 | 'A-Z', |
|
| 69 | 'a-z', |
||
| 70 | '0-9', |
||
| 71 | '=', |
||
| 72 | ' ', |
||
| 73 | '%', |
||
| 74 | '*', |
||
| 75 | '+', |
||
| 76 | '-', |
||
| 77 | '.', |
||
| 78 | '/', |
||
| 79 | '&', |
||
| 80 | '@', |
||
| 81 | '"', |
||
| 82 | '\'', |
||
| 83 | ':', |
||
| 84 | ';', |
||
| 85 | '?', |
||
| 86 | '(', |
||
| 87 | ')', |
||
| 88 | '$', |
||
| 89 | ); |
||
| 90 | |||
| 91 | /* |
||
| 92 | * We use a # as a regex delimiter instead of a / so we don't have to escape the slash. |
||
| 93 | * @link http://stackoverflow.com/q/12239424 |
||
| 94 | */ |
||
| 95 | 1 | self::$pattern = '#[^' . implode( $characters ) . ']#'; |
|
| 96 | } |
||
| 97 | |||
| 98 | 1 | return self::$pattern; |
|
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * Filter all Sisow unhallowed characters. |
||
| 103 | * |
||
| 104 | * @param string $string String to filter. |
||
| 105 | * @return mixed |
||
| 106 | */ |
||
| 107 | 1 | public static function filter( $string ) { |
|
| 109 | } |
||
| 110 | } |
||
| 111 |