1 | <?php |
||
21 | class StringHelper |
||
22 | { |
||
23 | |||
24 | const PREPOSITIONS = [ |
||
25 | 'on', 'in', 'at', 'since', 'for', 'ago', 'before', 'to', 'past', 'till', 'until', 'by', 'under', 'below', 'over', |
||
26 | 'above', 'across', 'through', 'into', 'towards', 'onto', 'from', 'of', 'off', 'about', 'via' |
||
27 | ]; |
||
28 | |||
29 | const ARTICLES = [ |
||
30 | 'a', 'an', 'the' |
||
31 | ]; |
||
32 | |||
33 | const ADVERBS = [ |
||
34 | 'yet', 'so', 'just', 'only' |
||
35 | ]; |
||
36 | |||
37 | const CONJUNCTIONS = [ |
||
38 | 'nor', 'so', 'and', 'or' |
||
39 | ]; |
||
40 | |||
41 | const ADJECTIVES = [ |
||
42 | 'down', 'up' |
||
43 | ]; |
||
44 | |||
45 | const ISO_ENCODINGS = [ |
||
46 | 'ISO-8859-1', |
||
47 | 'ISO-8859-2', |
||
48 | 'ISO-8859-3', |
||
49 | 'ISO-8859-4', |
||
50 | 'ISO-8859-5', |
||
51 | 'ISO-8859-6', |
||
52 | 'ISO-8859-7', |
||
53 | 'ISO-8859-8', |
||
54 | 'ISO-8859-9', |
||
55 | 'ISO-8859-10', |
||
56 | 'ISO-8859-11', |
||
57 | 'ISO-8859-13', |
||
58 | 'ISO-8859-14', |
||
59 | 'ISO-8859-15', |
||
60 | 'ISO-8859-16' |
||
61 | ]; |
||
62 | |||
63 | /** |
||
64 | * opening quote sign |
||
65 | */ |
||
66 | const OPENING_QUOTE = "“"; |
||
67 | |||
68 | /** |
||
69 | * closing quote sign |
||
70 | */ |
||
71 | const CLOSING_QUOTE = "”"; |
||
72 | |||
73 | /** |
||
74 | * @param $text |
||
75 | * @return string |
||
76 | */ |
||
77 | public static function capitalizeAll($text) |
||
87 | |||
88 | /** |
||
89 | * @param $titleString |
||
90 | * @return string |
||
91 | */ |
||
92 | public static function capitalizeForTitle($titleString) |
||
114 | |||
115 | /** |
||
116 | * @param $word |
||
117 | * @return bool |
||
118 | */ |
||
119 | public static function keepLowerCase($word) |
||
129 | |||
130 | /** |
||
131 | * @param $string |
||
132 | * @param string $encoding |
||
133 | * @return string |
||
134 | */ |
||
135 | public static function mb_ucfirst($string, $encoding = 'UTF-8') |
||
144 | |||
145 | /** |
||
146 | * @param $string |
||
147 | * @param $initializeSign |
||
148 | * @return string |
||
149 | */ |
||
150 | public static function initializeBySpaceOrHyphen($string, $initializeSign) |
||
173 | |||
174 | /** |
||
175 | * @param $string |
||
176 | * @return mixed|string |
||
177 | */ |
||
178 | public static function camelCase2Hyphen($string) |
||
184 | |||
185 | /** |
||
186 | * @param $string |
||
187 | * @return bool |
||
188 | */ |
||
189 | public static function checkLowerCaseString($string) |
||
193 | |||
194 | /** |
||
195 | * @param $string |
||
196 | * @return bool |
||
197 | */ |
||
198 | public static function checkUpperCaseString($string) |
||
202 | |||
203 | /** |
||
204 | * @param $string |
||
205 | * @return mixed |
||
206 | */ |
||
207 | public static function clearApostrophes($string) |
||
211 | |||
212 | /** |
||
213 | * replaces outer quotes of $text by given inner quotes |
||
214 | * |
||
215 | * @param $text |
||
216 | * @param $outerOpenQuote |
||
217 | * @param $outerCloseQuote |
||
218 | * @param $innerOpenQuote |
||
219 | * @param $innerCloseQuote |
||
220 | * @return string |
||
221 | */ |
||
222 | public static function replaceOuterQuotes($text, $outerOpenQuote, $outerCloseQuote, $innerOpenQuote, $innerCloseQuote) |
||
229 | |||
230 | /** |
||
231 | * @param $string |
||
232 | * @return bool |
||
233 | */ |
||
234 | public static function isLatinString($string) |
||
239 | |||
240 | /** |
||
241 | * @param $string |
||
242 | * @return bool |
||
243 | */ |
||
244 | public static function isCyrillicString($string) |
||
248 | |||
249 | /** |
||
250 | * removes all kind of brackets from a given string |
||
251 | * @param $datePart |
||
252 | * @return mixed |
||
253 | */ |
||
254 | public static function removeBrackets($datePart) { |
||
257 | } |
This check looks for accesses to local static members using the fully qualified name instead of
self::
.While this is perfectly valid, the fully qualified name of
Certificate::TRIPLEDES_CBC
could just as well be replaced byself::TRIPLEDES_CBC
. Referencing local members withself::
assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.