PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.1.0
Defender Security – Malware Scanner, Login Security & Firewall v6.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / thecodingmachine / safe / generated / iconv.php

iconv.php in Defender Security – Malware Scanner, Login Security & Firewall 6.1.0, at vendor/thecodingmachine/safe/generated/iconv.php

97 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Safe;
4
5 use Safe\Exceptions\IconvException;
6
7 /**
8 * Retrieve internal configuration variables of iconv extension.
9 *
10 * @param string $type The value of the optional type can be:
11 *
12 * all
13 * input_encoding
14 * output_encoding
15 * internal_encoding
16 *
17 * @return mixed Returns the current value of the internal configuration variable if
18 * successful.
19 *
20 * If type is omitted or set to "all",
21 * iconv_get_encoding returns an array that
22 * stores all these variables.
23 * @throws IconvException
24 *
25 */
26 function iconv_get_encoding(string $type = "all")
27 {
28 error_clear_last();
29 $result = \iconv_get_encoding($type);
30 if ($result === false) {
31 throw IconvException::createFromPhpError();
32 }
33 return $result;
34 }
35
36
37 /**
38 * Changes the value of the internal configuration variable specified by
39 * type to charset.
40 *
41 * @param string $type The value of type can be any one of these:
42 *
43 * input_encoding
44 * output_encoding
45 * internal_encoding
46 *
47 * @param string $charset The character set.
48 * @throws IconvException
49 *
50 */
51 function iconv_set_encoding(string $type, string $charset): void
52 {
53 error_clear_last();
54 $result = \iconv_set_encoding($type, $charset);
55 if ($result === false) {
56 throw IconvException::createFromPhpError();
57 }
58 }
59
60
61 /**
62 * Performs a character set conversion on the string
63 * str from in_charset
64 * to out_charset.
65 *
66 * @param string $in_charset The input charset.
67 * @param string $out_charset The output charset.
68 *
69 * If you append the string //TRANSLIT to
70 * out_charset transliteration is activated. This
71 * means that when a character can't be represented in the target charset,
72 * it can be approximated through one or several similarly looking
73 * characters. If you append the string //IGNORE,
74 * characters that cannot be represented in the target charset are silently
75 * discarded. Otherwise, E_NOTICE is generated and the function
76 * will return FALSE.
77 *
78 * If and how //TRANSLIT works exactly depends on the
79 * system's iconv() implementation (cf. ICONV_IMPL).
80 * Some implementations are known to ignore //TRANSLIT,
81 * so the conversion is likely to fail for characters which are illegal for
82 * the out_charset.
83 * @param string $str The string to be converted.
84 * @return string Returns the converted string.
85 * @throws IconvException
86 *
87 */
88 function iconv(string $in_charset, string $out_charset, string $str): string
89 {
90 error_clear_last();
91 $result = \iconv($in_charset, $out_charset, $str);
92 if ($result === false) {
93 throw IconvException::createFromPhpError();
94 }
95 return $result;
96 }
97