@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * @param StringResource $str |
109 | 109 | * |
110 | - * @return mixed |
|
110 | + * @return string |
|
111 | 111 | */ |
112 | 112 | private function _do($str) |
113 | 113 | { |
@@ -176,6 +176,9 @@ discard block |
||
176 | 176 | return $str; |
177 | 177 | } |
178 | 178 | |
179 | + /** |
|
180 | + * @param string $str |
|
181 | + */ |
|
179 | 182 | public function decodeString($str) |
180 | 183 | { |
181 | 184 | // init |
@@ -184,6 +187,10 @@ discard block |
||
184 | 187 | if (strpos($str, '<') !== false && preg_match($regExForHtmlTags, $str, $matches) === 1) { |
185 | 188 | $str = (string)preg_replace_callback( |
186 | 189 | $regExForHtmlTags, |
190 | + |
|
191 | + /** |
|
192 | + * @param string $matches |
|
193 | + */ |
|
187 | 194 | function ($matches) { |
188 | 195 | return $this->decodeEntity($matches); |
189 | 196 | }, |
@@ -222,7 +229,7 @@ discard block |
||
222 | 229 | } |
223 | 230 | |
224 | 231 | /** |
225 | - * @return null |
|
232 | + * @return null|boolean |
|
226 | 233 | */ |
227 | 234 | public function isXssFound() |
228 | 235 | { |
@@ -234,7 +241,7 @@ discard block |
||
234 | 241 | * |
235 | 242 | * @param StringResource $str |
236 | 243 | * |
237 | - * @return StringResource |
|
244 | + * @return string |
|
238 | 245 | */ |
239 | 246 | private function _entity_decode($str) |
240 | 247 | { |
@@ -337,6 +344,9 @@ discard block |
||
337 | 344 | return $str; |
338 | 345 | } |
339 | 346 | |
347 | + /** |
|
348 | + * @param string $file |
|
349 | + */ |
|
340 | 350 | private function _get_data($file) |
341 | 351 | { |
342 | 352 | /** @noinspection PhpIncludeInspection */ |
@@ -13,6 +13,9 @@ discard block |
||
13 | 13 | $this->_evil_html_tags = $evil->html(); |
14 | 14 | } |
15 | 15 | |
16 | + /** |
|
17 | + * @param string $str |
|
18 | + */ |
|
16 | 19 | public function naughtyHtml($str) |
17 | 20 | { |
18 | 21 | $evil_html_tags = implode('|', $this->_evil_html_tags); |
@@ -20,6 +23,10 @@ discard block |
||
20 | 23 | |
21 | 24 | $str = (string)preg_replace_callback( |
22 | 25 | '#<(?<start>/*\s*)(?<content>' . $evil_html_tags . ')(?<end>[^><]*)(?<rest>[><]*)#ius', |
26 | + |
|
27 | + /** |
|
28 | + * @param string $matches |
|
29 | + */ |
|
23 | 30 | function ($matches) { |
24 | 31 | return $this->naughtyHtmlCallback($matches); |
25 | 32 | }, |
@@ -237,12 +237,20 @@ discard block |
||
237 | 237 | return \str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str); |
238 | 238 | } |
239 | 239 | |
240 | + /** |
|
241 | + * @param string $file |
|
242 | + */ |
|
240 | 243 | private function getData($file) |
241 | 244 | { |
242 | 245 | |
243 | 246 | return include __DIR__ . '/../Data/' . $file . '.php'; |
244 | 247 | } |
245 | 248 | |
249 | + /** |
|
250 | + * @param integer $flags |
|
251 | + * |
|
252 | + * @return string |
|
253 | + */ |
|
246 | 254 | private function html_entity_decode($str, $flags = null, $encoding = 'UTF-8') |
247 | 255 | { |
248 | 256 | if ( |
@@ -552,6 +560,9 @@ discard block |
||
552 | 560 | return $buf; |
553 | 561 | } |
554 | 562 | |
563 | + /** |
|
564 | + * @param string $input |
|
565 | + */ |
|
555 | 566 | private function to_utf8_convert_helper($input) |
556 | 567 | { |
557 | 568 | // init |
@@ -581,6 +592,9 @@ discard block |
||
581 | 592 | return $buf; |
582 | 593 | } |
583 | 594 | |
595 | + /** |
|
596 | + * @param integer $code_point |
|
597 | + */ |
|
584 | 598 | private function chr($code_point, $encoding = 'UTF-8') |
585 | 599 | { |
586 | 600 | // init |
@@ -676,6 +690,9 @@ discard block |
||
676 | 690 | return $CHAR_CACHE[$cacheKey] = $chr; |
677 | 691 | } |
678 | 692 | |
693 | + /** |
|
694 | + * @return string |
|
695 | + */ |
|
679 | 696 | private function encode($toEncoding, $str, $autodetectFromEncoding = true, $fromEncoding = '') |
680 | 697 | { |
681 | 698 | if ($str === '' || $toEncoding === '') { |
@@ -843,6 +860,9 @@ discard block |
||
843 | 860 | return $var; |
844 | 861 | } |
845 | 862 | |
863 | + /** |
|
864 | + * @param string $str |
|
865 | + */ |
|
846 | 866 | private function normalize_line_ending($str) |
847 | 867 | { |
848 | 868 | return \str_replace(["\r\n", "\r"], "\n", $str); |
@@ -899,6 +919,9 @@ discard block |
||
899 | 919 | ); |
900 | 920 | } |
901 | 921 | |
922 | + /** |
|
923 | + * @param string $char |
|
924 | + */ |
|
902 | 925 | private function single_chr_html_encode($char, $keepAsciiChars = false, $encoding = 'UTF-8') |
903 | 926 | { |
904 | 927 | if ($char === '') { |
@@ -1409,6 +1432,9 @@ discard block |
||
1409 | 1432 | return false; |
1410 | 1433 | } |
1411 | 1434 | |
1435 | + /** |
|
1436 | + * @param string $input |
|
1437 | + */ |
|
1412 | 1438 | private function is_binary($input, $strict = false) |
1413 | 1439 | { |
1414 | 1440 | $input = (string)$input; |
@@ -1446,6 +1472,9 @@ discard block |
||
1446 | 1472 | return false; |
1447 | 1473 | } |
1448 | 1474 | |
1475 | + /** |
|
1476 | + * @param string $str |
|
1477 | + */ |
|
1449 | 1478 | private function get_file_type( |
1450 | 1479 | $str, |
1451 | 1480 | $fallback = [ |
@@ -1538,6 +1567,9 @@ discard block |
||
1538 | 1567 | ]; |
1539 | 1568 | } |
1540 | 1569 | |
1570 | + /** |
|
1571 | + * @param string $str |
|
1572 | + */ |
|
1541 | 1573 | private function is_utf16($str, $checkIfStringIsBinary = true) |
1542 | 1574 | { |
1543 | 1575 | |
@@ -1620,7 +1652,7 @@ discard block |
||
1620 | 1652 | /** |
1621 | 1653 | * Check if the string is UTF-32. |
1622 | 1654 | * |
1623 | - * @param mixed $str <p>The input string.</p> |
|
1655 | + * @param string $str <p>The input string.</p> |
|
1624 | 1656 | * @param bool $checkIfStringIsBinary |
1625 | 1657 | * |
1626 | 1658 | * @return false|int |
@@ -1698,7 +1730,7 @@ discard block |
||
1698 | 1730 | * |
1699 | 1731 | * @see http://hsivonen.iki.fi/php-utf8/ |
1700 | 1732 | * |
1701 | - * @param string|string[] $str <p>The string to be checked.</p> |
|
1733 | + * @param string $str <p>The string to be checked.</p> |
|
1702 | 1734 | * @param bool $strict <p>Check also if the string is not UTF-16 or UTF-32.</p> |
1703 | 1735 | * |
1704 | 1736 | * @return bool |
@@ -2053,6 +2085,9 @@ discard block |
||
2053 | 2085 | return $returnTmp; |
2054 | 2086 | } |
2055 | 2087 | |
2088 | + /** |
|
2089 | + * @param integer $int |
|
2090 | + */ |
|
2056 | 2091 | private function decimal_to_chr($int) |
2057 | 2092 | { |
2058 | 2093 | return $this->html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |