Total Complexity | 3 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | final class Sanitizer |
||
11 | { |
||
12 | /** |
||
13 | * Remove the first and last character of a string. |
||
14 | * |
||
15 | * @param string $value |
||
16 | * @return string |
||
17 | */ |
||
18 | 10 | public static function removeFirstAndLastCharacters(string $value) : string |
|
19 | { |
||
20 | 10 | $valueLength = mb_strlen($value); |
|
21 | |||
22 | 10 | return mb_substr($value, 1, $valueLength - 2); |
|
23 | } |
||
24 | |||
25 | /** |
||
26 | * Remove the first character of a string. |
||
27 | * |
||
28 | * @param string $value |
||
29 | * @return string |
||
30 | */ |
||
31 | 10 | public static function removeFirstCharacter(string $value) : string |
|
32 | { |
||
33 | 10 | return mb_substr($value, 1); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * Remove the last character of a string. |
||
38 | * |
||
39 | * @param string $value |
||
40 | * @return string |
||
41 | */ |
||
42 | 10 | public static function removeLastCharacter(string $value) : string |
|
45 | } |
||
46 | } |
||
47 |