1 | <?php |
||
10 | trait PHP |
||
11 | { |
||
12 | /** |
||
13 | * Quote string with slashes in a C style. |
||
14 | * |
||
15 | * @param string $charlist |
||
16 | * @return static |
||
17 | */ |
||
18 | public function addcslashes($charlist) |
||
22 | |||
23 | /** |
||
24 | * Quote string with slashes. |
||
25 | * |
||
26 | * @return static |
||
27 | */ |
||
28 | public function addslashes() |
||
32 | |||
33 | /** |
||
34 | * Convert binary data into hexadecimal representation. |
||
35 | * |
||
36 | * @return static |
||
37 | */ |
||
38 | public function bin2hex() |
||
42 | |||
43 | 1 | public function convertEncoding($toEncoding) |
|
49 | |||
50 | 1 | public function convertTo($variant = 'zh-tw') |
|
54 | |||
55 | public function chineseToNumber() |
||
59 | |||
60 | /** |
||
61 | * Split a string by string. |
||
62 | * |
||
63 | * @param string $delimiter |
||
64 | * @param int $limit |
||
1 ignored issue
–
show
|
|||
65 | * @return \Recca0120\Lodash\JArray |
||
66 | */ |
||
67 | 1 | public function explode($delimiter) |
|
73 | |||
74 | /** |
||
75 | * Convert all HTML entities to their applicable characters. |
||
76 | * |
||
77 | * @param int $flags |
||
1 ignored issue
–
show
|
|||
78 | * @return static |
||
79 | */ |
||
80 | public function htmlEntityDecode() |
||
86 | |||
87 | /** |
||
88 | * Convert all applicable characters to HTML entities. |
||
89 | * |
||
90 | * @param int $flags |
||
1 ignored issue
–
show
|
|||
91 | * @return static |
||
92 | */ |
||
93 | 1 | public function htmlentities() |
|
99 | |||
100 | /** |
||
101 | * Convert special HTML entities back to characters. |
||
102 | * |
||
103 | * @param int $flags |
||
1 ignored issue
–
show
|
|||
104 | * @return static |
||
105 | */ |
||
106 | public function htmlspecialcharsDecode() |
||
112 | |||
113 | /** |
||
114 | * Convert special characters to HTML entities. |
||
115 | * |
||
116 | * @param int $flags |
||
1 ignored issue
–
show
|
|||
117 | * @return static |
||
118 | */ |
||
119 | public function htmlspecialchars() |
||
125 | |||
126 | /** |
||
127 | * Make a string's first character lowercase. |
||
128 | * |
||
129 | * @return static |
||
130 | */ |
||
131 | public function lcfirst() |
||
135 | |||
136 | /** |
||
137 | * Strip whitespace (or other characters) from the beginning of a string. |
||
138 | * |
||
139 | * @param string $characterMask |
||
140 | * @return static |
||
141 | */ |
||
142 | 1 | public function ltrim($characterMask = " \t\n\r\0\x0B") |
|
146 | |||
147 | /** |
||
148 | * Calculate the md5 hash of a string. |
||
149 | * |
||
150 | * @param bool $rawOutput |
||
151 | * @return static |
||
152 | */ |
||
153 | public function md5($rawOutput = false) |
||
157 | |||
158 | /** |
||
159 | * Inserts HTML line breaks before all newlines in a string. |
||
160 | * |
||
161 | * @param bool $isXHTML |
||
162 | * @return static |
||
163 | */ |
||
164 | public function nl2br($isXHTML = true) |
||
168 | |||
169 | /** |
||
170 | * Parses the string into variables. |
||
171 | * |
||
172 | * @return \Recca0120\Lodash\JArray |
||
173 | */ |
||
174 | public function parse() |
||
181 | |||
182 | /** |
||
183 | * Strip whitespace (or other characters) from the end of a string. |
||
184 | * |
||
185 | * @param string $characterMask |
||
186 | * @return static |
||
187 | */ |
||
188 | 1 | public function rtrim($characterMask = " \t\n\r\0\x0B") |
|
192 | |||
193 | /** |
||
194 | * Calculate the sha1 hash of a string. |
||
195 | * |
||
196 | * @return static |
||
197 | */ |
||
198 | public function sha1() |
||
202 | |||
203 | /** |
||
204 | * Parses input from a string according to a format. |
||
205 | * |
||
206 | * @param string $format |
||
207 | * @return \Recca0120\Lodash\JArray |
||
208 | */ |
||
209 | public function sscanf($format) |
||
213 | |||
214 | /** |
||
215 | * Pad a string to a certain length with another string. |
||
216 | * |
||
217 | * @param int $length |
||
218 | * @param string $chars |
||
219 | * @param int $type |
||
220 | * @return static |
||
221 | */ |
||
222 | public function pad($length = 0, $chars = ' ', $type = STR_PAD_BOTH) |
||
226 | |||
227 | /** |
||
228 | * Perform the rot13 transform on a string. |
||
229 | * |
||
230 | * @return static |
||
231 | */ |
||
232 | public function rot13() |
||
236 | |||
237 | /** |
||
238 | * Randomly shuffles a string. |
||
239 | * |
||
240 | * @return static |
||
241 | */ |
||
242 | public function shuffle() |
||
246 | |||
247 | /** |
||
248 | * Strip HTML and PHP tags from a string. |
||
249 | * |
||
250 | * @param string $allowable_tags |
||
1 ignored issue
–
show
|
|||
251 | * |
||
252 | * @return static |
||
253 | */ |
||
254 | public function stripTags() |
||
260 | |||
261 | /** |
||
262 | * Un-quote string quoted with addcslashes(). |
||
263 | * |
||
264 | * @return static |
||
265 | */ |
||
266 | public function stripcslashes() |
||
270 | |||
271 | /** |
||
272 | * Un-quotes a quoted string. |
||
273 | * |
||
274 | * @return static |
||
275 | */ |
||
276 | public function stripslashes() |
||
280 | |||
281 | /** |
||
282 | * Reverse a string. |
||
283 | * |
||
284 | * @return static |
||
285 | */ |
||
286 | public function reverse() |
||
290 | |||
291 | public function toFullCase() |
||
295 | |||
296 | public function toHalfCase() |
||
300 | |||
301 | /** |
||
302 | * Make a string's first character uppercase. |
||
303 | * |
||
304 | * @return static |
||
305 | */ |
||
306 | public function ucfirst() |
||
310 | |||
311 | /** |
||
312 | * Uppercase the first character of each word in a string. |
||
313 | * |
||
314 | * @param string $delimiters |
||
315 | * |
||
316 | * @return static |
||
317 | */ |
||
318 | public function ucwords($delimiters = " \t\r\n\f\v") |
||
322 | |||
323 | /** |
||
324 | * Wraps a string to a given number of characters. |
||
325 | * |
||
326 | * @param int $width |
||
327 | * @param string $break |
||
328 | * @param bool $cut |
||
329 | * |
||
330 | * @return static |
||
331 | */ |
||
332 | public function wordwrap($width = 75, $break = "\n", $cut = false) |
||
336 | } |
||
337 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: