aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/voku/portable-ascii
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-02-11 10:01:39 +0000
committerMario <mario@mariovavti.com>2022-02-11 10:01:39 +0000
commitbf30cfd8a451c104ba8e8d9d65d4514e60bb9b83 (patch)
tree15bdcdd4525b3304b73e4d17f5774b0ae2b293ee /vendor/voku/portable-ascii
parent139ffae3674e59307b46c67b0dcf77be9ec87b19 (diff)
downloadvolse-hubzilla-bf30cfd8a451c104ba8e8d9d65d4514e60bb9b83.tar.gz
volse-hubzilla-bf30cfd8a451c104ba8e8d9d65d4514e60bb9b83.tar.bz2
volse-hubzilla-bf30cfd8a451c104ba8e8d9d65d4514e60bb9b83.zip
more composer updates
Diffstat (limited to 'vendor/voku/portable-ascii')
-rw-r--r--vendor/voku/portable-ascii/.whitesource12
-rw-r--r--vendor/voku/portable-ascii/CHANGELOG.md14
-rw-r--r--vendor/voku/portable-ascii/README.md16
-rw-r--r--vendor/voku/portable-ascii/build/docs/base.md4
-rw-r--r--vendor/voku/portable-ascii/src/voku/helper/ASCII.php92
5 files changed, 112 insertions, 26 deletions
diff --git a/vendor/voku/portable-ascii/.whitesource b/vendor/voku/portable-ascii/.whitesource
new file mode 100644
index 000000000..55b922e8c
--- /dev/null
+++ b/vendor/voku/portable-ascii/.whitesource
@@ -0,0 +1,12 @@
+{
+ "scanSettings": {
+ "baseBranches": []
+ },
+ "checkRunSettings": {
+ "vulnerableCheckRunConclusionLevel": "failure",
+ "displayMode": "diff"
+ },
+ "issueSettings": {
+ "minSeverityLevel": "LOW"
+ }
+} \ No newline at end of file
diff --git a/vendor/voku/portable-ascii/CHANGELOG.md b/vendor/voku/portable-ascii/CHANGELOG.md
index 6e5357d08..04b64acdd 100644
--- a/vendor/voku/portable-ascii/CHANGELOG.md
+++ b/vendor/voku/portable-ascii/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+### 1.6.1 (2021-01-24)
+
+- revert: prefer "Russian - Passport (2013), ICAO" instead of "Russian - GOST 7.79-2000(B)"
+- revert: fix "Ukrainian" char-mapping (thanks to @Andr1yk0)
+- revert: fix "Persian" char-mapping (thanks to @frost-cyber)
+
+### 1.6.0 (2021-01-24)
+
+- prefer "Russian - Passport (2013), ICAO" instead of "Russian - GOST 7.79-2000(B)"
+- fix "Ukrainian" char-mapping (thanks to @Andr1yk0)
+- fix "Persian" char-mapping (thanks to @frost-cyber)
+- fix "ASCII::normalize_whitespace()" -> "CARRIAGE RETURN" is more like "<br>" and no "\n"
+- add "ASCII::to_ascii_remap()" -> this method will return broken characters and is only for special cases
+
### 1.5.6 (2020-11-12)
- "ASCII::normalize_whitespace()" -> can now also remove "control characters" if needed v2
diff --git a/vendor/voku/portable-ascii/README.md b/vendor/voku/portable-ascii/README.md
index 9dd7cecef..929c21e29 100644
--- a/vendor/voku/portable-ascii/README.md
+++ b/vendor/voku/portable-ascii/README.md
@@ -1,7 +1,7 @@
[//]: # (AUTO-GENERATED BY "PHP README Helper": base file -> docs/base.md)
-[![Build Status](https://travis-ci.com/voku/portable-ascii.svg?branch=master)](https://travis-ci.com/voku/portable-ascii)
+[![Build Status](https://github.com/voku/portable-ascii/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/voku/portable-ascii/actions)
[![Build status](https://ci.appveyor.com/api/projects/status/gnejjnk7qplr7f5t/branch/master?svg=true)](https://ci.appveyor.com/project/voku/portable-ascii/branch/master)
-[![Coverage Status](https://coveralls.io/repos/voku/portable-ascii/badge.svg?branch=master&service=github)](https://coveralls.io/github/voku/portable-ascii?branch=master)
+[![codecov.io](https://codecov.io/github/voku/portable-ascii/coverage.svg?branch=master)](https://codecov.io/github/voku/portable-ascii?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/997c9bb10d1c4791967bdf2e42013e8e)](https://www.codacy.com/app/voku/portable-ascii)
[![Latest Stable Version](https://poser.pugx.org/voku/portable-ascii/v/stable)](https://packagist.org/packages/voku/portable-ascii)
[![Total Downloads](https://poser.pugx.org/voku/portable-ascii/downloads)](https://packagist.org/packages/voku/portable-ascii)
@@ -96,8 +96,8 @@ The API from the "ASCII"-Class is written as small static methods.
</td><td><a href="#getalllanguages-string">getAllLanguages</a>
</td><td><a href="#is_asciistring-str-bool">is_ascii</a>
</td><td><a href="#normalize_mswordstring-str-string">normalize_msword</a>
-</td></tr><tr><td><a href="#normalize_whitespacestring-str-bool-keepnonbreakingspace-bool-keepbidiunicodecontrols-bool-replaceseparatorswithnewline-string">normalize_whitespace</a>
-</td><td><a href="#remove_invisible_charactersstring-str-bool-url_encoded-string-replacement-bool-keep_control_characters-string">remove_invisible_characters</a>
+</td></tr><tr><td><a href="#normalize_whitespacestring-str-bool-keepnonbreakingspace-bool-keepbidiunicodecontrols-bool-normalize_control_characters-string">normalize_whitespace</a>
+</td><td><a href="#remove_invisible_charactersstring-str-bool-url_encoded-string-replacement-bool-keep_basic_control_characters-string">remove_invisible_characters</a>
</td><td><a href="#to_asciistring-str-string-language-bool-remove_unsupported_chars-bool-replace_extra_symbols-bool-use_transliterate-boolnull-replace_single_chars_only-string">to_ascii</a>
</td><td><a href="#to_filenamestring-str-bool-use_transliterate-string-fallback_char-string">to_filename</a>
</td></tr><tr><td><a href="#to_slugifystring-str-string-separator-string-language-string-replacements-bool-replace_extra_symbols-bool-use_str_to_lower-bool-use_transliterate-string">to_slugify</a>
@@ -254,7 +254,7 @@ ASCII::normalize_msword('„Abcdef…”'); // '"Abcdef..."'
--------
-#### normalize_whitespace(string $str, bool $keepNonBreakingSpace, bool $keepBidiUnicodeControls, bool $replaceSeparatorsWithNewline): string
+#### normalize_whitespace(string $str, bool $keepNonBreakingSpace, bool $keepBidiUnicodeControls, bool $normalize_control_characters): string
<a href="#voku-php-readme-class-methods">↑</a>
Normalize the whitespace.
@@ -267,14 +267,14 @@ ASCII::normalize_whitespace("abc-\xc2\xa0-öäü-\xe2\x80\xaf-\xE2\x80\xAC", tru
- `bool $keepNonBreakingSpace [optional] <p>Set to true, to keep non-breaking-spaces.</p>`
- `bool $keepBidiUnicodeControls [optional] <p>Set to true, to keep non-printable (for the web)
bidirectional text chars.</p>`
-- `bool $replaceSeparatorsWithNewline [optional] <p>Set to true, to convert LINE and PARAGRAPH SEPARATOR with "\n".</p>`
+- `bool $normalize_control_characters [optional] <p>Set to true, to convert e.g. LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".</p>`
**Return:**
- `string <p>A string with normalized whitespace.</p>`
--------
-#### remove_invisible_characters(string $str, bool $url_encoded, string $replacement, bool $keep_control_characters): string
+#### remove_invisible_characters(string $str, bool $url_encoded, string $replacement, bool $keep_basic_control_characters): string
<a href="#voku-php-readme-class-methods">↑</a>
Remove invisible characters from a string.
@@ -286,7 +286,7 @@ copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/C
- `string $str`
- `bool $url_encoded`
- `string $replacement`
-- `bool $keep_control_characters`
+- `bool $keep_basic_control_characters`
**Return:**
- `string`
diff --git a/vendor/voku/portable-ascii/build/docs/base.md b/vendor/voku/portable-ascii/build/docs/base.md
index e21e73137..ca949d8b6 100644
--- a/vendor/voku/portable-ascii/build/docs/base.md
+++ b/vendor/voku/portable-ascii/build/docs/base.md
@@ -1,6 +1,6 @@
-[![Build Status](https://travis-ci.com/voku/portable-ascii.svg?branch=master)](https://travis-ci.com/voku/portable-ascii)
+[![Build Status](https://github.com/voku/portable-ascii/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/voku/portable-ascii/actions)
[![Build status](https://ci.appveyor.com/api/projects/status/gnejjnk7qplr7f5t/branch/master?svg=true)](https://ci.appveyor.com/project/voku/portable-ascii/branch/master)
-[![Coverage Status](https://coveralls.io/repos/voku/portable-ascii/badge.svg?branch=master&service=github)](https://coveralls.io/github/voku/portable-ascii?branch=master)
+[![codecov.io](https://codecov.io/github/voku/portable-ascii/coverage.svg?branch=master)](https://codecov.io/github/voku/portable-ascii?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/997c9bb10d1c4791967bdf2e42013e8e)](https://www.codacy.com/app/voku/portable-ascii)
[![Latest Stable Version](https://poser.pugx.org/voku/portable-ascii/v/stable)](https://packagist.org/packages/voku/portable-ascii)
[![Total Downloads](https://poser.pugx.org/voku/portable-ascii/downloads)](https://packagist.org/packages/voku/portable-ascii)
diff --git a/vendor/voku/portable-ascii/src/voku/helper/ASCII.php b/vendor/voku/portable-ascii/src/voku/helper/ASCII.php
index d4ec32ab1..aa676abda 100644
--- a/vendor/voku/portable-ascii/src/voku/helper/ASCII.php
+++ b/vendor/voku/portable-ascii/src/voku/helper/ASCII.php
@@ -200,7 +200,7 @@ final class ASCII
*
* @return string[]
*
- * @psalm-return array<string, string>
+ * @phpstan-return array<string, string>
*/
public static function getAllLanguages(): array
{
@@ -238,7 +238,7 @@ final class ASCII
*
* @return array
*
- * @psalm-return array<string, array<string , string>>
+ * @phpstan-return array<string, array<string , string>>
*/
public static function charsArray(bool $replace_extra_symbols = false): array
{
@@ -268,7 +268,7 @@ final class ASCII
* @return array
* <p>An array of replacements.</p>
*
- * @psalm-return array<string, array<int, string>>
+ * @phpstan-return array<string, array<int, string>>
*/
public static function charsArrayWithMultiLanguageValues(bool $replace_extra_symbols = false): array
{
@@ -300,10 +300,7 @@ final class ASCII
$CHARS_ARRAY[$cacheKey] = $return;
- /** @noinspection PhpSillyAssignmentInspection - hack for phpstan */
- /** @var array<string, array<int, string>> $return */
- $return = $return;
-
+ /** @var array<string, array<int, string>> $return - hack for phpstan */
return $return;
}
@@ -332,7 +329,7 @@ final class ASCII
* @return array
* <p>An array of replacements.</p>
*
- * @psalm-return array{orig: string[], replace: string[]}|array<string, string>
+ * @phpstan-return array{orig: string[], replace: string[]}|array<string, string>
*/
public static function charsArrayWithOneLanguage(
string $language = self::ENGLISH_LANGUAGE_CODE,
@@ -428,7 +425,7 @@ final class ASCII
* @return array
* <p>An array of replacements.</p>
*
- * @psalm-return array{orig: string[], replace: string[]}|array<string, string>
+ * @phpstan-return array{orig: string[], replace: string[]}|array<string, string>
*/
public static function charsArrayWithSingleLanguageValues(
bool $replace_extra_symbols = false,
@@ -616,7 +613,7 @@ final class ASCII
* @param bool $keepNonBreakingSpace [optional] <p>Set to true, to keep non-breaking-spaces.</p>
* @param bool $keepBidiUnicodeControls [optional] <p>Set to true, to keep non-printable (for the web)
* bidirectional text chars.</p>
- * @param bool $normalize_control_characters [optional] <p>Set to true, to convert LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".</p>
+ * @param bool $normalize_control_characters [optional] <p>Set to true, to convert e.g. LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".</p>
*
* @psalm-pure
*
@@ -645,16 +642,14 @@ final class ASCII
"\x0d\x0c", // 'END OF LINE'
"\xe2\x80\xa8", // 'LINE SEPARATOR'
"\xe2\x80\xa9", // 'PARAGRAPH SEPARATOR'
- "\x0c", // 'FORM FEED'
- "\x0d", // 'CARRIAGE RETURN'
- "\x0b", // 'VERTICAL TAB'
+ "\x0c", // 'FORM FEED' // "\f"
+ "\x0b", // 'VERTICAL TAB' // "\v"
],
[
"\n",
"\n",
"\n",
"\n",
- "\n",
"\t",
],
$str
@@ -738,6 +733,71 @@ final class ASCII
}
/**
+ * WARNING: This method will return broken characters and is only for special cases.
+ *
+ * Convert two UTF-8 encoded string to a single-byte strings suitable for
+ * functions that need the same string length after the conversion.
+ *
+ * The function simply uses (and updates) a tailored dynamic encoding
+ * (in/out map parameter) where non-ascii characters are remapped to
+ * the range [128-255] in order of appearance.
+ *
+ * @param string $str1
+ * @param string $str2
+ *
+ * @return string[]
+ *
+ * @phpstan-return array{0: string, 1: string}
+ */
+ public static function to_ascii_remap(string $str1, string $str2): array
+ {
+ $charMap = [];
+ $str1 = self::to_ascii_remap_intern($str1, $charMap);
+ $str2 = self::to_ascii_remap_intern($str2, $charMap);
+
+ return [$str1, $str2];
+ }
+
+ /**
+ * WARNING: This method will return broken characters and is only for special cases.
+ *
+ * Convert a UTF-8 encoded string to a single-byte string suitable for
+ * functions that need the same string length after the conversion.
+ *
+ * The function simply uses (and updates) a tailored dynamic encoding
+ * (in/out map parameter) where non-ascii characters are remapped to
+ * the range [128-255] in order of appearance.
+ *
+ * Thus, it supports up to 128 different multibyte code points max over
+ * the whole set of strings sharing this encoding.
+ *
+ * Source: https://github.com/KEINOS/mb_levenshtein
+ *
+ * @param string $str UTF-8 string to be converted to extended ASCII.
+ * @return string Mapped borken string.
+ */
+ private static function to_ascii_remap_intern(string $str, array &$map): string
+ {
+ // find all utf-8 characters
+ $matches = [];
+ if (!\preg_match_all('/[\xC0-\xF7][\x80-\xBF]+/', $str, $matches)) {
+ return $str; // plain ascii string
+ }
+
+ // update the encoding map with the characters not already met
+ $mapCount = \count($map);
+ foreach ($matches[0] as $mbc) {
+ if (!isset($map[$mbc])) {
+ $map[$mbc] = \chr(128 + $mapCount);
+ $mapCount++;
+ }
+ }
+
+ // finally remap non-ascii characters
+ return \strtr($str, $map);
+ }
+
+ /**
* Returns an ASCII version of the string. A set of non-ASCII characters are
* replaced with their closest ASCII counterparts, and the rest are removed
* by default. The language or locale of the source string can be supplied
@@ -807,7 +867,7 @@ final class ASCII
$EXTRA_SYMBOLS_CACHE === null
) {
$EXTRA_SYMBOLS_CACHE = [];
- foreach (self::$ASCII_EXTRAS ?? [] as $extrasLanguageTmp => $extrasDataTmp) {
+ foreach (self::$ASCII_EXTRAS ?? [] as $extrasDataTmp) {
foreach ($extrasDataTmp as $extrasDataKeyTmp => $extrasDataValueTmp) {
$EXTRA_SYMBOLS_CACHE[$extrasDataKeyTmp] = $extrasDataKeyTmp;
}
@@ -933,7 +993,7 @@ final class ASCII
}
}
- foreach ($matches[0] as $keyTmp => $char) {
+ foreach ($matches[0] as $char) {
if (
!isset($charDone[$char])
&&