1 | <?php |
||
10 | class CharacterFilter |
||
11 | { |
||
12 | protected $originalString; |
||
13 | protected $filteredString = ''; |
||
14 | |||
15 | /** |
||
16 | * CharacterFilter constructor. |
||
17 | * |
||
18 | * @param $string |
||
19 | */ |
||
20 | public function __construct($string) |
||
28 | |||
29 | /** |
||
30 | * Returns the filtered string |
||
31 | * @return string|void |
||
32 | */ |
||
33 | public function __toString() |
||
37 | |||
38 | /** |
||
39 | * Filter out all special characters, like punctuation and characters with accents |
||
40 | * |
||
41 | * @param $string |
||
42 | * |
||
43 | * @return mixed|string |
||
44 | */ |
||
45 | private function filterSpecialCharacters($string) |
||
58 | |||
59 | /** |
||
60 | * Convert the string to UTF-8 encoding |
||
61 | * @param $string |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | private function convertToUTF8($string) |
||
76 | |||
77 | /** |
||
78 | * @return mixed|string |
||
79 | */ |
||
80 | public function getFilteredString() |
||
84 | } |